preserve aud codec state across blocks, so the gain isnt completely bogus

This commit is contained in:
Chris Forbes
2010-08-11 22:19:49 +12:00
parent ec9da154ad
commit 8dd9848636
2 changed files with 5 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ namespace OpenRA.FileFormats
return (short)current;
}
public static byte[] LoadSound(byte[] raw)
public static byte[] LoadSound(byte[] raw, ref int index)
{
var br = new BinaryReader(new MemoryStream(raw));
var dataSize = raw.Length;
@@ -84,7 +84,6 @@ namespace OpenRA.FileFormats
var output = new byte[outputSize];
var offset = 0;
var index = 0;
var currentSample = 0;
while (dataSize-- > 0)

View File

@@ -132,7 +132,7 @@ namespace OpenRA.FileFormats
// Don't parse sound (yet); skip data
{
var rawAudio = reader.ReadBytes((int)length);
audioData = AudLoader.LoadSound(rawAudio);
audioData = AudLoader.LoadSound(rawAudio, ref adpcmIndex);
}
break;
case "VQFR":
@@ -149,6 +149,8 @@ namespace OpenRA.FileFormats
currentFrame = cbOffset = cbChunk = 0;
}
int adpcmIndex = 0;
// VQA Frame
public void DecodeVQFR(BinaryReader reader)
{