From da62f29d705b0840c04a229205195460b7d8ca81 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 9 Apr 2025 21:12:48 +1000 Subject: [PATCH] Add host mute indicator to status bar (see #2308) --- src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 1 + src/BizHawk.Client.EmuHawk/MainForm.cs | 12 ++++++++++++ .../Properties/Resources.cs | 1 + src/BizHawk.Client.EmuHawk/images/AudioMuted.png | Bin 0 -> 1130 bytes 4 files changed, 14 insertions(+) create mode 100644 src/BizHawk.Client.EmuHawk/images/AudioMuted.png diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 29e085b844..540fc56f5a 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -822,6 +822,7 @@ namespace BizHawk.Client.EmuHawk } Sound.StartSound(); RewireSound(); + UpdateStatusBarMuteIndicator(); } private void AutofireMenuItem_Click(object sender, EventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 5464882c4e..e33fd0db25 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -57,6 +57,8 @@ namespace BizHawk.Client.EmuHawk private readonly ToolStripMenuItemEx NullHawkVSysSubmenu = new() { Enabled = false, Text = "—" }; + private readonly StatusLabelEx StatusBarMuteIndicator = new(); + private readonly StatusLabelEx StatusBarRewindIndicator = new() { Image = Properties.Resources.RewindRecord, @@ -220,6 +222,10 @@ namespace BizHawk.Client.EmuHawk button.MouseLeave += SlotStatusButtons_MouseLeave; } + StatusBarMuteIndicator.Click += (_, _) => ToggleSound(); + MainStatusBar.Items.InsertBefore(KeyPriorityStatusLabel, insert: StatusBarMuteIndicator); + UpdateStatusBarMuteIndicator(); + if (OSTailoredCode.IsUnixHost) { // workaround for https://github.com/mono/mono/issues/12644 @@ -2589,6 +2595,7 @@ namespace BizHawk.Client.EmuHawk Config.SoundEnabled = !Config.SoundEnabled; Sound.StopSound(); Sound.StartSound(); + UpdateStatusBarMuteIndicator(); } private void VolumeUp() @@ -2822,6 +2829,11 @@ namespace BizHawk.Client.EmuHawk } } + private void UpdateStatusBarMuteIndicator() + => (StatusBarMuteIndicator.Image, StatusBarMuteIndicator.ToolTipText) = Config.SoundEnabled + ? (Properties.Resources.Audio, $"Core is producing audio, live playback at {(Config.SoundEnabledNormal ? Config.SoundVolume : 0)}% volume") + : (Properties.Resources.AudioMuted, "Core is not producing audio"); + private void UpdateStatusBarRewindIndicator() => StatusBarRewindIndicator.Visible = Rewinder?.Active is true; diff --git a/src/BizHawk.Client.EmuHawk/Properties/Resources.cs b/src/BizHawk.Client.EmuHawk/Properties/Resources.cs index 45d0854613..8e7ec2a5b8 100644 --- a/src/BizHawk.Client.EmuHawk/Properties/Resources.cs +++ b/src/BizHawk.Client.EmuHawk/Properties/Resources.cs @@ -48,6 +48,7 @@ namespace BizHawk.Client.EmuHawk.Properties internal static readonly Bitmap ArrowBlackDown = ReadEmbeddedBitmap("arrow_black_down"); internal static readonly Lazy AtariController = new Lazy(() => ReadEmbeddedBitmap("atari_controller")); internal static readonly Bitmap Audio = ReadEmbeddedBitmap("AudioHS"); + internal static readonly Bitmap AudioMuted = ReadEmbeddedBitmap("AudioMuted"); internal static readonly Bitmap AutoSearch = ReadEmbeddedBitmap("AutoSearch"); internal static readonly Bitmap Avi = ReadEmbeddedBitmap("AVI"); internal static readonly Bitmap Back = ReadEmbeddedBitmap("Back"); diff --git a/src/BizHawk.Client.EmuHawk/images/AudioMuted.png b/src/BizHawk.Client.EmuHawk/images/AudioMuted.png new file mode 100644 index 0000000000000000000000000000000000000000..e810065c7a24b0dc8869c3f72308dc2970c80a9e GIT binary patch literal 1130 zcmV-w1eN=VP)&Q5?tduUc491U(?4;SSc6OGPxA1rivD8E7?hAHKkQm3x&I$Dmbc=&@uq zv^3Y+&>93m4~X`lsi-C7b`MfYV9Ls3B=0kA zbmFCtL0Pp5vyn)cmi2Lq3*g2t&f^pg500009a7bBm000XU000XU0RWnu7ytkQph-kQRCwBz(_KiDQ5XmCb`f+}SD}zM zfhm%L3!R!Y@`GwR-O6Il-f1>J(6Oa1msxX;+@vN-DJ3O1tLe~G`f@Ov*zk)C zKT6A)>s7MVRQB)WooqxN_}`u1^PKZ=&aRy$`dZGXy?IgyW8=jV zbNihG1Pe&4B-B6gNGEm3)>SZRZp}x%DhanPg~6hg_tUkt%LIE!tUgb&@J`9FcZox1 zEZ5fEKkVpf*FaMgg|P?uSkmjTg>^aytyT+YrIN7?TRX%7)8=(0k55ehMp znu4aZ7~I#SV$Jy!#T3iwvw+Evfr;(}3|61RY<4=P`8)A=EEV* zIzfcxrZm*uQpLjU>&KukKZTK3RZz(|?wm7`+-(I2^dr#P931R11O++j0|Ny$a{k^N zen?GG#u1cIEEG`@P|CQ-JPS~EpjN=^fY36{4 w%ls`$3U8y5nanJ1_->y=B+&0K-s$)L13JBkXViUFWB>pF07*qoM6N<$f{7ds82|tP literal 0 HcmV?d00001