According to Recovering from an Invalid-Device Error, Perhaps you need the IAudioSessionEvents interface.
An application can determine more precisely the cause of an invalid-device error by registering to receive a notification when a session loses its connection to a device. To enable this notification, the application implements an IAudioSessionEvents interface and calls the IAudioSessionControl::RegisterAudioSessionNotification method to register the interface. When an invalid-device error causes the session to be disconnected, WASAPI calls the IAudioSessionEvents::OnSessionDisconnected method in the registered interface. Through this method, WASAPI informs the application of the reason for the disconnection. In Windows Vista, the OnSessionDisconnected call identifies the following reasons:
The user removed the audio endpoint device.
The Windows audio service has shut down.
The preferred stream format changed for the device that the audio session is connected to.
The user logged off the Windows Terminal Services (WTS) session that the audio session was running in. For more information about WTS sessions, see the Windows SDK documentation.
The WTS session that the audio session was running in was disconnected.
The (shared-mode) audio session was disconnected to make the audio endpoint device available for an exclusive-mode connection.