addressing comments

This commit is contained in:
amerhifi 2019-10-31 07:21:16 -07:00
parent 4b4b722875
commit 52e0f54d0c

View file

@ -554,14 +554,14 @@ void AudioDevices::onDevicesChanged(QAudio::Mode mode, const QList<HifiAudioDevi
//set devices for both contexts
if (mode == QAudio::AudioInput) {
_inputs.onDevicesChanged(mode,devices);
_inputs.onDevicesChanged(mode, devices);
static std::once_flag onceAfterInputDevicesChanged;
std::call_once(onceAfterInputDevicesChanged, [&] { // we only want 'selectedDevicePlugged' signal to be handled after initial list of input devices was populated
connect(&_inputs, &AudioDeviceList::selectedDevicePlugged, this, &AudioDevices::chooseInputDevice);
});
} else { // if (mode == QAudio::AudioOutput)
_outputs.onDevicesChanged(mode,devices);
_outputs.onDevicesChanged(mode, devices);
static std::once_flag onceAfterOutputDevicesChanged;
std::call_once(onceAfterOutputDevicesChanged, [&] { // we only want 'selectedDevicePlugged' signal to be handled after initial list of output devices was populated