From 876c9a0f3a84884cf658fa078ea2afc2ebaed207 Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 7 Mar 2008 16:19:58 +0000 Subject: [PATCH] --- .../juce_AudioDeviceSelectorComponent.cpp | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/juce_appframework/gui/components/special/juce_AudioDeviceSelectorComponent.cpp b/src/juce_appframework/gui/components/special/juce_AudioDeviceSelectorComponent.cpp index b35599853c..59f36e69cc 100644 --- a/src/juce_appframework/gui/components/special/juce_AudioDeviceSelectorComponent.cpp +++ b/src/juce_appframework/gui/components/special/juce_AudioDeviceSelectorComponent.cpp @@ -424,11 +424,24 @@ void AudioDeviceSelectorComponent::comboBoxChanged (ComboBox* comboBoxThatHasCha if (error.isNotEmpty()) { - AlertWindow::showMessageBox (AlertWindow::WarningIcon, - T("Error while opening \"") - + audioDeviceDropDown->getText() - + T("\""), - error); +#if JUCE_WIN32 + if (deviceManager.getInputChannels().countNumberOfSetBits() > 0 + && deviceManager.getOutputChannels().countNumberOfSetBits() > 0) + { + // in DSound, some machines lose their primary input device when a mic + // is removed, and this also buggers up our attempt at opening an output + // device, so this is a workaround that doesn't fail in that case. + BitArray noInputs; + error = deviceManager.setAudioDevice (audioDeviceDropDown->getText(), + 0, 0, &noInputs, 0, false); + } +#endif + if (error.isNotEmpty()) + AlertWindow::showMessageBox (AlertWindow::WarningIcon, + T("Error while opening \"") + + audioDeviceDropDown->getText() + + T("\""), + error); } }