private void StopAudio()
        {
            if (_audio != null)
            {
                if (_waveReader != null)
                {
                    _waveReader.Dispose();
                    _waveReader = null;
                }

                if (_mp3Reader != null)
                {
                    _mp3Reader.Dispose();
                    _mp3Reader = null;
                }


                try
                {
                    _audio.PlaybackStopped -= PreviewAudio_PlaybackStopped;
                    _audio.Stop();
                    _audio.Dispose();
                }
                catch (Exception e)
                {
                    Logger.Warn($"Error stopping audio: {e.Message}");
                }


                _audio = null;
                NotifyPropertyChanged(nameof(IsPlayingAudio));
            }
        }
Beispiel #2
0
 private void StopAudio()
 {
     if (_audio != null)
     {
         _audio.Stop();
         _audio = null;
     }
 }