Parcourir la source

Calculate proper length invalid seconds

Kenneth van Ewijk il y a 10 ans
Parent
commit
7e2496dd74
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      MusicPlayer/MusicPlayer/AudioHandler.cs

+ 2 - 1
MusicPlayer/MusicPlayer/AudioHandler.cs

@@ -159,9 +159,10 @@ namespace MusicPlayer
                     waveOut.Play();
 
                     if (CurrentSong == null || CurrentSong.Seconds == 0)
-                        Length = ms.Length / waveOut.OutputWaveFormat.AverageBytesPerSecond;
+                        Length = ms.Length;
                     else
                         Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond;
+
                     CurrentTime = (int)(ms.Position / waveOut.OutputWaveFormat.AverageBytesPerSecond);
 
                     while (waveOut.PlaybackState != PlaybackState.Stopped)