1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

AudioDeviceManager: Ensure current state is updated correctly when device settings are updated

This commit is contained in:
reuk 2021-04-13 19:21:18 +01:00
parent 8023985a8a
commit 4cefb3707c
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
2 changed files with 14 additions and 7 deletions

View file

@ -120,6 +120,17 @@ const OwnedArray<AudioIODeviceType>& AudioDeviceManager::getAvailableDeviceTypes
return availableDeviceTypes;
}
void AudioDeviceManager::updateCurrentSetup()
{
if (currentAudioDevice != nullptr)
{
currentSetup.sampleRate = currentAudioDevice->getCurrentSampleRate();
currentSetup.bufferSize = currentAudioDevice->getCurrentBufferSizeSamples();
currentSetup.inputChannels = currentAudioDevice->getActiveInputChannels();
currentSetup.outputChannels = currentAudioDevice->getActiveOutputChannels();
}
}
void AudioDeviceManager::audioDeviceListChanged()
{
if (currentAudioDevice != nullptr)
@ -156,13 +167,7 @@ void AudioDeviceManager::audioDeviceListChanged()
initialiseDefault (preferredDeviceName, &currentSetup);
}
if (currentAudioDevice != nullptr)
{
currentSetup.sampleRate = currentAudioDevice->getCurrentSampleRate();
currentSetup.bufferSize = currentAudioDevice->getCurrentBufferSizeSamples();
currentSetup.inputChannels = currentAudioDevice->getActiveInputChannels();
currentSetup.outputChannels = currentAudioDevice->getActiveOutputChannels();
}
updateCurrentSetup();
}
sendChangeMessage();
@ -874,6 +879,7 @@ void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device
callbacks.getUnchecked(i)->audioDeviceAboutToStart (device);
}
updateCurrentSetup();
sendChangeMessage();
}