From a3f26cec46566057083e1832c75c6da37076c5e6 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 22 Jan 2011 17:56:38 +1300 Subject: [PATCH] Fix sound after mod switching. --- OpenRA.Game/Game.cs | 6 ++++-- OpenRA.Game/Sound.cs | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 13f40e383f..b9a679b65d 100755 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -248,6 +248,7 @@ namespace OpenRA foreach(var mod in Mod.AllMods) Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version); + Sound.Create(); InitializeWithMods(Settings.Game.Mods); } @@ -265,12 +266,13 @@ namespace OpenRA // Discard any invalid mods var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray(); Console.WriteLine("Loading mods: {0}",string.Join(",",mm)); - + + Sound.Initialize(); modData = new ModData( mm ); modData.LoadInitialAssets(); - Sound.Initialize(); + PerfHistory.items["render"].hasNormalTick = false; PerfHistory.items["batches"].hasNormalTick = false; diff --git a/OpenRA.Game/Sound.cs b/OpenRA.Game/Sound.cs index d73f2a47be..ae0af975bd 100644 --- a/OpenRA.Game/Sound.cs +++ b/OpenRA.Game/Sound.cs @@ -36,9 +36,13 @@ namespace OpenRA return soundEngine.AddSoundSourceFromMemory(rawData, 1, 16, 22050); } - public static void Initialize() + public static void Create() { soundEngine = new OpenAlSoundEngine(); + } + + public static void Initialize() + { sounds = new Cache(LoadSound); music = null; currentMusic = null;