Make audio sliders use gain not volume (#21984)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -119,7 +119,7 @@ public sealed class BackgroundAudioSystem : EntitySystem
|
||||
}
|
||||
|
||||
_lobbyStream = _audio.PlayGlobal(file, Filter.Local(), false,
|
||||
_lobbyParams.WithVolume(_lobbyParams.Volume + _configManager.GetCVar(CCVars.LobbyMusicVolume)))?.Entity;
|
||||
_lobbyParams.WithVolume(_lobbyParams.Volume + SharedAudioSystem.GainToVolume(_configManager.GetCVar(CCVars.LobbyMusicVolume))))?.Entity;
|
||||
}
|
||||
|
||||
private void EndLobbyMusic()
|
||||
|
||||
@@ -75,7 +75,7 @@ public sealed partial class ContentAudioSystem
|
||||
|
||||
private void AmbienceCVarChanged(float obj)
|
||||
{
|
||||
_volumeSlider = obj;
|
||||
_volumeSlider = SharedAudioSystem.GainToVolume(obj);
|
||||
|
||||
if (_ambientMusicStream != null && _musicProto != null)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Audio;
|
||||
using AudioComponent = Robust.Shared.Audio.Components.AudioComponent;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user