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 | // in the idle loop? (60 FPS is default) | 103 | // in the idle loop? (60 FPS is default) |
| 104 | static QTimer* idleTimer = NULL; | 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 | const QString CHECK_VERSION_URL = "https://highfidelity.io/latestVersion.xml"; | 106 | const QString CHECK_VERSION_URL = "https://highfidelity.io/latestVersion.xml"; |
| 111 | const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/hifi.skipversion"; | 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 | _touchAvgY(0.0f), | 158 | _touchAvgY(0.0f), |
| 163 | _isTouchPressed(false), | 159 | _isTouchPressed(false), |
| 164 | _mousePressed(false), | 160 | _mousePressed(false), |
| 165 | _audio(STARTUP_JITTER_SAMPLES), | 161 | _audio(), |
| 166 | _enableProcessVoxelsThread(true), | 162 | _enableProcessVoxelsThread(true), |
| 167 | _octreeProcessor(), | 163 | _octreeProcessor(), |
| 168 | _voxelHideShowThread(&_voxels), | 164 | _voxelHideShowThread(&_voxels), |
| @@ -1494,9 +1490,10 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox · 1325 unmodified lines | |||
| 1494 | } | 1490 | } |
| 1495 | 1491 | ||
| 1496 | FaceTracker* Application::getActiveFaceTracker() { | 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 | (_faceplus.isActive() ? static_cast<FaceTracker*>(&_faceplus) : | 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 | struct SendVoxelsOperationArgs { | 1499 | struct SendVoxelsOperationArgs { |
| @@ -1713,9 +1710,15 @@ void Application::init() { · 210 unmodified lines | |||
| 1713 | _lastTimeUpdated.start(); | 1710 | _lastTimeUpdated.start(); |
| 1714 | 1711 | ||
| 1715 | Menu::getInstance()->loadSettings(); | 1712 | Menu::getInstance()->loadSettings(); |
| 1716 | if (Menu::getInstance()->getAudioJitterBufferSamples() != 0) { | 1713 | if (Menu::getInstance()->getAudioJitterBufferFrames() != 0) { |
| 1717 | _audio.setJitterBufferSamples(Menu::getInstance()->getAudioJitterBufferSamples()); | 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 | qDebug("Loaded settings"); | 1722 | qDebug("Loaded settings"); |
| 1720 | 1723 | ||
| 1721 | // initialize our face trackers after loading the menu settings | 1724 | // initialize our face trackers after loading the menu settings |
| @@ -1878,6 +1881,19 @@ void Application::updateVisage() { · 156 unmodified lines | |||
| 1878 | _visage.update(); | 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 | void Application::updateMyAvatarLookAtPosition() { | 1897 | void Application::updateMyAvatarLookAtPosition() { |
| 1882 | PerformanceTimer perfTimer("lookAt"); | 1898 | PerformanceTimer perfTimer("lookAt"); |
| 1883 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1899 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| @@ -2101,21 +2117,6 @@ void Application::update(float deltaTime) { · 217 unmodified lines | |||
| 2101 | // let external parties know we're updating | 2117 | // let external parties know we're updating |
| 2102 | emit simulating(deltaTime); | 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 | // Update _viewFrustum with latest camera and view frustum data... | 2121 | // Update _viewFrustum with latest camera and view frustum data... |
| 2121 | // NOTE: we get this from the view frustum, to make it simpler, since the | 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 | quint64 sinceLastNack = now - _lastSendDownstreamAudioStats; | 2171 | quint64 sinceLastNack = now - _lastSendDownstreamAudioStats; |
| 2170 | if (sinceLastNack > TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS) { | 2172 | if (sinceLastNack > TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS) { |
| 2171 | _lastSendDownstreamAudioStats = now; | 2173 | _lastSendDownstreamAudioStats = now; |
| 2172 | 2174 | ||
| 2173 | QMetaObject::invokeMethod(&_audio, "sendDownstreamAudioStatsPacket", Qt::QueuedConnection); | 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 | int Application::sendNackPackets() { | 2195 | int Application::sendNackPackets() { |
| 2179 | 2196 | ||
| 2180 | if (Menu::getInstance()->isOptionChecked(MenuOption::DisableNackPackets)) { | 2197 | if (Menu::getInstance()->isOptionChecked(MenuOption::DisableNackPackets)) { |