diff --git a/Content.Client/Announcements/Systems/AnnouncerSystem.cs b/Content.Client/Announcements/Systems/AnnouncerSystem.cs deleted file mode 100644 index de76396f705..00000000000 --- a/Content.Client/Announcements/Systems/AnnouncerSystem.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Content.Client.Audio; -using Content.Shared.Announcements.Events; -using Content.Shared.Announcements.Systems; -using Content.Shared.CCVar; -using Robust.Client.Audio; -using Robust.Client.Player; -using Robust.Client.ResourceManagement; -using Robust.Shared.Audio.Sources; -using Robust.Shared.Audio.Systems; -using Robust.Shared.Configuration; - -namespace Content.Client.Announcements.Systems; - -public sealed class AnnouncerSystem : SharedAnnouncerSystem -{ - [Dependency] private readonly IPlayerManager _player = default!; - [Dependency] private readonly IConfigurationManager _config = default!; - [Dependency] private readonly IResourceCache _cache = default!; - [Dependency] private readonly IAudioManager _audioManager = default!; - - private IAudioSource? AnnouncerSource { get; set; } - private float AnnouncerVolume { get; set; } - - - public override void Initialize() - { - base.Initialize(); - - AnnouncerVolume = _config.GetCVar(CCVars.AnnouncerVolume) * 100f / ContentAudioSystem.AnnouncerMultiplier; - - SubscribeNetworkEvent(OnAnnouncementReceived); - _config.OnValueChanged(CCVars.AnnouncerVolume, OnAnnouncerVolumeChanged); - } - - public override void Shutdown() - { - base.Shutdown(); - - _config.UnsubValueChanged(CCVars.AnnouncerVolume, OnAnnouncerVolumeChanged); - } - - - private void OnAnnouncerVolumeChanged(float value) - { - AnnouncerVolume = value; - - if (AnnouncerSource != null) - AnnouncerSource.Gain = AnnouncerVolume; - } - - private void OnAnnouncementReceived(AnnouncementSendEvent ev) - { - if (!ev.Recipients.Contains(_player.LocalSession!.UserId) - || !_cache.TryGetResource(GetAnnouncementPath(ev.AnnouncementId, ev.AnnouncerId), - out var resource)) - return; - - var source = _audioManager.CreateAudioSource(resource); - if (source != null) - { - source.Gain = AnnouncerVolume * SharedAudioSystem.VolumeToGain(ev.AudioParams.Volume); - source.Global = true; - } - - AnnouncerSource?.Dispose(); - AnnouncerSource = source; - AnnouncerSource?.StartPlaying(); - } -} diff --git a/Content.Client/Audio/ContentAudioSystem.cs b/Content.Client/Audio/ContentAudioSystem.cs index a79ff74e797..f62b34b492c 100644 --- a/Content.Client/Audio/ContentAudioSystem.cs +++ b/Content.Client/Audio/ContentAudioSystem.cs @@ -29,8 +29,7 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem public const float AmbientMusicMultiplier = 3f; public const float LobbyMultiplier = 3f; public const float InterfaceMultiplier = 2f; - public const float AnnouncerMultiplier = 3f; - + public override void Initialize() { base.Initialize(); diff --git a/Content.Client/Options/UI/Tabs/AudioTab.xaml b/Content.Client/Options/UI/Tabs/AudioTab.xaml index 8dd723d446d..e54b0dc34ee 100644 --- a/Content.Client/Options/UI/Tabs/AudioTab.xaml +++ b/Content.Client/Options/UI/Tabs/AudioTab.xaml @@ -100,19 +100,6 @@