Here is the code we suspect is wrong:
void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device)
{
loadMeasurer.reset (device->getCurrentSampleRate(),
device->getCurrentBufferSizeSamples());
{
const ScopedLock sl (audioCallbackLock);
for (int i = callbacks.size(); --i >= 0;)
callbacks.getUnchecked(i)->audioDeviceAboutToStart (device);
}
updateCurrentSetup();
sendChangeMessage();
}
As you can see, updateCurrentSetup();
is being called after the listeners audioDeviceAboutToStart
is called.
Therefore, listeners getting the audioDeviceAboutToStart
callback will get stale data when calling getAudioDeviceSetup()
.
We noticed this issue when changing the sample rate from the ASIO panel.
What we do to fix it currently, is that in our audioDeviceAboutToStart
we manually get the up to date information by reading from the current device (getCurrentAudioDevice()
) instead of calling getAudioDeviceSetup()
.
But I reckon that getAudioDeviceSetup()
should return up to date information at that point. If not, what is the logic here?
Thank you