Support uncompressed audio (ally1.vqa)

This commit is contained in:
Paul Chote
2010-08-12 00:37:19 +12:00
parent c600239c54
commit 6e0158039a
2 changed files with 10 additions and 6 deletions

View File

@@ -123,6 +123,7 @@ namespace OpenRA.FileFormats
var ms = new MemoryStream();
var adpcmIndex = 0;
bool compressed = false;
for (var i = 0; i < Frames; i++)
{
stream.Seek(offsets[i], SeekOrigin.Begin);
@@ -136,9 +137,11 @@ namespace OpenRA.FileFormats
switch (type)
{
case "SND0":
case "SND2":
var rawAudio = reader.ReadBytes((int)length);
ms.Write(rawAudio);
compressed = (type == "SND2");
break;
default:
reader.ReadBytes((int)length);
@@ -149,7 +152,7 @@ namespace OpenRA.FileFormats
}
}
audioData = AudLoader.LoadSound(ms.ToArray(), ref adpcmIndex);
audioData = (compressed) ? AudLoader.LoadSound(ms.ToArray(), ref adpcmIndex) : ms.ToArray();
}
public void AdvanceFrame()
@@ -175,6 +178,7 @@ namespace OpenRA.FileFormats
switch(type)
{
case "SND0":
case "SND2":
// Don't parse sound here.
reader.ReadBytes((int)length);

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Widgets.Delegates
bg.GetWidget("BUTTON_PLAY").OnMouseUp = mi =>
{
var foo = Widget.RootWidget.GetWidget<VqaPlayerWidget>("VIDEOPLAYER");
foo.Load("ally10.vqa");
foo.Load("ally1.vqa");
foo.Play();
/*
if (Sound.MusicStopped)