diff --git a/OpenRA.Game/Sound.cs b/OpenRA.Game/Sound.cs index a6f85a3d77..194b993cd8 100644 --- a/OpenRA.Game/Sound.cs +++ b/OpenRA.Game/Sound.cs @@ -22,6 +22,7 @@ namespace OpenRA static ISoundEngine soundEngine; static Cache sounds; static ISound music; + static ISound video; static bool paused; static bool stopped; @@ -42,6 +43,7 @@ namespace OpenRA soundEngine = new OpenAlSoundEngine(); sounds = new Cache(LoadSound); music = null; + video = null; paused = false; stopped = false; } @@ -49,10 +51,16 @@ namespace OpenRA public static void SetListenerPosition(float2 position) { soundEngine.SetListenerPosition(position); } static ISoundSource rawSource; - public static void PlayRaw(byte[] raw) + public static void PlayVideoSoundtrack(byte[] raw) { rawSource = LoadSoundRaw(raw); - soundEngine.Play2D(rawSource, false, true, float2.Zero, SoundVolume); + video = soundEngine.Play2D(rawSource, false, true, float2.Zero, SoundVolume); + } + + public static void StopVideoSoundtrack() + { + if (video != null) + soundEngine.StopSound(video); } public static void Play(string name) diff --git a/OpenRA.Game/Widgets/VqaPlayerWidget.cs b/OpenRA.Game/Widgets/VqaPlayerWidget.cs index ad370c68dd..17c3aecb79 100644 --- a/OpenRA.Game/Widgets/VqaPlayerWidget.cs +++ b/OpenRA.Game/Widgets/VqaPlayerWidget.cs @@ -68,13 +68,13 @@ namespace OpenRA.Widgets video.Reset(); videoSprite.sheet.Texture.SetData(video.FrameData); sw.Reset(); - Sound.PlayRaw(video.AudioData); + Sound.PlayVideoSoundtrack(video.AudioData); } public void Stop() { playing = false; - // TODO: Stop audio + Sound.StopVideoSoundtrack(); } } }