Support 8 bit .aud files.

This commit is contained in:
Matthias Mailänder
2020-12-14 20:30:09 +01:00
committed by Paul Chote
parent d38fe542a2
commit 9a9f58d744
2 changed files with 6 additions and 11 deletions

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Cnc.FileFormats
return (float)samples / sampleRate;
}
public static bool LoadSound(Stream s, out Func<Stream> result, out int sampleRate)
public static bool LoadSound(Stream s, out Func<Stream> result, out int sampleRate, out int sampleBits)
{
result = null;
var startPosition = s.Position;
@@ -58,10 +58,8 @@ namespace OpenRA.Mods.Cnc.FileFormats
sampleRate = s.ReadUInt16();
var dataSize = s.ReadInt32();
var outputSize = s.ReadInt32();
var readFlag = s.ReadByte();
if (!Enum.IsDefined(typeof(SoundFlags), readFlag))
return false;
sampleBits = (readFlag & (int)SoundFlags._16Bit) == 0 ? 8 : 16;
var readFormat = s.ReadByte();
if (!Enum.IsDefined(typeof(SoundFormat), readFormat))