Showing the changes to interface/src/scripting/AudioDeviceScriptingInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -48,15 +48,31 @@ AudioDeviceScriptingInterface::AudioDeviceScriptingInterface(): QAbstractListMod · 47 unmodified lines | |||
| 48 | SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance(); | 48 | SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance(); |
| 49 | const QString inDevice = settings->getValue("audio_input_device", _currentInputDevice).toString(); | 49 | const QString inDevice = settings->getValue("audio_input_device", _currentInputDevice).toString(); |
| 50 | if (inDevice != _currentInputDevice) { | 50 | if (inDevice != _currentInputDevice) { |
| 51 | qCDebug(audioclient) << __FUNCTION__ << "about to call setInputDeviceAsync() device: [" << inDevice << "] _currentInputDevice:" << _currentInputDevice; | 51 | // before using the old setting, check to make sure the device still exists.... |
| 52 | setInputDeviceAsync(inDevice); | 52 | bool inDeviceExists = DependencyManager::get<AudioClient>()->getNamedAudioDeviceForModeExists(QAudio::AudioInput, inDevice); |
| 53 | |||
| 54 | if (inDeviceExists) { | ||
| 55 | qCDebug(audioclient) << __FUNCTION__ << "about to call setInputDeviceAsync() device: [" << inDevice << "] _currentInputDevice:" << _currentInputDevice; | ||
| 56 | setInputDeviceAsync(inDevice); | ||
| 57 | } else { | ||
| 58 | qCDebug(audioclient) << __FUNCTION__ << "previously selected device no longer exists inDevice: [" << inDevice << "] keeping device _currentInputDevice:" << _currentInputDevice; | ||
| 59 | } | ||
| 53 | } | 60 | } |
| 54 | 61 | ||
| 55 | // If the audio_output_device setting is not available, use the _currentOutputDevice | 62 | // If the audio_output_device setting is not available, use the _currentOutputDevice |
| 56 | auto outDevice = settings->getValue("audio_output_device", _currentOutputDevice).toString(); | 63 | auto outDevice = settings->getValue("audio_output_device", _currentOutputDevice).toString(); |
| 64 | |||
| 57 | if (outDevice != _currentOutputDevice) { | 65 | if (outDevice != _currentOutputDevice) { |
| 58 | qCDebug(audioclient) << __FUNCTION__ << "about to call setOutputDeviceAsync() outDevice: [" << outDevice << "] _currentOutputDevice:" << _currentOutputDevice; | 66 | // before using the old setting, check to make sure the device still exists.... |
| 59 | setOutputDeviceAsync(outDevice); | 67 | bool outDeviceExists = DependencyManager::get<AudioClient>()->getNamedAudioDeviceForModeExists(QAudio::AudioOutput, outDevice); |
| 68 | |||
| 69 | if (outDeviceExists) { | ||
| 70 | qCDebug(audioclient) << __FUNCTION__ << "about to call setOutputDeviceAsync() outDevice: [" << outDevice << "] _currentOutputDevice:" << _currentOutputDevice; | ||
| 71 | setOutputDeviceAsync(outDevice); | ||
| 72 | } else { | ||
| 73 | qCDebug(audioclient) << __FUNCTION__ << "previously selected device no longer exists outDevice: [" << outDevice << "] keeping device _currentOutputDevice:" << _currentOutputDevice; | ||
| 74 | } | ||
| 75 | |||
| 60 | } | 76 | } |
| 61 | } | 77 | } |
| 62 | 78 | ||