Showing the changes to interface/src/Application.cpp (1 of 117 files). Show all
Unified · Split
| @@ -103,10 +103,6 @@ const int IDLE_SIMULATE_MSECS = 16; // How often should call simul · 102 unmodified lines | ||
| 103 | 103 | // in the idle loop? (60 FPS is default) |
| 104 | 104 | static QTimer* idleTimer = NULL; |
| 105 | 105 | |
| 106 | −const int STARTUP_JITTER_SAMPLES = NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL / 2; | |
| 107 | − // Startup optimistically with small jitter buffer that | |
| 108 | − // will start playback on the second received audio packet. | |
| 109 | − | |
| 110 | 106 | const QString CHECK_VERSION_URL = "https://highfidelity.io/latestVersion.xml"; |
| 111 | 107 | const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/hifi.skipversion"; |
| 112 | 108 | |
| @@ -162,7 +158,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 49 unmodified lines | ||
| 162 | 158 | _touchAvgY(0.0f), |
| 163 | 159 | _isTouchPressed(false), |
| 164 | 160 | _mousePressed(false), |
| 165 | − _audio(STARTUP_JITTER_SAMPLES), | |
| 161 | + _audio(), | |
| 166 | 162 | _enableProcessVoxelsThread(true), |
| 167 | 163 | _octreeProcessor(), |
| 168 | 164 | _voxelHideShowThread(&_voxels), |
| @@ -1494,9 +1490,10 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox · 1325 unmodified lines | ||
| 1494 | 1490 | } |
| 1495 | 1491 | |
| 1496 | 1492 | FaceTracker* Application::getActiveFaceTracker() { |
| 1497 | − return _faceshift.isActive() ? static_cast<FaceTracker*>(&_faceshift) : | |
| 1493 | + return _cara.isActive() ? static_cast<FaceTracker*>(&_cara) : | |
| 1494 | + (_faceshift.isActive() ? static_cast<FaceTracker*>(&_faceshift) : | |
| 1498 | 1495 | (_faceplus.isActive() ? static_cast<FaceTracker*>(&_faceplus) : |
| 1499 | − (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL)); | |
| 1496 | + (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL))); | |
| 1500 | 1497 | } |
| 1501 | 1498 | |
| 1502 | 1499 | struct SendVoxelsOperationArgs { |
| @@ -1713,9 +1710,15 @@ void Application::init() { · 210 unmodified lines | ||
| 1713 | 1710 | _lastTimeUpdated.start(); |
| 1714 | 1711 | |
| 1715 | 1712 | Menu::getInstance()->loadSettings(); |
| 1716 | − if (Menu::getInstance()->getAudioJitterBufferSamples() != 0) { | |
| 1717 | − _audio.setJitterBufferSamples(Menu::getInstance()->getAudioJitterBufferSamples()); | |
| 1713 | + if (Menu::getInstance()->getAudioJitterBufferFrames() != 0) { | |
| 1714 | + _audio.setDynamicJitterBuffers(false); | |
| 1715 | + _audio.setStaticDesiredJitterBufferFrames(Menu::getInstance()->getAudioJitterBufferFrames()); | |
| 1716 | + } else { | |
| 1717 | + _audio.setDynamicJitterBuffers(true); | |
| 1718 | 1718 | } |
| 1719 | + | |
| 1720 | + _audio.setMaxFramesOverDesired(Menu::getInstance()->getMaxFramesOverDesired()); | |
| 1721 | + | |
| 1719 | 1722 | qDebug("Loaded settings"); |
| 1720 | 1723 | |
| 1721 | 1724 | // initialize our face trackers after loading the menu settings |
| @@ -1878,6 +1881,19 @@ void Application::updateVisage() { · 156 unmodified lines | ||
| 1878 | 1881 | _visage.update(); |
| 1879 | 1882 | } |
| 1880 | 1883 | |
| 1884 | +void Application::updateCara() { | |
| 1885 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1886 | + PerformanceWarning warn(showWarnings, "Application::updateCara()"); | |
| 1887 | + | |
| 1888 | + // Update Cara | |
| 1889 | + _cara.update(); | |
| 1890 | + | |
| 1891 | + // Copy angular velocity if measured by cara, to the head | |
| 1892 | + if (_cara.isActive()) { | |
| 1893 | + _myAvatar->getHead()->setAngularVelocity(_cara.getHeadAngularVelocity()); | |
| 1894 | + } | |
| 1895 | +} | |
| 1896 | + | |
| 1881 | 1897 | void Application::updateMyAvatarLookAtPosition() { |
| 1882 | 1898 | PerformanceTimer perfTimer("lookAt"); |
| 1883 | 1899 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| @@ -2101,21 +2117,6 @@ void Application::update(float deltaTime) { · 217 unmodified lines | ||
| 2101 | 2117 | // let external parties know we're updating |
| 2102 | 2118 | emit simulating(deltaTime); |
| 2103 | 2119 | } |
| 2104 | −} | |
| 2105 | − | |
| 2106 | −void Application::updateMyAvatar(float deltaTime) { | |
| 2107 | − bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2108 | − PerformanceWarning warn(showWarnings, "Application::updateMyAvatar()"); | |
| 2109 | − | |
| 2110 | − _myAvatar->update(deltaTime); | |
| 2111 | − | |
| 2112 | − { | |
| 2113 | − // send head/hand data to the avatar mixer and voxel server | |
| 2114 | − PerformanceTimer perfTimer("send"); | |
| 2115 | − QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData); | |
| 2116 | − packet.append(_myAvatar->toByteArray()); | |
| 2117 | − controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer); | |
| 2118 | − } | |
| 2119 | 2120 | |
| 2120 | 2121 | // Update _viewFrustum with latest camera and view frustum data... |
| 2121 | 2122 | // NOTE: we get this from the view frustum, to make it simpler, since the |
| @@ -2165,16 +2166,32 @@ void Application::updateMyAvatar(float deltaTime) { · 43 unmodified lines | ||
| 2165 | 2166 | } |
| 2166 | 2167 | } |
| 2167 | 2168 | |
| 2169 | + // send packet containing downstream audio stats to the AudioMixer | |
| 2168 | 2170 | { |
| 2169 | 2171 | quint64 sinceLastNack = now - _lastSendDownstreamAudioStats; |
| 2170 | 2172 | if (sinceLastNack > TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS) { |
| 2171 | 2173 | _lastSendDownstreamAudioStats = now; |
| 2172 | − | |
| 2174 | + | |
| 2173 | 2175 | QMetaObject::invokeMethod(&_audio, "sendDownstreamAudioStatsPacket", Qt::QueuedConnection); |
| 2174 | 2176 | } |
| 2175 | 2177 | } |
| 2176 | 2178 | } |
| 2177 | 2179 | |
| 2180 | +void Application::updateMyAvatar(float deltaTime) { | |
| 2181 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2182 | + PerformanceWarning warn(showWarnings, "Application::updateMyAvatar()"); | |
| 2183 | + | |
| 2184 | + _myAvatar->update(deltaTime); | |
| 2185 | + | |
| 2186 | + { | |
| 2187 | + // send head/hand data to the avatar mixer and voxel server | |
| 2188 | + PerformanceTimer perfTimer("send"); | |
| 2189 | + QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData); | |
| 2190 | + packet.append(_myAvatar->toByteArray()); | |
| 2191 | + controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer); | |
| 2192 | + } | |
| 2193 | +} | |
| 2194 | + | |
| 2178 | 2195 | int Application::sendNackPackets() { |
| 2179 | 2196 | |
| 2180 | 2197 | if (Menu::getInstance()->isOptionChecked(MenuOption::DisableNackPackets)) { |