Browse Source

Delete the current audio device when no inputs or outputs are specified in AudioDeviceManager::setAudioDeviceSetup() and ensure that the AudioDeviceSelectorComponent displays this correctly

tags/2021-05-28
ed 6 years ago
parent
commit
4fa131f5a7
2 changed files with 6 additions and 6 deletions
  1. +5
    -5
      modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp
  2. +1
    -1
      modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp

+ 5
- 5
modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp View File

@@ -463,10 +463,13 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup
{
jassert (&newSetup != &currentSetup); // 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


+ 1
- 1
modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp View File

@@ -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);


Loading…
Cancel
Save