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:
Moony
2022-03-19 23:45:51 -05:00
committed by GitHub
parent 2657c0b131
commit 5af2f24331
11 changed files with 127 additions and 64 deletions

View File

@@ -29,8 +29,8 @@ namespace Content.Client.Audio
private SoundCollectionPrototype _ambientCollection = default!;
private 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 _ambientParams = new(-10f, 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? _lobbyStream;
@@ -41,7 +41,7 @@ namespace Content.Client.Audio
_ambientCollection = _prototypeManager.Index<SoundCollectionPrototype>("AmbienceBase");
_configManager.OnValueChanged(CCVars.AmbienceBasicEnabled, AmbienceCVarChanged);
_configManager.OnValueChanged(CCVars.AmbienceVolume, AmbienceCVarChanged);
_configManager.OnValueChanged(CCVars.LobbyMusicEnabled, LobbyMusicCVarChanged);
_stateManager.OnStateChanged += StateManagerOnStateChanged;
@@ -75,7 +75,7 @@ namespace Content.Client.Audio
{
StartLobbyMusic();
}
else if (args.NewState is GameScreen && _configManager.GetCVar(CCVars.AmbienceBasicEnabled))
else if (args.NewState is GameScreen)
{
StartAmbience();
}
@@ -94,10 +94,7 @@ namespace Content.Client.Audio
else
{
EndLobbyMusic();
if (_configManager.GetCVar(CCVars.AmbienceBasicEnabled))
{
StartAmbience();
}
StartAmbience();
}
}
@@ -107,13 +104,9 @@ namespace Content.Client.Audio
EndLobbyMusic();
}
private void AmbienceCVarChanged(bool ambienceEnabled)
private void AmbienceCVarChanged(float volume)
{
if (!ambienceEnabled)
{
EndAmbience();
}
else if (_stateManager.CurrentState is GameScreen)
if (_stateManager.CurrentState is GameScreen)
{
StartAmbience();
}
@@ -127,7 +120,7 @@ namespace Content.Client.Audio
{
EndAmbience();
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()