Przeglądaj źródła

Calculate proper length invalid seconds

Kenneth van Ewijk 10 lat temu
rodzic
commit
7e2496dd74
1 zmienionych plików z 2 dodań i 1 usunięć
  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)