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

@@ -122,7 +122,8 @@ namespace OpenRA.FileFormats
{ {
var ms = new MemoryStream(); var ms = new MemoryStream();
var adpcmIndex = 0; var adpcmIndex = 0;
bool compressed = false;
for (var i = 0; i < Frames; i++) for (var i = 0; i < Frames; i++)
{ {
stream.Seek(offsets[i], SeekOrigin.Begin); stream.Seek(offsets[i], SeekOrigin.Begin);
@@ -136,9 +137,11 @@ namespace OpenRA.FileFormats
switch (type) switch (type)
{ {
case "SND2": case "SND0":
var rawAudio = reader.ReadBytes((int)length); case "SND2":
ms.Write(rawAudio); var rawAudio = reader.ReadBytes((int)length);
ms.Write(rawAudio);
compressed = (type == "SND2");
break; break;
default: default:
reader.ReadBytes((int)length); 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() public void AdvanceFrame()
@@ -175,6 +178,7 @@ namespace OpenRA.FileFormats
switch(type) switch(type)
{ {
case "SND0":
case "SND2": case "SND2":
// Don't parse sound here. // Don't parse sound here.
reader.ReadBytes((int)length); reader.ReadBytes((int)length);

View File

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