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:
@@ -39,7 +39,7 @@ namespace OpenRA.Primitives
|
||||
public sealed override bool CanRead { get { return true; } }
|
||||
public sealed override bool CanWrite { get { return false; } }
|
||||
|
||||
public sealed override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public sealed override long Position
|
||||
{
|
||||
get { throw new NotSupportedException(); }
|
||||
|
||||
Reference in New Issue
Block a user