This commit is contained in:
Master Kwoth 2016-02-21 05:56:29 +01:00
parent 7c12169d9c
commit 7874cb1728

View File

@ -205,7 +205,7 @@ namespace NadekoBot.Classes.Music {
buffer.Position = newPos;
}
}
int blockSize = 2048;
int blockSize = 1920 * NadekoBot.client.GetService<AudioService>()?.Config?.Channels ?? 3840;
var buf = new byte[blockSize];
int read = 0;
read = await p.StandardOutput.BaseStream.ReadAsync(buf, 0, blockSize);
@ -264,7 +264,7 @@ namespace NadekoBot.Classes.Music {
Console.WriteLine("Nothing was buffered, try another song and check your GoogleApikey.");
}
int blockSize = 1920 * NadekoBot.client.GetService<AudioService>().Config.Channels;
int blockSize = 1920 * NadekoBot.client.GetService<AudioService>()?.Config?.Channels ?? 3840;
byte[] voiceBuffer = new byte[blockSize];
if (parent.OnStarted != null)
@ -354,15 +354,19 @@ namespace NadekoBot.Classes.Music {
}
public override int Read(byte[] buffer, int offset, int count) {
lock (this) {
Position = readPos;
int read = base.Read(buffer, offset, count);
readPos = Position;
return read;
}
}
public override void Write(byte[] buffer, int offset, int count) {
lock (this) {
Position = writePos;
base.Write(buffer, offset, count);
writePos = Position;
}
}
}
}