diff --git a/Content.Client/Audio/BackgroundAudioSystem.cs b/Content.Client/Audio/BackgroundAudioSystem.cs index 27b2dcb1b7..9c4bf3f266 100644 --- a/Content.Client/Audio/BackgroundAudioSystem.cs +++ b/Content.Client/Audio/BackgroundAudioSystem.cs @@ -26,7 +26,8 @@ public sealed class BackgroundAudioSystem : EntitySystem private readonly AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f); - public EntityUid? LobbyStream; + public EntityUid? LobbyMusicStream; + public EntityUid? LobbyRoundRestartAudioStream; public override void Initialize() { @@ -115,7 +116,7 @@ public sealed class BackgroundAudioSystem : EntitySystem public void StartLobbyMusic() { - if (LobbyStream != null || !_configManager.GetCVar(CCVars.LobbyMusicEnabled)) + if (LobbyMusicStream != null || !_configManager.GetCVar(CCVars.LobbyMusicEnabled)) return; var file = _gameTicker.LobbySong; @@ -124,13 +125,16 @@ public sealed class BackgroundAudioSystem : EntitySystem return; } - LobbyStream = _audio.PlayGlobal(file, Filter.Local(), false, + LobbyMusicStream = _audio.PlayGlobal( + file, + Filter.Local(), + false, _lobbyParams.WithVolume(_lobbyParams.Volume + SharedAudioSystem.GainToVolume(_configManager.GetCVar(CCVars.LobbyMusicVolume))))?.Entity; } private void EndLobbyMusic() { - LobbyStream = _audio.Stop(LobbyStream); + LobbyMusicStream = _audio.Stop(LobbyMusicStream); } private void PlayRestartSound(RoundRestartCleanupEvent ev) @@ -144,10 +148,11 @@ public sealed class BackgroundAudioSystem : EntitySystem return; } - var volume = _lobbyParams.WithVolume(_lobbyParams.Volume + - SharedAudioSystem.GainToVolume( - _configManager.GetCVar(CCVars.LobbyMusicVolume))); - - _audio.PlayGlobal(file, Filter.Local(), false, volume); + LobbyRoundRestartAudioStream = _audio.PlayGlobal( + file, + Filter.Local(), + false, + _lobbyParams.WithVolume(_lobbyParams.Volume + SharedAudioSystem.GainToVolume(_configManager.GetCVar(CCVars.LobbyMusicVolume))) + )?.Entity; } } diff --git a/Content.Client/Audio/ContentAudioSystem.cs b/Content.Client/Audio/ContentAudioSystem.cs index ae881766ed..c81e0a44f1 100644 --- a/Content.Client/Audio/ContentAudioSystem.cs +++ b/Content.Client/Audio/ContentAudioSystem.cs @@ -50,15 +50,24 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem _fadingOut.Clear(); // Preserve lobby music but everything else should get dumped. - var lobbyStream = EntityManager.System().LobbyStream; - TryComp(lobbyStream, out AudioComponent? audioComp); - var oldGain = audioComp?.Gain; + var lobbyMusic = EntityManager.System().LobbyMusicStream; + TryComp(lobbyMusic, out AudioComponent? lobbyMusicComp); + var oldMusicGain = lobbyMusicComp?.Gain; + + var restartAudio = EntityManager.System().LobbyRoundRestartAudioStream; + TryComp(restartAudio, out AudioComponent? restartComp); + var oldAudioGain = restartComp?.Gain; SilenceAudio(); - if (oldGain != null) + if (oldMusicGain != null) { - Audio.SetGain(lobbyStream, oldGain.Value, audioComp); + Audio.SetGain(lobbyMusic, oldMusicGain.Value, lobbyMusicComp); + } + + if (oldAudioGain != null) + { + Audio.SetGain(restartAudio, oldAudioGain.Value, restartComp); } } diff --git a/Content.Client/GameTicking/Managers/ClientGameTicker.cs b/Content.Client/GameTicking/Managers/ClientGameTicker.cs index a33a7a8e72..1154dca350 100644 --- a/Content.Client/GameTicking/Managers/ClientGameTicker.cs +++ b/Content.Client/GameTicking/Managers/ClientGameTicker.cs @@ -20,8 +20,6 @@ namespace Content.Client.GameTicking.Managers { [Dependency] private readonly IStateManager _stateManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly IConfigurationManager _configManager = default!; - [Dependency] private readonly SharedAudioSystem _audio = default!; [ViewVariables] private bool _initialized; private Dictionary> _jobsAvailable = new(); diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index c3e33f90ee..6f0463aaf8 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -525,9 +525,6 @@ namespace Content.Server.GameTicking { _playerGameStatuses[session.UserId] = LobbyEnabled ? PlayerGameStatus.NotReadyToPlay : PlayerGameStatus.ReadyToPlay; } - - // Put a bangin' donk on it. - _audio.PlayGlobal(_audio.GetSound(new SoundCollectionSpecifier("RoundEnd")), Filter.Broadcast(), true); } public bool DelayStart(TimeSpan time)