History

Merge branch 'master' of https://github.com/highfidelity/hifi into virtualEntities

ZappoMan committed 12 years ago

Commit 77e18672 parents dd3d4be d4d4069117 files · +4891 −2061Browse files

Showing the changes to interface/src/Application.cpp (1 of 117 files). Show all

Unified · Split

interface/src/Application.cpp+42−25
@@ -103,10 +103,6 @@ const int IDLE_SIMULATE_MSECS = 16; // How often should call simul · 102 unmodified lines
103103 // in the idle loop? (60 FPS is default)
104104 static QTimer* idleTimer = NULL;
105105
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−
110106 const QString CHECK_VERSION_URL = "https://highfidelity.io/latestVersion.xml";
111107 const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/hifi.skipversion";
112108
@@ -162,7 +158,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 49 unmodified lines
162158 _touchAvgY(0.0f),
163159 _isTouchPressed(false),
164160 _mousePressed(false),
165− _audio(STARTUP_JITTER_SAMPLES),
161+ _audio(),
166162 _enableProcessVoxelsThread(true),
167163 _octreeProcessor(),
168164 _voxelHideShowThread(&_voxels),
@@ -1494,9 +1490,10 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox · 1325 unmodified lines
14941490 }
14951491
14961492 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) :
14981495 (_faceplus.isActive() ? static_cast<FaceTracker*>(&_faceplus) :
1499− (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL));
1496+ (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL)));
15001497 }
15011498
15021499 struct SendVoxelsOperationArgs {
@@ -1713,9 +1710,15 @@ void Application::init() { · 210 unmodified lines
17131710 _lastTimeUpdated.start();
17141711
17151712 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);
17181718 }
1719+
1720+ _audio.setMaxFramesOverDesired(Menu::getInstance()->getMaxFramesOverDesired());
1721+
17191722 qDebug("Loaded settings");
17201723
17211724 // initialize our face trackers after loading the menu settings
@@ -1878,6 +1881,19 @@ void Application::updateVisage() { · 156 unmodified lines
18781881 _visage.update();
18791882 }
18801883
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+
18811897 void Application::updateMyAvatarLookAtPosition() {
18821898 PerformanceTimer perfTimer("lookAt");
18831899 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
@@ -2101,21 +2117,6 @@ void Application::update(float deltaTime) { · 217 unmodified lines
21012117 // let external parties know we're updating
21022118 emit simulating(deltaTime);
21032119 }
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− }
21192120
21202121 // Update _viewFrustum with latest camera and view frustum data...
21212122 // 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
21652166 }
21662167 }
21672168
2169+ // send packet containing downstream audio stats to the AudioMixer
21682170 {
21692171 quint64 sinceLastNack = now - _lastSendDownstreamAudioStats;
21702172 if (sinceLastNack > TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS) {
21712173 _lastSendDownstreamAudioStats = now;
2172−
2174+
21732175 QMetaObject::invokeMethod(&_audio, "sendDownstreamAudioStatsPacket", Qt::QueuedConnection);
21742176 }
21752177 }
21762178 }
21772179
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+
21782195 int Application::sendNackPackets() {
21792196
21802197 if (Menu::getInstance()->isOptionChecked(MenuOption::DisableNackPackets)) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t