This project has moved and is read-only. For the latest updates, please go here.

WasapiOutRT "freezes"

Apr 1, 2014 at 8:32 AM

I wonder if anyone can point out what's going wrong. Sometimes when I play music for long periods, the music just stops playing.

After leaving my PC up and running overnight I was able to debug it and I noticed that WasapiOutRT's PlaybackState was Playing but underlying WaveStream's CurrentTime didn't change. WasapiOutRT had buffer of about 80k bytes. I tried pausing/stopping the player and skipping the wavestream and then playing again but it was still stuck.

This might happen in couple of hours or overnight or sometimes it takes even longer. It's not related to any song.

I don't dispose my WasapiOutRT or MixingSampleProvider/SampleToWaveProvider at all (I do dispose WaveStream and remove them from mixing sample provider). According to task manager my app's memory consumption stays low.

Here is part of my initialization code:
        this.WasapiPlayer = new WasapiOutRT(AudioClientShareMode.Shared, 200);

        this.Mixer = new NAudio.Wave.SampleProviders.MixingSampleProvider(new ISampleProvider[] { item.FadeInOutProvider });

        this.WaveProvider = new NAudio.Wave.SampleProviders.SampleToWaveProvider(Mixer);

        await WasapiPlayer.Init(this.WaveProvider);
Is WasapiPlayer intended to be used this way (not disposing it and playing music 24/7 for days/weeks)? Any idea why music stops and doesn't continue even after calling WasapiOutRT.Stop() and Play()?

Apr 29, 2014 at 8:21 PM
hi, I've done some bugfixing to WasapiOutRT recently, so maybe worth testing your app again. I'm afraid I don't have the time at the moment to do long-running tests of my own.