diff --git a/Content.Client/_Sunrise/TapePlayer/TapePlayerBoundUserInterface.cs b/Content.Client/_Sunrise/TapePlayer/TapePlayerBoundUserInterface.cs index 3c5d8bad91b..a0aec15c7a9 100644 --- a/Content.Client/_Sunrise/TapePlayer/TapePlayerBoundUserInterface.cs +++ b/Content.Client/_Sunrise/TapePlayer/TapePlayerBoundUserInterface.cs @@ -1,6 +1,7 @@ using Content.Shared._Sunrise.TapePlayer; using Robust.Client.Audio; using Robust.Shared.Audio.Components; +using Robust.Shared.Audio.Systems; namespace Content.Client._Sunrise.TapePlayer; @@ -42,6 +43,7 @@ protected override void Open() }; _menu.SetTime += SetTime; + _menu.SetVolume += SetVolume; Reload(); } @@ -54,6 +56,7 @@ public void Reload() return; _menu.SetAudioStream(tapePlayer.AudioStream); + _menu.SetVolumeSlider(tapePlayer.Volume * 100f); if (_entityManager.TryGetComponent(tapePlayer.InsertedTape, out var musicTapeComponent)) { @@ -77,8 +80,8 @@ public void SetTime(float time) // so it will go BRRRRT // Using ping gets us close enough that it SHOULD, MOST OF THE TIME, fall within the 0.1 second tolerance // that's still on engine so our playback position never gets corrected. - if (EntMan.TryGetComponent(Owner, out TapePlayerComponent? jukebox) && - EntMan.TryGetComponent(jukebox.AudioStream, out AudioComponent? audioComp)) + if (EntMan.TryGetComponent(Owner, out TapePlayerComponent? tapePlayer) && + EntMan.TryGetComponent(tapePlayer.AudioStream, out AudioComponent? audioComp)) { audioComp.PlaybackPosition = time; } @@ -86,6 +89,11 @@ public void SetTime(float time) SendMessage(new TapePlayerSetTimeMessage(sentTime)); } + public void SetVolume(float volume) + { + SendMessage(new TapePlayerSetVolumeMessage(volume)); + } + protected override void Dispose(bool disposing) { base.Dispose(disposing); diff --git a/Content.Client/_Sunrise/TapePlayer/TapePlayerMenu.xaml b/Content.Client/_Sunrise/TapePlayer/TapePlayerMenu.xaml index 26934f6d3f9..b7b435b633a 100644 --- a/Content.Client/_Sunrise/TapePlayer/TapePlayerMenu.xaml +++ b/Content.Client/_Sunrise/TapePlayer/TapePlayerMenu.xaml @@ -2,15 +2,21 @@ SetSize="400 150" Title="{Loc 'tape-player-menu-title'}" Resizable="False"> -