Add host mute indicator to status bar (see #2308)

This commit is contained in:
YoshiRulz 2025-04-09 21:12:48 +10:00
parent eb7296dcd5
commit da62f29d70
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 14 additions and 0 deletions

View File

@ -822,6 +822,7 @@ namespace BizHawk.Client.EmuHawk
}
Sound.StartSound();
RewireSound();
UpdateStatusBarMuteIndicator();
}
private void AutofireMenuItem_Click(object sender, EventArgs e)

View File

@ -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;

View File

@ -48,6 +48,7 @@ namespace BizHawk.Client.EmuHawk.Properties
internal static readonly Bitmap ArrowBlackDown = ReadEmbeddedBitmap("arrow_black_down");
internal static readonly Lazy<Bitmap> AtariController = new Lazy<Bitmap>(() => 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");

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB