private void tmrUpdate_Tick(object sender, EventArgs e) { if ((_isPlaying) && (CurrentBuffer != null)) { CurrentBuffer.Fill(); trackBarPosition.Value = CurrentBuffer.ReadSample; if (!_loop) { if (CurrentBuffer.ReadSample >= _targetStream.Samples) { Stop(); AudioEnded?.Invoke(this, new EventArgs()); } } } }
public AudioEngine() { if (WasapiOut.IsSupportedOnCurrentPlatform) { soundOut = new WasapiOut(); } else { soundOut = new DirectSoundOut(); } soundOut.Stopped += (s, args) => { if (soundOut.PlaybackState == PlaybackState.Stopped) { AudioEnded?.Invoke(this, null); } }; }
private void app_AudioEnded(object sender, EventArgs e) { AudioEnded?.Invoke(this, e); }