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
1099 auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>();1099 auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>();
1100 auto myAvatarPosition = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldPosition();1100 auto myAvatarPosition = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldPosition();
1101 float distance = glm::distance(myAvatarPosition, position);1101 float distance = glm::distance(myAvatarPosition, position);
1102 bool shouldMute = !audioClient->isMuted() && (distance < radius);
1103 1102
1104 if (shouldMute) {1103 if (distance < radius) {
1105 audioClient->toggleMute();1104 audioClient->setMuted(true);
1106 audioScriptingInterface->environmentMuted();1105 audioScriptingInterface->environmentMuted();
1107 }1106 }
1108 });1107 });
@@ -1527,7 +1526,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 418 unmodified lines
1527 1526
1528 if (state) {1527 if (state) {
1529 if (action == controller::toInt(controller::Action::TOGGLE_MUTE)) {1528 if (action == controller::toInt(controller::Action::TOGGLE_MUTE)) {
1530 DependencyManager::get<AudioClient>()->toggleMute();1529 auto audioClient = DependencyManager::get<AudioClient>();
1530 audioClient->setMuted(!audioClient->isMuted());
1531 } else if (action == controller::toInt(controller::Action::CYCLE_CAMERA)) {1531 } else if (action == controller::toInt(controller::Action::CYCLE_CAMERA)) {
1532 cycleCamera();1532 cycleCamera();
1533 } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) {1533 } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) {
@@ -3465,7 +3465,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 1931 unmodified lines
3465 3465
3466 case Qt::Key_M:3466 case Qt::Key_M:
3467 if (isMeta) {3467 if (isMeta) {
3468 DependencyManager::get<AudioClient>()->toggleMute();3468 auto audioClient = DependencyManager::get<AudioClient>();
3469 audioClient->setMuted(!audioClient->isMuted());
3469 }3470 }
3470 break;3471 break;
3471 3472
@@ -5120,7 +5121,7 @@ void Application::update(float deltaTime) { · 1648 unmodified lines
5120 if (menu->isOptionChecked(MenuOption::AutoMuteAudio) && !audioClient->isMuted()) {5121 if (menu->isOptionChecked(MenuOption::AutoMuteAudio) && !audioClient->isMuted()) {
5121 if (_lastFaceTrackerUpdate > 05122 if (_lastFaceTrackerUpdate > 0
5122 && ((usecTimestampNow() - _lastFaceTrackerUpdate) > MUTE_MICROPHONE_AFTER_USECS)) {5123 && ((usecTimestampNow() - _lastFaceTrackerUpdate) > MUTE_MICROPHONE_AFTER_USECS)) {
5123 audioClient->toggleMute();5124 audioClient->setMuted(true);
5124 _lastFaceTrackerUpdate = 0;5125 _lastFaceTrackerUpdate = 0;
5125 }5126 }
5126 } else {5127 } 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