Naudio,how to tell playback is completed
- by Du Sijun
I am using Naudio lib to write a simple win form audio recorder/player. My problem is how can I tell the playback is completed? I need to close the wave stream after that.
I knew there is a PlaybackStopped event listed below:
wfr = new NAudio.Wave.WaveFileReader(this.outputFilename);
audioOutput = new DirectSoundOut();
WaveChannel32 wc = new NAudio.Wave.WaveChannel32(wfr);
audioOutput.Init(wc);
audioOutput.PlaybackStopped += new EventHandler<StoppedEventArgs>(audioOutput_PlaybackStopped);
audioOutput.Play();
But this PlaybackStopped event seems can only be triggered by calling audioOutput.stop(), do anyone know how to determine if playback is complected?
Thanks in advance
C#,windows form,Naudio,windows 7,64bits