History

try to fix audio crash on startup

SamGondelman committed 8 years ago

Commit 3b4b43c1 parent 7c65c9c5 files · +134 −75Browse files

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

Unified · Split

interface/src/Application.cpp+7−6
@@ -1102,10 +1102,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1101 unmodified lines
11021102 auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>();
11031103 auto myAvatarPosition = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldPosition();
11041104 float distance = glm::distance(myAvatarPosition, position);
1105− bool shouldMute = !audioClient->isMuted() && (distance < radius);
11061105
1107− if (shouldMute) {
1108− audioClient->toggleMute();
1106+ if (distance < radius) {
1107+ audioClient->setMuted(true);
11091108 audioScriptingInterface->environmentMuted();
11101109 }
11111110 });
@@ -1508,7 +1507,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 396 unmodified lines
15081507
15091508 if (state) {
15101509 if (action == controller::toInt(controller::Action::TOGGLE_MUTE)) {
1511− DependencyManager::get<AudioClient>()->toggleMute();
1510+ auto audioClient = DependencyManager::get<AudioClient>();
1511+ audioClient->setMuted(!audioClient->isMuted());
15121512 } else if (action == controller::toInt(controller::Action::CYCLE_CAMERA)) {
15131513 cycleCamera();
15141514 } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) {
@@ -3461,7 +3461,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 1946 unmodified lines
34613461
34623462 case Qt::Key_M:
34633463 if (isMeta) {
3464− DependencyManager::get<AudioClient>()->toggleMute();
3464+ auto audioClient = DependencyManager::get<AudioClient>();
3465+ audioClient->setMuted(!audioClient->isMuted());
34653466 }
34663467 break;
34673468
@@ -5119,7 +5120,7 @@ void Application::update(float deltaTime) { · 1651 unmodified lines
51195120 if (menu->isOptionChecked(MenuOption::AutoMuteAudio) && !audioClient->isMuted()) {
51205121 if (_lastFaceTrackerUpdate > 0
51215122 && ((usecTimestampNow() - _lastFaceTrackerUpdate) > MUTE_MICROPHONE_AFTER_USECS)) {
5122− audioClient->toggleMute();
5123+ audioClient->setMuted(true);
51235124 _lastFaceTrackerUpdate = 0;
51245125 }
51255126 } else {