问题描述:

So I am using NAudio to run tests with a headset. I have been using this for a while with no issues but today I have been getting an exception. I start the audio, put the computer to sleep while the audio is playing then wake it up. Once it wakes up the audio device playing the audio has changed and of course the audio isn't playing anymore. After it has woke up NAudio tries to run DirectSoundOut.StopPlayback() on its own causing a System.Runtime.InteropServices.COMException. I see how this might happen since the audio is stopped and maybe NAudio still thinks it is playing or something but I am confused because I have never gotten this issue before. I'm trying to find a way around this or a better way to do it. The only thing that needs to happen is the audio has to be playing when the computer goes to sleep, it can't be stopped before that.

相关阅读:
Top