Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Unassigned: Problem with WavOut.Eventhandler [16393]

$
0
0
Hi

I have been trying to use the, playbackstopped eventhandler on the wavout class. I am trying to get a playlist to cycle through audio tracks so at the end of each track it evaluates the playlist and plays the next valid track. For some reason NAudio crashes when I do this at the .init() call I have had a look at the PlaybackStatus and it seems to still be at Playing when the playbackstopped event is or has been called.

Any suggestions....

if you want my project off me please give me a shout moogus@hotmail.co.uk

Darren
Comments: Hi Thanks for the response. I was just using the playbackstopped event to start another track. The action being passed in is the playlist initiating the next track. I traced it through the sample code version and when the playbackstopped event fires the state is not stopped could this be the why? Any advice would be cool. Darren private static IWavePlayer _waveOutDevice; private static WaveStream _mainOutputStream; public NAudioPlayFile() { _waveOutDevice = new WaveOut(); } public void OnTrackStopped(Action action) { _waveOutDevice.PlaybackStopped += (sender, args) => action(); } public void InitializeAudioTrack(string source) { _mainOutputStream = new AudioFileReader(source); } public PlaybackState PlaybackState { get { return _waveOutDevice.PlaybackState; } } public void PlayFile() { _waveOutDevice.Init(_mainOutputStream); _waveOutDevice.Play(); } public void CancelTrack() { _waveOutDevice.Stop(); _waveOutDevice.Dispose(); }

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>