Cues: send/receive checkboxes' own cue sounds take priority over the generic checkbox sound
The Send/receive checkboxes have dedicated cue sounds (send/receive turned on/off) AND would otherwise also fire the generic checkbox tick/untick. AccessibleCheckBox gains a SuppressCheckSound gate; the send/receive checkboxes set it so that when their dedicated cue is on, only that cue plays. When the dedicated cue is "(none)", the gate returns false and the generic checkbox sound plays as normal - so the checkbox sound never overrides the purpose-built send/receive sounds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2eaf7da184
commit
56417eb7c3
@@ -51,6 +51,14 @@ internal sealed class AccessibleCheckBox : CheckBox
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern void NotifyWinEvent(uint eventMin, nint hwnd, int idObject, int idChild);
|
private static extern void NotifyWinEvent(uint eventMin, nint hwnd, int idObject, int idChild);
|
||||||
|
|
||||||
|
/// <summary>Optional gate, called with the new Checked state just before the generic checkbox
|
||||||
|
/// tick/untick sound plays; return true to suppress it. The send/receive checkboxes set this so
|
||||||
|
/// that when their OWN dedicated cue (send/receive turned on/off) is enabled, only that cue
|
||||||
|
/// plays - the generic checkbox sound doesn't double up on top of it. When their dedicated cue
|
||||||
|
/// is set to "(none)", this returns false and the generic checkbox sound plays as normal.</summary>
|
||||||
|
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
|
||||||
|
public Func<bool, bool>? SuppressCheckSound { get; set; }
|
||||||
|
|
||||||
protected override void OnCheckedChanged(EventArgs e)
|
protected override void OnCheckedChanged(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnCheckedChanged(e);
|
base.OnCheckedChanged(e);
|
||||||
@@ -61,8 +69,9 @@ internal sealed class AccessibleCheckBox : CheckBox
|
|||||||
{
|
{
|
||||||
NotifyWinEvent(EVENT_OBJECT_FOCUS, Handle, OBJID_CLIENT, CHILDID_SELF);
|
NotifyWinEvent(EVENT_OBJECT_FOCUS, Handle, OBJID_CLIENT, CHILDID_SELF);
|
||||||
// Audible tick/untick feedback. Gated on Focused so it fires for a genuine user toggle
|
// Audible tick/untick feedback. Gated on Focused so it fires for a genuine user toggle
|
||||||
// (click or spacebar) but stays silent for the bulk programmatic checking on profile load.
|
// (click or spacebar) but stays silent for the bulk programmatic checking on profile
|
||||||
CheckSoundService.Play(Checked);
|
// load - and skipped when a control has its own dedicated cue (send/receive).
|
||||||
|
if (SuppressCheckSound?.Invoke(Checked) != true) CheckSoundService.Play(Checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1009,6 +1009,11 @@ public sealed class MainForm : Form
|
|||||||
// --- Wire main-form events ---
|
// --- Wire main-form events ---
|
||||||
receiveAudioCheckbox.CheckedChanged += (_, _) => OnStreamingCheckboxChanged(receiveAudioCheckbox);
|
receiveAudioCheckbox.CheckedChanged += (_, _) => OnStreamingCheckboxChanged(receiveAudioCheckbox);
|
||||||
sendMyAudioCheckbox.CheckedChanged += (_, _) => OnStreamingCheckboxChanged(sendMyAudioCheckbox);
|
sendMyAudioCheckbox.CheckedChanged += (_, _) => OnStreamingCheckboxChanged(sendMyAudioCheckbox);
|
||||||
|
// Send/receive have their own dedicated cue sounds (send/receive turned on/off). When that
|
||||||
|
// dedicated cue is on, only it plays - suppress the generic checkbox tick/untick on these two.
|
||||||
|
// When the dedicated cue is "(none)", these return false and the checkbox sound plays as normal.
|
||||||
|
sendMyAudioCheckbox.SuppressCheckSound = on => on ? AppConfig.Load().EnableSendOnCue : AppConfig.Load().EnableSendOffCue;
|
||||||
|
receiveAudioCheckbox.SuppressCheckSound = on => on ? AppConfig.Load().EnableReceiveOnCue : AppConfig.Load().EnableReceiveOffCue;
|
||||||
volumeBar.Scroll += (_, _) => { receiver.Volume = volumeBar.Value / 100f; MarkProfileDirty(); };
|
volumeBar.Scroll += (_, _) => { receiver.Volume = volumeBar.Value / 100f; MarkProfileDirty(); };
|
||||||
WireCheckedListAccessibility(receiveOutputDevicesList, receiveOutputDevicesStatusLabel, "receive output device");
|
WireCheckedListAccessibility(receiveOutputDevicesList, receiveOutputDevicesStatusLabel, "receive output device");
|
||||||
receiveOutputDevicesList.ItemCheck += (_, e) =>
|
receiveOutputDevicesList.ItemCheck += (_, e) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user