diff --git a/OpenRA.Game/Sound.cs b/OpenRA.Game/Sound.cs index df52332144..2597a85582 100644 --- a/OpenRA.Game/Sound.cs +++ b/OpenRA.Game/Sound.cs @@ -54,7 +54,7 @@ namespace OpenRA return; var sound = sounds[name]; - soundEngine.Play2D(sound, false, true, float2.Zero, SoundVolume); + soundEngine.Play2D(sound, false, true, float2.Zero, InternalSoundVolume); } public static void Play(string name, float2 pos) @@ -63,7 +63,7 @@ namespace OpenRA return; var sound = sounds[name]; - soundEngine.Play2D(sound, false, false, pos, SoundVolume); + soundEngine.Play2D(sound, false, false, pos, InternalSoundVolume); } public static void PlayToPlayer(Player player, string name) @@ -81,7 +81,7 @@ namespace OpenRA public static void PlayVideo(byte[] raw) { rawSource = LoadSoundRaw(raw); - video = soundEngine.Play2D(rawSource, false, true, float2.Zero, SoundVolume); + video = soundEngine.Play2D(rawSource, false, true, float2.Zero, InternalSoundVolume); } public static void PlayVideo() @@ -171,13 +171,25 @@ namespace OpenRA set { soundEngine.Volume = value;} } + static float soundVolumeModifier = 1.0f; + public static float SoundVolumeModifier + { + get { return soundVolumeModifier; } + set + { + soundVolumeModifier = value; + soundEngine.SetSoundVolume(InternalSoundVolume, music, video); + } + } + + static float InternalSoundVolume { get { return SoundVolume*soundVolumeModifier; } } public static float SoundVolume { get { return Game.Settings.Sound.SoundVolume; } set { Game.Settings.Sound.SoundVolume = value; - soundEngine.SetSoundVolume(value, music, video); + soundEngine.SetSoundVolume(InternalSoundVolume, music, video); } } diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 0bfc04eb99..10d63e41e5 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -111,7 +111,8 @@ namespace OpenRA p.Stances[q] = Stance.Neutral; PathFinder = new PathFinder(this); - + + Sound.SoundVolumeModifier = 1.0f; foreach (var wlh in WorldActor.TraitsImplementing()) wlh.WorldLoaded(this); } diff --git a/OpenRA.Mods.RA/DefaultShellmapScript.cs b/OpenRA.Mods.RA/DefaultShellmapScript.cs index 5bd8f04b9d..6cb658ec58 100644 --- a/OpenRA.Mods.RA/DefaultShellmapScript.cs +++ b/OpenRA.Mods.RA/DefaultShellmapScript.cs @@ -24,6 +24,7 @@ namespace OpenRA.Mods.RA { Game.MoveViewport((.5f * (w.Map.TopLeft + w.Map.BottomRight).ToFloat2()).ToInt2()); Actors = w.WorldActor.Trait().Actors; + Sound.SoundVolumeModifier = 0f; } int ticks = 0;