Explorar el Código

Calculate proper length invalid seconds

Kenneth van Ewijk hace 10 años
padre
commit
7e2496dd74
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  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)