Skip to content

Commit

Permalink
Fixed an issue falling back to an incompatible audio device configura…
Browse files Browse the repository at this point in the history
…tion after a disconnection
  • Loading branch information
tpoole committed Dec 5, 2018
1 parent cdff2c7 commit d81ce3c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp
Expand Up @@ -140,13 +140,20 @@ void AudioDeviceManager::audioDeviceListChanged()
closeAudioDevice();

std::unique_ptr<XmlElement> e (createStateXml());
initialiseFromXML (*e, true, preferredDeviceName, &currentSetup);

if (e == nullptr)
initialiseDefault (preferredDeviceName, &currentSetup);
else
initialiseFromXML (*e, true, preferredDeviceName, &currentSetup);
}

currentSetup.sampleRate = currentAudioDevice->getCurrentSampleRate();
currentSetup.bufferSize = currentAudioDevice->getCurrentBufferSizeSamples();
currentSetup.inputChannels = currentAudioDevice->getActiveInputChannels();
currentSetup.outputChannels = currentAudioDevice->getActiveOutputChannels();
if (currentAudioDevice != nullptr)
{
currentSetup.sampleRate = currentAudioDevice->getCurrentSampleRate();
currentSetup.bufferSize = currentAudioDevice->getCurrentBufferSizeSamples();
currentSetup.inputChannels = currentAudioDevice->getActiveInputChannels();
currentSetup.outputChannels = currentAudioDevice->getActiveOutputChannels();
}
}

sendChangeMessage();
Expand Down

0 comments on commit d81ce3c

Please sign in to comment.