示例#1
0
        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());
                    }
                }
            }
        }
示例#2
0
 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);
 }