Naudio,how to tell playback is completed
Posted
by
Du Sijun
on Stack Overflow
See other posts from Stack Overflow
or by Du Sijun
Published on 2012-06-30T09:02:38Z
Indexed on
2012/06/30
9:15 UTC
Read the original article
Hit count: 2101
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
© Stack Overflow or respective owner