From b1ec95db6e60ea34b18f7ad4dd5e1fff07035e75 Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 4 Nov 2025 14:02:59 +0000 Subject: [PATCH] Revert "AudioDeviceManager: Handle loading of XML with missing fields more gracefully" This reverts commit 3c1012baebef97410461c7e2597652b0102d782c. This change caused the AudioDeviceManager to open a fallback device if the device name was empty, the requested number of channels was positive, and selectDefaultDeviceOnFailure was true. The new behaviour conflicted with the documented behaviour of initialise(). The number of input/output channels is to be treated as a maximum, rather than a preferred count. If a positive channelsNeeded is requested but the device name is empty, a default device should not be opened since the actual number of channels (0) is lower than the maximum specified number. --- .../audio_io/juce_AudioDeviceManager.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index ca7173def1..a08901b4e5 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -510,16 +510,6 @@ String AudioDeviceManager::initialiseFromXML (const XmlElement& xml, currentDeviceType = firstType->getTypeName(); } - const auto deviceNameMissing = (numInputChansNeeded > 0 && setup.inputDeviceName .isEmpty()) - || (numOutputChansNeeded > 0 && setup.outputDeviceName.isEmpty()); - - // If there's no device name, then normally this would prevent a device from opening. - // If failing to open a device would conflict with the number of requested channels, then we - // pre-emptively treat this as a failure and fall back to using devices that're able to provide - // the requested channel counts. - if (selectDefaultDeviceOnFailure && deviceNameMissing) - insertDefaultDeviceNames (setup); - setup.bufferSize = xml.getIntAttribute ("audioDeviceBufferSize", setup.bufferSize); setup.sampleRate = xml.getDoubleAttribute ("audioDeviceRate", setup.sampleRate);