mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-08 23:24:19 +00:00
AudioDeviceManager: Handle loading of XML with missing fields more gracefully
This commit is contained in:
parent
f6df3e3ce1
commit
3c1012baeb
1 changed files with 10 additions and 0 deletions
|
|
@ -511,6 +511,16 @@ 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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue