music bs
This commit is contained in:
parent
7c12169d9c
commit
7874cb1728
@ -205,7 +205,7 @@ namespace NadekoBot.Classes.Music {
|
|||||||
buffer.Position = newPos;
|
buffer.Position = newPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int blockSize = 2048;
|
int blockSize = 1920 * NadekoBot.client.GetService<AudioService>()?.Config?.Channels ?? 3840;
|
||||||
var buf = new byte[blockSize];
|
var buf = new byte[blockSize];
|
||||||
int read = 0;
|
int read = 0;
|
||||||
read = await p.StandardOutput.BaseStream.ReadAsync(buf, 0, blockSize);
|
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.");
|
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];
|
byte[] voiceBuffer = new byte[blockSize];
|
||||||
|
|
||||||
if (parent.OnStarted != null)
|
if (parent.OnStarted != null)
|
||||||
@ -354,15 +354,19 @@ namespace NadekoBot.Classes.Music {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override int Read(byte[] buffer, int offset, int count) {
|
public override int Read(byte[] buffer, int offset, int count) {
|
||||||
Position = readPos;
|
lock (this) {
|
||||||
int read = base.Read(buffer, offset, count);
|
Position = readPos;
|
||||||
readPos = Position;
|
int read = base.Read(buffer, offset, count);
|
||||||
return read;
|
readPos = Position;
|
||||||
|
return read;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void Write(byte[] buffer, int offset, int count) {
|
public override void Write(byte[] buffer, int offset, int count) {
|
||||||
Position = writePos;
|
lock (this) {
|
||||||
base.Write(buffer, offset, count);
|
Position = writePos;
|
||||||
writePos = Position;
|
base.Write(buffer, offset, count);
|
||||||
|
writePos = Position;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user