Even more ambience (#7109)
* hydro tray audio * licensio * R&D server now annoys the shit out of people. * Tone down ambience a bit. * Update Resources/Audio/Ambience/Objects/license.txt Co-authored-by: ike709 <ike709@users.noreply.github.com> * begin making ambience configurable. * almost works * volume works * whee * remove the toggle button entirely, make it use volume. * fix * whobsy * a * CHEAT moment Co-authored-by: ike709 <ike709@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,7 @@ namespace Content.Client.Audio
|
|||||||
public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
||||||
{
|
{
|
||||||
[Dependency] private EntityLookupSystem _lookup = default!;
|
[Dependency] private EntityLookupSystem _lookup = default!;
|
||||||
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
@@ -33,25 +34,28 @@ namespace Content.Client.Audio
|
|||||||
private float _maxAmbientRange;
|
private float _maxAmbientRange;
|
||||||
private float _cooldown;
|
private float _cooldown;
|
||||||
private float _accumulator;
|
private float _accumulator;
|
||||||
|
private float _ambienceVolume = 0.0f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many times we can be playing 1 particular sound at once.
|
/// How many times we can be playing 1 particular sound at once.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _maxSingleSound = 8;
|
private int MaxSingleSound => (int) (_maxAmbientCount / (16.0f / 6.0f));
|
||||||
|
|
||||||
private Dictionary<AmbientSoundComponent, (IPlayingAudioStream? Stream, string Sound)> _playingSounds = new();
|
private Dictionary<AmbientSoundComponent, (IPlayingAudioStream? Stream, string Sound)> _playingSounds = new();
|
||||||
|
|
||||||
private const float RangeBuffer = 3f;
|
private const float RangeBuffer = 3f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
UpdatesOutsidePrediction = true;
|
UpdatesOutsidePrediction = true;
|
||||||
var configManager = IoCManager.Resolve<IConfigurationManager>();
|
|
||||||
configManager.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true);
|
|
||||||
configManager.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, true);
|
|
||||||
configManager.OnValueChanged(CCVars.AmbientRange, SetAmbientRange, true);
|
|
||||||
|
|
||||||
|
_cfg.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true);
|
||||||
|
_cfg.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, true);
|
||||||
|
_cfg.OnValueChanged(CCVars.AmbientRange, SetAmbientRange, true);
|
||||||
|
_cfg.OnValueChanged(CCVars.AmbienceVolume, SetAmbienceVolume, true);
|
||||||
SubscribeLocalEvent<AmbientSoundComponent, ComponentShutdown>(OnShutdown);
|
SubscribeLocalEvent<AmbientSoundComponent, ComponentShutdown>(OnShutdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +65,7 @@ namespace Content.Client.Audio
|
|||||||
sound.Stream?.Stop();
|
sound.Stream?.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetAmbienceVolume(float value) => _ambienceVolume = value;
|
||||||
private void SetCooldown(float value) => _cooldown = value;
|
private void SetCooldown(float value) => _cooldown = value;
|
||||||
private void SetAmbientCount(int value) => _maxAmbientCount = value;
|
private void SetAmbientCount(int value) => _maxAmbientCount = value;
|
||||||
private void SetAmbientRange(float value) => _maxAmbientRange = value;
|
private void SetAmbientRange(float value) => _maxAmbientRange = value;
|
||||||
@@ -69,10 +74,11 @@ namespace Content.Client.Audio
|
|||||||
{
|
{
|
||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
ClearSounds();
|
ClearSounds();
|
||||||
var configManager = IoCManager.Resolve<IConfigurationManager>();
|
|
||||||
configManager.UnsubValueChanged(CCVars.AmbientCooldown, SetCooldown);
|
_cfg.UnsubValueChanged(CCVars.AmbientCooldown, SetCooldown);
|
||||||
configManager.UnsubValueChanged(CCVars.MaxAmbientSources, SetAmbientCount);
|
_cfg.UnsubValueChanged(CCVars.MaxAmbientSources, SetAmbientCount);
|
||||||
configManager.UnsubValueChanged(CCVars.AmbientRange, SetAmbientRange);
|
_cfg.UnsubValueChanged(CCVars.AmbientRange, SetAmbientRange);
|
||||||
|
_cfg.UnsubValueChanged(CCVars.AmbienceVolume, SetAmbienceVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int PlayingCount(string countSound)
|
private int PlayingCount(string countSound)
|
||||||
@@ -143,7 +149,7 @@ namespace Content.Client.Audio
|
|||||||
var key = ambientComp.Sound.GetSound();
|
var key = ambientComp.Sound.GetSound();
|
||||||
|
|
||||||
if (!sourceDict.ContainsKey(key))
|
if (!sourceDict.ContainsKey(key))
|
||||||
sourceDict[key] = new List<AmbientSoundComponent>(_maxSingleSound);
|
sourceDict[key] = new List<AmbientSoundComponent>(MaxSingleSound);
|
||||||
|
|
||||||
sourceDict[key].Add(ambientComp);
|
sourceDict[key].Add(ambientComp);
|
||||||
}
|
}
|
||||||
@@ -151,7 +157,7 @@ namespace Content.Client.Audio
|
|||||||
foreach (var (key, val) in sourceDict)
|
foreach (var (key, val) in sourceDict)
|
||||||
{
|
{
|
||||||
sourceDict[key] = val.OrderByDescending(x =>
|
sourceDict[key] = val.OrderByDescending(x =>
|
||||||
Transform(x.Owner).Coordinates.TryDistance(EntityManager, coordinates, out var dist) ? dist : float.MaxValue).ToList();
|
Transform(x.Owner).Coordinates.TryDistance(EntityManager, coordinates, out var dist) ? dist * (x.Volume + 32) : float.MaxValue).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return sourceDict;
|
return sourceDict;
|
||||||
@@ -198,7 +204,7 @@ namespace Content.Client.Audio
|
|||||||
|
|
||||||
var sound = comp.Sound.GetSound();
|
var sound = comp.Sound.GetSound();
|
||||||
|
|
||||||
if (PlayingCount(sound) >= _maxSingleSound)
|
if (PlayingCount(sound) >= MaxSingleSound)
|
||||||
{
|
{
|
||||||
keys.Remove(key);
|
keys.Remove(key);
|
||||||
/*foreach (var toRemove in compsInRange[key])
|
/*foreach (var toRemove in compsInRange[key])
|
||||||
@@ -212,7 +218,7 @@ namespace Content.Client.Audio
|
|||||||
|
|
||||||
var audioParams = AudioHelpers
|
var audioParams = AudioHelpers
|
||||||
.WithVariation(0.01f)
|
.WithVariation(0.01f)
|
||||||
.WithVolume(comp.Volume)
|
.WithVolume(comp.Volume + _ambienceVolume)
|
||||||
.WithLoop(true)
|
.WithLoop(true)
|
||||||
.WithAttenuation(Attenuation.LinearDistance)
|
.WithAttenuation(Attenuation.LinearDistance)
|
||||||
// Randomise start so 2 sources don't increase their volume.
|
// Randomise start so 2 sources don't increase their volume.
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ namespace Content.Client.Audio
|
|||||||
|
|
||||||
private SoundCollectionPrototype _ambientCollection = default!;
|
private SoundCollectionPrototype _ambientCollection = default!;
|
||||||
|
|
||||||
private AudioParams _ambientParams = new(-10f, 1, "Master", 0, 0, 0, true, 0f);
|
private readonly AudioParams _ambientParams = new(-10f, 1, "Master", 0, 0, 0, true, 0f);
|
||||||
private AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f);
|
private readonly AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f);
|
||||||
|
|
||||||
private IPlayingAudioStream? _ambientStream;
|
private IPlayingAudioStream? _ambientStream;
|
||||||
private IPlayingAudioStream? _lobbyStream;
|
private IPlayingAudioStream? _lobbyStream;
|
||||||
@@ -41,7 +41,7 @@ namespace Content.Client.Audio
|
|||||||
|
|
||||||
_ambientCollection = _prototypeManager.Index<SoundCollectionPrototype>("AmbienceBase");
|
_ambientCollection = _prototypeManager.Index<SoundCollectionPrototype>("AmbienceBase");
|
||||||
|
|
||||||
_configManager.OnValueChanged(CCVars.AmbienceBasicEnabled, AmbienceCVarChanged);
|
_configManager.OnValueChanged(CCVars.AmbienceVolume, AmbienceCVarChanged);
|
||||||
_configManager.OnValueChanged(CCVars.LobbyMusicEnabled, LobbyMusicCVarChanged);
|
_configManager.OnValueChanged(CCVars.LobbyMusicEnabled, LobbyMusicCVarChanged);
|
||||||
|
|
||||||
_stateManager.OnStateChanged += StateManagerOnStateChanged;
|
_stateManager.OnStateChanged += StateManagerOnStateChanged;
|
||||||
@@ -75,7 +75,7 @@ namespace Content.Client.Audio
|
|||||||
{
|
{
|
||||||
StartLobbyMusic();
|
StartLobbyMusic();
|
||||||
}
|
}
|
||||||
else if (args.NewState is GameScreen && _configManager.GetCVar(CCVars.AmbienceBasicEnabled))
|
else if (args.NewState is GameScreen)
|
||||||
{
|
{
|
||||||
StartAmbience();
|
StartAmbience();
|
||||||
}
|
}
|
||||||
@@ -94,10 +94,7 @@ namespace Content.Client.Audio
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
EndLobbyMusic();
|
EndLobbyMusic();
|
||||||
if (_configManager.GetCVar(CCVars.AmbienceBasicEnabled))
|
StartAmbience();
|
||||||
{
|
|
||||||
StartAmbience();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,13 +104,9 @@ namespace Content.Client.Audio
|
|||||||
EndLobbyMusic();
|
EndLobbyMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AmbienceCVarChanged(bool ambienceEnabled)
|
private void AmbienceCVarChanged(float volume)
|
||||||
{
|
{
|
||||||
if (!ambienceEnabled)
|
if (_stateManager.CurrentState is GameScreen)
|
||||||
{
|
|
||||||
EndAmbience();
|
|
||||||
}
|
|
||||||
else if (_stateManager.CurrentState is GameScreen)
|
|
||||||
{
|
{
|
||||||
StartAmbience();
|
StartAmbience();
|
||||||
}
|
}
|
||||||
@@ -127,7 +120,7 @@ namespace Content.Client.Audio
|
|||||||
{
|
{
|
||||||
EndAmbience();
|
EndAmbience();
|
||||||
var file = _robustRandom.Pick(_ambientCollection.PickFiles).ToString();
|
var file = _robustRandom.Pick(_ambientCollection.PickFiles).ToString();
|
||||||
_ambientStream = SoundSystem.Play(Filter.Local(), file, _ambientParams);
|
_ambientStream = SoundSystem.Play(Filter.Local(), file, _ambientParams.WithVolume(_ambientParams.Volume + _configManager.GetCVar(CCVars.AmbienceVolume)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EndAmbience()
|
private void EndAmbience()
|
||||||
|
|||||||
@@ -35,8 +35,33 @@
|
|||||||
<Label Name="MidiVolumeLabel" MinSize="48 0" Align="Right" />
|
<Label Name="MidiVolumeLabel" MinSize="48 0" Align="Right" />
|
||||||
<Control MinSize="4 0"/>
|
<Control MinSize="4 0"/>
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
|
<BoxContainer Orientation="Horizontal" Margin="5 0 0 0">
|
||||||
|
<Label Text="{Loc 'ui-options-ambience-volume'}" />
|
||||||
|
<Control MinSize="8 0" />
|
||||||
|
<Slider Name="AmbienceVolumeSlider"
|
||||||
|
MinValue="0"
|
||||||
|
MaxValue="300"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
MinSize="80 0"
|
||||||
|
Rounded="True" />
|
||||||
|
<Control MinSize="8 0" />
|
||||||
|
<Label Name="AmbienceVolumeLabel" MinSize="48 0" Align="Right" />
|
||||||
|
<Control MinSize="4 0"/>
|
||||||
|
</BoxContainer>
|
||||||
|
<BoxContainer Orientation="Horizontal" Margin="5 0 0 0">
|
||||||
|
<Label Text="{Loc 'ui-options-ambience-max-sounds'}" />
|
||||||
|
<Control MinSize="8 0" />
|
||||||
|
<Slider Name="AmbienceSoundsSlider"
|
||||||
|
MinValue="0"
|
||||||
|
MaxValue="1"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
MinSize="80 0"
|
||||||
|
Rounded="True" />
|
||||||
|
<Control MinSize="8 0" />
|
||||||
|
<Label Name="AmbienceSoundsLabel" MinSize="48 0" Align="Right" />
|
||||||
|
<Control MinSize="4 0"/>
|
||||||
|
</BoxContainer>
|
||||||
<Control MinSize="0 8" />
|
<Control MinSize="0 8" />
|
||||||
<CheckBox Name="AmbienceCheckBox" Text="{Loc 'ui-options-ambient-hum'}" />
|
|
||||||
<CheckBox Name="LobbyMusicCheckBox" Text="{Loc 'ui-options-lobby-music'}" />
|
<CheckBox Name="LobbyMusicCheckBox" Text="{Loc 'ui-options-lobby-music'}" />
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
using System;
|
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Robust.Client.Audio.Midi;
|
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared;
|
using Robust.Shared;
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.IoC;
|
using Range = Robust.Client.UserInterface.Controls.Range;
|
||||||
using Robust.Shared.Localization;
|
|
||||||
|
|
||||||
namespace Content.Client.EscapeMenu.UI.Tabs
|
namespace Content.Client.EscapeMenu.UI.Tabs
|
||||||
{
|
{
|
||||||
@@ -25,16 +21,19 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
AmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.AmbienceBasicEnabled);
|
|
||||||
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
||||||
|
|
||||||
ApplyButton.OnPressed += OnApplyButtonPressed;
|
ApplyButton.OnPressed += OnApplyButtonPressed;
|
||||||
ResetButton.OnPressed += OnResetButtonPressed;
|
ResetButton.OnPressed += OnResetButtonPressed;
|
||||||
MasterVolumeSlider.OnValueChanged += OnMasterVolumeSliderChanged;
|
MasterVolumeSlider.OnValueChanged += OnMasterVolumeSliderChanged;
|
||||||
MidiVolumeSlider.OnValueChanged += OnMidiVolumeSliderChanged;
|
MidiVolumeSlider.OnValueChanged += OnMidiVolumeSliderChanged;
|
||||||
AmbienceCheckBox.OnToggled += OnAmbienceCheckToggled;
|
AmbienceVolumeSlider.OnValueChanged += OnAmbienceVolumeSliderChanged;
|
||||||
|
AmbienceSoundsSlider.OnValueChanged += OnAmbienceSoundsSliderChanged;
|
||||||
LobbyMusicCheckBox.OnToggled += OnLobbyMusicCheckToggled;
|
LobbyMusicCheckBox.OnToggled += OnLobbyMusicCheckToggled;
|
||||||
|
|
||||||
|
AmbienceSoundsSlider.MinValue = _cfg.GetCVar(CCVars.MinMaxAmbientSourcesConfigured);
|
||||||
|
AmbienceSoundsSlider.MaxValue = _cfg.GetCVar(CCVars.MaxMaxAmbientSourcesConfigured);
|
||||||
|
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,22 +43,27 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
ResetButton.OnPressed -= OnResetButtonPressed;
|
ResetButton.OnPressed -= OnResetButtonPressed;
|
||||||
MasterVolumeSlider.OnValueChanged -= OnMasterVolumeSliderChanged;
|
MasterVolumeSlider.OnValueChanged -= OnMasterVolumeSliderChanged;
|
||||||
MidiVolumeSlider.OnValueChanged -= OnMidiVolumeSliderChanged;
|
MidiVolumeSlider.OnValueChanged -= OnMidiVolumeSliderChanged;
|
||||||
AmbienceCheckBox.OnToggled -= OnAmbienceCheckToggled;
|
AmbienceVolumeSlider.OnValueChanged -= OnAmbienceVolumeSliderChanged;
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMasterVolumeSliderChanged(Robust.Client.UserInterface.Controls.Range range)
|
private void OnAmbienceVolumeSliderChanged(Range obj)
|
||||||
|
{
|
||||||
|
UpdateChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAmbienceSoundsSliderChanged(Range obj)
|
||||||
|
{
|
||||||
|
UpdateChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMasterVolumeSliderChanged(Range range)
|
||||||
{
|
{
|
||||||
_clydeAudio.SetMasterVolume(MasterVolumeSlider.Value / 100);
|
_clydeAudio.SetMasterVolume(MasterVolumeSlider.Value / 100);
|
||||||
UpdateChanges();
|
UpdateChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMidiVolumeSliderChanged(Robust.Client.UserInterface.Controls.Range range)
|
private void OnMidiVolumeSliderChanged(Range range)
|
||||||
{
|
|
||||||
UpdateChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnAmbienceCheckToggled(BaseButton.ButtonEventArgs args)
|
|
||||||
{
|
{
|
||||||
UpdateChanges();
|
UpdateChanges();
|
||||||
}
|
}
|
||||||
@@ -73,7 +77,8 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
{
|
{
|
||||||
_cfg.SetCVar(CVars.AudioMasterVolume, MasterVolumeSlider.Value / 100);
|
_cfg.SetCVar(CVars.AudioMasterVolume, MasterVolumeSlider.Value / 100);
|
||||||
_cfg.SetCVar(CVars.MidiVolume, LV100ToDB(MidiVolumeSlider.Value));
|
_cfg.SetCVar(CVars.MidiVolume, LV100ToDB(MidiVolumeSlider.Value));
|
||||||
_cfg.SetCVar(CCVars.AmbienceBasicEnabled, AmbienceCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.AmbienceVolume, LV100ToDB(AmbienceVolumeSlider.Value));
|
||||||
|
_cfg.SetCVar(CCVars.MaxAmbientSources, (int)AmbienceSoundsSlider.Value);
|
||||||
_cfg.SetCVar(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox.Pressed);
|
||||||
_cfg.SaveToFile();
|
_cfg.SaveToFile();
|
||||||
UpdateChanges();
|
UpdateChanges();
|
||||||
@@ -88,7 +93,8 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
{
|
{
|
||||||
MasterVolumeSlider.Value = _cfg.GetCVar(CVars.AudioMasterVolume) * 100;
|
MasterVolumeSlider.Value = _cfg.GetCVar(CVars.AudioMasterVolume) * 100;
|
||||||
MidiVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CVars.MidiVolume));
|
MidiVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CVars.MidiVolume));
|
||||||
AmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.AmbienceBasicEnabled);
|
AmbienceVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume));
|
||||||
|
AmbienceSoundsSlider.Value = _cfg.GetCVar(CCVars.MaxAmbientSources);
|
||||||
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
||||||
UpdateChanges();
|
UpdateChanges();
|
||||||
}
|
}
|
||||||
@@ -109,18 +115,23 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
private void UpdateChanges()
|
private void UpdateChanges()
|
||||||
{
|
{
|
||||||
var isMasterVolumeSame =
|
var isMasterVolumeSame =
|
||||||
System.Math.Abs(MasterVolumeSlider.Value - _cfg.GetCVar(CVars.AudioMasterVolume) * 100) < 0.01f;
|
Math.Abs(MasterVolumeSlider.Value - _cfg.GetCVar(CVars.AudioMasterVolume) * 100) < 0.01f;
|
||||||
var isMidiVolumeSame =
|
var isMidiVolumeSame =
|
||||||
System.Math.Abs(MidiVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CVars.MidiVolume))) < 0.01f;
|
Math.Abs(MidiVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CVars.MidiVolume))) < 0.01f;
|
||||||
var isAmbienceSame = AmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.AmbienceBasicEnabled);
|
var isAmbientVolumeSame =
|
||||||
|
Math.Abs(AmbienceVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume))) < 0.01f;
|
||||||
|
var isAmbientSoundsSame = (int)AmbienceSoundsSlider.Value == _cfg.GetCVar(CCVars.MaxAmbientSources);
|
||||||
var isLobbySame = LobbyMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
var isLobbySame = LobbyMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
||||||
var isEverythingSame = isMasterVolumeSame && isMidiVolumeSame && isAmbienceSame && isLobbySame;
|
var isEverythingSame = isMasterVolumeSame && isMidiVolumeSame && isAmbientVolumeSame && isAmbientSoundsSame && isLobbySame;
|
||||||
ApplyButton.Disabled = isEverythingSame;
|
ApplyButton.Disabled = isEverythingSame;
|
||||||
ResetButton.Disabled = isEverythingSame;
|
ResetButton.Disabled = isEverythingSame;
|
||||||
MasterVolumeLabel.Text =
|
MasterVolumeLabel.Text =
|
||||||
Loc.GetString("ui-options-volume-percent", ("volume", MasterVolumeSlider.Value / 100));
|
Loc.GetString("ui-options-volume-percent", ("volume", MasterVolumeSlider.Value / 100));
|
||||||
MidiVolumeLabel.Text =
|
MidiVolumeLabel.Text =
|
||||||
Loc.GetString("ui-options-volume-percent", ("volume", MidiVolumeSlider.Value / 100));
|
Loc.GetString("ui-options-volume-percent", ("volume", MidiVolumeSlider.Value / 100));
|
||||||
|
AmbienceVolumeLabel.Text =
|
||||||
|
Loc.GetString("ui-options-volume-percent", ("volume", AmbienceVolumeSlider.Value / 100));
|
||||||
|
AmbienceSoundsLabel.Text = ((int)AmbienceSoundsSlider.Value).ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,23 +22,40 @@ namespace Content.Shared.CCVar
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the basic 'hum' ambience will be enabled.
|
/// How long we'll wait until re-sampling nearby objects for ambience. Should be pretty fast, but doesn't have to match the tick rate.
|
||||||
/// </summary>
|
|
||||||
public static readonly CVarDef<bool> AmbienceBasicEnabled =
|
|
||||||
CVarDef.Create("ambience.basic_enabled", true, CVar.ARCHIVE | CVar.CLIENTONLY);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How long we'll wait until re-sampling nearby objects for ambience.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly CVarDef<float> AmbientCooldown =
|
public static readonly CVarDef<float> AmbientCooldown =
|
||||||
CVarDef.Create("ambience.cooldown", 0.1f, CVar.REPLICATED | CVar.SERVER);
|
CVarDef.Create("ambience.cooldown", 0.1f, CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How large of a range to sample for ambience.
|
||||||
|
/// </summary>
|
||||||
public static readonly CVarDef<float> AmbientRange =
|
public static readonly CVarDef<float> AmbientRange =
|
||||||
CVarDef.Create("ambience.range", 5f, CVar.REPLICATED | CVar.SERVER);
|
CVarDef.Create("ambience.range", 5f, CVar.REPLICATED | CVar.SERVER);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum simultaneous ambient sounds.
|
||||||
|
/// </summary>
|
||||||
public static readonly CVarDef<int> MaxAmbientSources =
|
public static readonly CVarDef<int> MaxAmbientSources =
|
||||||
CVarDef.Create("ambience.max_sounds", 64, CVar.REPLICATED | CVar.SERVER);
|
CVarDef.Create("ambience.max_sounds", 16, CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum value the user can set for ambience.max_sounds
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<int> MinMaxAmbientSourcesConfigured =
|
||||||
|
CVarDef.Create("ambience.min_max_sounds_configured", 16, CVar.REPLICATED | CVar.SERVER | CVar.CHEAT);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum value the user can set for ambience.max_sounds
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<int> MaxMaxAmbientSourcesConfigured =
|
||||||
|
CVarDef.Create("ambience.max_max_sounds_configured", 64, CVar.REPLICATED | CVar.SERVER | CVar.CHEAT);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ambience volume.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<float> AmbienceVolume =
|
||||||
|
CVarDef.Create("ambience.volume", 0.0f, CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||||
/*
|
/*
|
||||||
* Status
|
* Status
|
||||||
*/
|
*/
|
||||||
|
|||||||
BIN
Resources/Audio/Ambience/Objects/flowing_water_open.ogg
Normal file
BIN
Resources/Audio/Ambience/Objects/flowing_water_open.ogg
Normal file
Binary file not shown.
@@ -1,4 +1,6 @@
|
|||||||
circular_saw.ogg - https://freesound.org/people/derjuli/sounds/448133/ and clipped - CC0-1.0
|
circular_saw.ogg - https://freesound.org/people/derjuli/sounds/448133/ and clipped - CC0-1.0
|
||||||
gas_pump - https://freesound.org/people/karinalarasart/sounds/441419/ - CC0-1.0
|
gas_pump - https://freesound.org/people/karinalarasart/sounds/441419/ - CC0-1.0
|
||||||
gas_hiss - https://freesound.org/people/geodylabs/sounds/122803/ - CC BY 3.0
|
gas_hiss - https://freesound.org/people/geodylabs/sounds/122803/ - CC-BY-3.0
|
||||||
gas_vent - https://freesound.org/people/kyles/sounds/453642/ - CC0-1.0
|
gas_vent - https://freesound.org/people/kyles/sounds/453642/ - CC0-1.0
|
||||||
|
flowing_water_open - https://freesound.org/people/sterferny/sounds/382322/ - CC0-1.0
|
||||||
|
server_fans - https://freesound.org/people/DeVern/sounds/610761/ - CC-BY-3.0
|
||||||
|
|||||||
BIN
Resources/Audio/Ambience/Objects/server_fans.ogg
Normal file
BIN
Resources/Audio/Ambience/Objects/server_fans.ogg
Normal file
Binary file not shown.
@@ -13,7 +13,8 @@ ui-options-reset-all = Reset All
|
|||||||
|
|
||||||
ui-options-master-volume = Master Volume:
|
ui-options-master-volume = Master Volume:
|
||||||
ui-options-midi-volume = MIDI (Instrument) Volume:
|
ui-options-midi-volume = MIDI (Instrument) Volume:
|
||||||
ui-options-ambient-hum = Ambient Hum
|
ui-options-ambience-volume = Ambience volume:
|
||||||
|
ui-options-ambience-max-sounds = Ambience simultaneous sounds:
|
||||||
ui-options-lobby-music = Lobby Music
|
ui-options-lobby-music = Lobby Music
|
||||||
ui-options-volume-label = Volume
|
ui-options-volume-label = Volume
|
||||||
ui-options-volume-percent = { TOSTRING($volume, "P0") }
|
ui-options-volume-percent = { TOSTRING($volume, "P0") }
|
||||||
|
|||||||
@@ -29,7 +29,11 @@
|
|||||||
SheetSteel1:
|
SheetSteel1:
|
||||||
min: 1
|
min: 1
|
||||||
max: 2
|
max: 2
|
||||||
|
- type: AmbientSound
|
||||||
|
volume: -9
|
||||||
|
range: 5
|
||||||
|
sound:
|
||||||
|
path: /Audio/Ambience/Objects/server_fans.ogg
|
||||||
- type: entity
|
- type: entity
|
||||||
id: BaseResearchAndDevelopmentPointSource
|
id: BaseResearchAndDevelopmentPointSource
|
||||||
parent: BaseMachinePowered
|
parent: BaseMachinePowered
|
||||||
|
|||||||
@@ -39,4 +39,8 @@
|
|||||||
- type: Wires
|
- type: Wires
|
||||||
BoardName: "HydroponicsTray"
|
BoardName: "HydroponicsTray"
|
||||||
LayoutId: HydroponicsTray
|
LayoutId: HydroponicsTray
|
||||||
|
- type: AmbientSound
|
||||||
|
volume: -9
|
||||||
|
range: 5
|
||||||
|
sound:
|
||||||
|
path: /Audio/Ambience/Objects/flowing_water_open.ogg
|
||||||
|
|||||||
Reference in New Issue
Block a user