History

Ensure audio devices are made on the right thread

Atlante45 committed 8 years ago

Commit 29ff47c1 parent 9ace80c2 files · +13 −2Browse files

Showing the changes to libraries/script-engine/src/AudioScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

libraries/script-engine/src/AudioScriptingInterface.cpp+8−1
@@ -63,8 +63,15 @@ ScriptAudioInjector* AudioScriptingInterface::playSound(SharedSoundPointer sound · 62 unmodified lines
63bool AudioScriptingInterface::setStereoInput(bool stereo) {63bool AudioScriptingInterface::setStereoInput(bool stereo) {
64 bool stereoInputChanged = false;64 bool stereoInputChanged = false;
65 if (_localAudioInterface) {65 if (_localAudioInterface) {
66 stereoInputChanged = _localAudioInterface->setIsStereoInput(stereo);66 if (QThread::currentThread() != _localAudioInterface->thread()) {
67 // TODO: This can block the main thread which is not ideal, make this function and the UI calling it async
68 BLOCKING_INVOKE_METHOD(_localAudioInterface, "setIsStereoInput", Q_RETURN_ARG(bool, stereoInputChanged),
69 Q_ARG(bool, stereo));
70 } else {
71 stereoInputChanged = _localAudioInterface->setIsStereoInput(stereo);
72 }
67 }73 }
74
68 return stereoInputChanged;75 return stereoInputChanged;
69}76}
70 77