This commit is contained in:
Yorick Rommers
2015-10-30 18:32:35 +01:00
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -109,6 +109,7 @@ namespace MusicPlayer
ms.Position = position; ms.Position = position;
Mp3FileReader mp3fr = new Mp3FileReader(ms); Mp3FileReader mp3fr = new Mp3FileReader(ms);
using (WaveStream blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(mp3fr))) using (WaveStream blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(mp3fr)))
{ {
blockAlignedStream.Position = pos; blockAlignedStream.Position = pos;
@@ -136,9 +137,9 @@ namespace MusicPlayer
} }
if (AState == AudioState.SEEKING) if (AState == AudioState.SEEKING)
{ {
blockAlignedStream.Position = seek - (seek % blockAlignedStream.WaveFormat.BlockAlign); blockAlignedStream.Seek(seek - (seek % blockAlignedStream.WaveFormat.BlockAlign), SeekOrigin.Begin);
AState = AudioState.PLAYING; AState = AudioState.PLAYING;
waveOut.Play(); //waveOut.Play();
} }
if (AState == AudioState.STOPPED) if (AState == AudioState.STOPPED)
{ {
@@ -196,7 +197,8 @@ namespace MusicPlayer
LengthBuffer = response.ContentLength; LengthBuffer = response.ContentLength;
using (var stream = response.GetResponseStream()) using (var stream = response.GetResponseStream())
{ {
byte[] buffer = new byte[65536]; // 64KB chunks //byte[] buffer = new byte[65536]; // 64KB chunks
byte[] buffer = new byte[65536*4]; // 256KB chunks
int read; int read;
BState = BufferState.BUFFERING; BState = BufferState.BUFFERING;
AState = AudioState.WAITING; AState = AudioState.WAITING;
@@ -209,7 +211,7 @@ namespace MusicPlayer
ms.Position = pos; ms.Position = pos;
this.bufpos += buffer.Length; this.bufpos = ms.Length;
} }
} }
+1 -1
View File
@@ -280,7 +280,7 @@
// //
// UpdateTimer // UpdateTimer
// //
this.UpdateTimer.Interval = 600; this.UpdateTimer.Interval = 150;
this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick); this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick);
// //
// notifyIcon1 // notifyIcon1