Add VolumeModifier support to music.
This commit is contained in:
committed by
Oliver Brakmann
parent
810aa744bf
commit
b71c080285
@@ -19,6 +19,7 @@ namespace OpenRA.GameRules
|
||||
public readonly string Filename;
|
||||
public readonly string Title;
|
||||
public readonly bool Hidden;
|
||||
public readonly float VolumeModifier = 1f;
|
||||
|
||||
public int Length { get; private set; } // seconds
|
||||
public bool Exists { get; private set; }
|
||||
@@ -31,6 +32,9 @@ namespace OpenRA.GameRules
|
||||
if (nd.ContainsKey("Hidden"))
|
||||
bool.TryParse(nd["Hidden"].Value, out Hidden);
|
||||
|
||||
if (nd.ContainsKey("VolumeModifier"))
|
||||
VolumeModifier = FieldLoader.GetValue<float>("VolumeModifier", nd["VolumeModifier"].Value);
|
||||
|
||||
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
|
||||
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace OpenRA
|
||||
|
||||
Func<ISoundFormat, ISound> stream = soundFormat => soundEngine.Play2DStream(
|
||||
soundFormat.GetPCMInputStream(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate,
|
||||
false, true, WPos.Zero, MusicVolume);
|
||||
false, true, WPos.Zero, MusicVolume * m.VolumeModifier);
|
||||
music = LoadSound(m.Filename, stream);
|
||||
|
||||
if (music == null)
|
||||
|
||||
Reference in New Issue
Block a user