Make audio sliders use gain not volume (#21984)

This commit is contained in:
metalgearsloth
2023-12-09 14:03:08 +11:00
committed by GitHub
parent bd79fff15f
commit 98d5f9f56b
6 changed files with 37 additions and 49 deletions

View File

@@ -101,7 +101,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
_cfg.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true);
_cfg.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, true);
_cfg.OnValueChanged(CCVars.AmbientRange, SetAmbientRange, true);
_cfg.OnValueChanged(CCVars.AmbienceVolume, SetAmbienceVolume, true);
_cfg.OnValueChanged(CCVars.AmbienceVolume, SetAmbienceGain, true);
SubscribeLocalEvent<AmbientSoundComponent, ComponentShutdown>(OnShutdown);
}
@@ -116,9 +116,9 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
_playingCount.Remove(sound.Path);
}
private void SetAmbienceVolume(float value)
private void SetAmbienceGain(float value)
{
_ambienceVolume = value;
_ambienceVolume = SharedAudioSystem.GainToVolume(value);
foreach (var (comp, values) in _playingSounds)
{
@@ -141,7 +141,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
_cfg.UnsubValueChanged(CCVars.AmbientCooldown, SetCooldown);
_cfg.UnsubValueChanged(CCVars.MaxAmbientSources, SetAmbientCount);
_cfg.UnsubValueChanged(CCVars.AmbientRange, SetAmbientRange);
_cfg.UnsubValueChanged(CCVars.AmbienceVolume, SetAmbienceVolume);
_cfg.UnsubValueChanged(CCVars.AmbienceVolume, SetAmbienceGain);
}
private int PlayingCount(string countSound)