After WASAPI running device’s sample rate was changed (with OS control panel),
there are no sound from application but audioIOCallback occurs.
I think users expect sound to continue after a sample rate change, like ASIO audio devices and its control panels.
Hmm. Interesting point. I guess it should handle that. Looks like a huge amount of hassle to set up a IAudioSessionEvents com object though, I’m a bit too busy to get stuck into doing that at the moment…
Hmm, I just hacked together an implementation that will catch these callbacks, but then realised I’m not really sure what to do when it happens… I got as far as making the audio thread aware when the rate changes, but then had to stop and need to think about what it should do. It’s a start, anyway - I need to work on some other stuff now, but you might want to see if what I’ve done actually works.
Thanks, I’ve tried the latest tip then callback works.
I’m not sure about what it should do, either… but for our application, reopening the device with its current settings (like as ASIOAudioIODevice::timerCallback()) seems to work fine. Then the application have only to handle audioDeviceStopped() and audioDeviceAboutToStart() correctly.
Moreover, I think it might be not bad for other DisconnectReason.
e.g. there are devices that disconnect session when headphone is disconnected because of DisconnectReasonDeviceRemoval. It will fail to reopen, and only AudioIODeviceCallback::audioDeviceStopped() will be called.
TheVinn:
Wow, I am a newbie of WASAPI! I have just known about this matter