History

Merge pull request #12937 from SamGondelman/startup

Make Audio.cpp threadsafe

Seth Alves committed 8 years ago

Commit c20346c2 parents 7d68d5f 3b4b43c5 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
@@ -1099,10 +1099,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1098 unmodified lines
10991099 auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>();
11001100 auto myAvatarPosition = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldPosition();
11011101 float distance = glm::distance(myAvatarPosition, position);
1102− bool shouldMute = !audioClient->isMuted() && (distance < radius);
11031102
1104− if (shouldMute) {
1105− audioClient->toggleMute();
1103+ if (distance < radius) {
1104+ audioClient->setMuted(true);
11061105 audioScriptingInterface->environmentMuted();
11071106 }
11081107 });
@@ -1527,7 +1526,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 418 unmodified lines
15271526
15281527 if (state) {
15291528 if (action == controller::toInt(controller::Action::TOGGLE_MUTE)) {
1530− DependencyManager::get<AudioClient>()->toggleMute();
1529+ auto audioClient = DependencyManager::get<AudioClient>();
1530+ audioClient->setMuted(!audioClient->isMuted());
15311531 } else if (action == controller::toInt(controller::Action::CYCLE_CAMERA)) {
15321532 cycleCamera();
15331533 } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) {
@@ -3465,7 +3465,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 1931 unmodified lines
34653465
34663466 case Qt::Key_M:
34673467 if (isMeta) {
3468− DependencyManager::get<AudioClient>()->toggleMute();
3468+ auto audioClient = DependencyManager::get<AudioClient>();
3469+ audioClient->setMuted(!audioClient->isMuted());
34693470 }
34703471 break;
34713472
@@ -5120,7 +5121,7 @@ void Application::update(float deltaTime) { · 1648 unmodified lines
51205121 if (menu->isOptionChecked(MenuOption::AutoMuteAudio) && !audioClient->isMuted()) {
51215122 if (_lastFaceTrackerUpdate > 0
51225123 && ((usecTimestampNow() - _lastFaceTrackerUpdate) > MUTE_MICROPHONE_AFTER_USECS)) {
5123− audioClient->toggleMute();
5124+ audioClient->setMuted(true);
51245125 _lastFaceTrackerUpdate = 0;
51255126 }
51265127 } else {

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