Stacktrace:
at NAudio.Wave.WaveInterop.waveOutClose(IntPtr hWaveOut)
at NAudio.Wave.WaveOut.Dispose(Boolean disposing)
at NAudio.Wave.WaveOut.Dispose()
I've tested this with version 1.5 and 1.6 of NAudio, it only happens when I compile my application for 64-bit, 32-bit works fine.
Small codepiece where it happens:
if (wavePlayer != null)
{
this.wavePlayer.Stop();
this.wavePlayer.Dispose(); //AccessViolationException
}
Initialization of the WaveOut class:
this.wavePlayer = new WaveOut(WaveCallbackInfo.FunctionCallback());
I've also tried it with the new WaveOutEvent class in NAudio, but the problem persists.
Comments: OK, what is the simplest code that reproduces this problem? Are you using any decoders (e.g. playing MP3 or other compressed formats)? Do you need to play for a certain length of time for it to happen etc?