diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index 29eb223d6a..7edbe713e6 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -463,10 +463,13 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup { jassert (&newSetup != ¤tSetup); // this will have no effect - if (newSetup == currentSetup && currentAudioDevice != nullptr) + if (newSetup != currentSetup) + sendChangeMessage(); + else if (currentAudioDevice != nullptr) return {}; - if (getCurrentDeviceTypeObject() == nullptr) + if (getCurrentDeviceTypeObject() == nullptr + || (newSetup.inputDeviceName.isEmpty() && newSetup.outputDeviceName.isEmpty())) { deleteCurrentDevice(); @@ -478,9 +481,6 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup stopDevice(); - if (newSetup != currentSetup) - sendChangeMessage(); - String error; if (currentSetup.inputDeviceName != newSetup.inputDeviceName diff --git a/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp b/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp index 1b58e08237..920330474f 100644 --- a/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp @@ -542,7 +542,7 @@ private: auto* currentDevice = setup.manager->getCurrentAudioDevice(); auto index = type.getIndexOfDevice (currentDevice, isInput); - box->setSelectedId (index + 1, dontSendNotification); + box->setSelectedId (index < 0 ? index : index + 1, dontSendNotification); if (testButton != nullptr && ! isInput) testButton->setEnabled (index >= 0);