Avoid array resizing in OpenAlAsyncLoadSound.
- Where it is accessible, use the length of the stream to presize the MemoryStream to the correct size. - Instead of copying out the result via ToArray, grab the underlying buffer via GetBuffer and use that to create the sound source. This avoids extraneous copying of the array containing the audio.
This commit is contained in:
@@ -170,6 +170,11 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
this.dataSize = dataSize;
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { return outputSize; }
|
||||
}
|
||||
|
||||
protected override bool BufferData(Stream baseStream, Queue<byte> data)
|
||||
{
|
||||
if (dataSize <= 0)
|
||||
|
||||
Reference in New Issue
Block a user