Fix sound after mod switching.

This commit is contained in:
Paul Chote
2011-01-22 17:56:38 +13:00
parent aa319ee403
commit a3f26cec46
2 changed files with 9 additions and 3 deletions

View File

@@ -248,6 +248,7 @@ namespace OpenRA
foreach(var mod in Mod.AllMods) foreach(var mod in Mod.AllMods)
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version); Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version);
Sound.Create();
InitializeWithMods(Settings.Game.Mods); InitializeWithMods(Settings.Game.Mods);
} }
@@ -265,12 +266,13 @@ namespace OpenRA
// Discard any invalid mods // Discard any invalid mods
var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray(); var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray();
Console.WriteLine("Loading mods: {0}",string.Join(",",mm)); Console.WriteLine("Loading mods: {0}",string.Join(",",mm));
Sound.Initialize();
modData = new ModData( mm ); modData = new ModData( mm );
modData.LoadInitialAssets(); modData.LoadInitialAssets();
Sound.Initialize();
PerfHistory.items["render"].hasNormalTick = false; PerfHistory.items["render"].hasNormalTick = false;
PerfHistory.items["batches"].hasNormalTick = false; PerfHistory.items["batches"].hasNormalTick = false;

View File

@@ -36,9 +36,13 @@ namespace OpenRA
return soundEngine.AddSoundSourceFromMemory(rawData, 1, 16, 22050); return soundEngine.AddSoundSourceFromMemory(rawData, 1, 16, 22050);
} }
public static void Initialize() public static void Create()
{ {
soundEngine = new OpenAlSoundEngine(); soundEngine = new OpenAlSoundEngine();
}
public static void Initialize()
{
sounds = new Cache<string, ISoundSource>(LoadSound); sounds = new Cache<string, ISoundSource>(LoadSound);
music = null; music = null;
currentMusic = null; currentMusic = null;