BR? AudioDeviceManager::audioDeviceAboutToStartInt sends stale data to listeners

Here is the code we suspect is wrong:

void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device)
    loadMeasurer.reset (device->getCurrentSampleRate(),

        const ScopedLock sl (audioCallbackLock);

        for (int i = callbacks.size(); --i >= 0;)
            callbacks.getUnchecked(i)->audioDeviceAboutToStart (device);


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

@reuk any insight on this one? Would it be ok to call updateCurrentSetup() before calling the listeners?

Yep, I’ve got this work on a branch with some tests. I expect it’ll be merged early next week. Thanks for reporting!

Great, thank you!

The issue should be fixed by this change:

1 Like