Windows audio settings not updating JUCE audio settings

I’ve noticed that the sample rate in the dropdown of the JUCE Audio Settings dialog is not being updated when I change the sample rate via the Windows Audio Settings. This problem is present also in the JUCE demos. However, the problem is not present in Waveform.

So far I’ve boiled it down to the following code:


When changing the sample rate via the Windows Audio Settings, the output device becomes inactive and the OnSessionDisconnected is called. This is where a flag is set to update the sample rate. However, we never get a notification that the output device has been reactivated. This blocks the update.

Any help appreciated

There seems to be a race condition. If I do the following, the bug is no longer there.