WASAPI Sample Rate Change Not Reflected Correctly

Hi Jules,

Related issues to the changes done from this post: when a device’s sample rate has changed from the WASAPI control panel, the WASAPIAudioIODevice’s “currentSampleRate” is updated, but the audio device manager’s configuration isn’t. The reason is a bit of missing code, and that WASAPIAudioIODeviceType::systemDeviceChanged() is called too early, or needs to be called again somehow after the device has re-opened to get the new sample rate.

Here’s an edit to update the ADM’s setup:

void AudioDeviceManager::audioDeviceListChanged()
    currentSetup.sampleRate = currentAudioDevice->getCurrentSampleRate();
    currentSetup.bufferSize = currentAudioDevice->getCurrentBufferSizeSamples(); //Here just in case


Ah, good idea, thanks!

Because WASAPIAudioIODevice::handleAsyncUpdate() occurs after ChangeNotificationClient is notified, my current solution is:
[]having WASAPIAudioIODevice inherit ChangeBroadcaster[/]
[]having WASAPIAudioIODeviceType inherit ChangeListener[/]
[]sending a change message after the device is reopened in WASAPIAudioIODevice::handleAsyncUpdate()[/]
[]calling WASAPIAudioIODeviceType::systemDeviceChanged() in WASAPIAudioIODeviceType::changeListenerCallback()[/][/list]

I think this renders ChangeNotificationClient moot for sample rates changes though! (Sorry 'bout that)

I’ve had a hasty go at this… Sanity-checking appreciated!

Works for me - merci!