Reset-ASIO button + checkbox tick/untick sounds (parts 1-2 of the cue/preferences overhaul)

Part 1 - "Uncheck all inputs and outputs" button now also resets the ASIO driver to "(none)":
renamed to say so, and UncheckAllDevices sets asioDriverBox to row 0 for a full clean
WASAPI-only, nothing-selected state.

Part 2 - checkbox tick/untick sounds: every checkbox toggle anywhere in RemSound now plays a
short cue (check.wav on tick, uncheck.wav on untick) - instant feedback on which way a box
went, especially in the inputs/outputs lists. New CheckSoundService + two machine-wide cues
(CheckboxOn/Off) with the usual numbered-variant + Preferences treatment. Hooked from
AccessibleCheckBox.OnCheckedChanged and the device lists' WireCheckedListAccessibility, both
gated on the control being Focused so a genuine user toggle clicks but bulk programmatic
(un)checking (profile load, "uncheck all") stays silent. Reloaded at startup and on cue change.

Tests + manual updated; .sfk byproducts cleared.

Remaining for the overhaul (next): tabbed Preferences (General / Audio cues / Startup behaviour /
Update settings), the cue-list redesign with a "none" option replacing per-cue checkboxes, moving
Startup behaviour out of the Options menu, and a front-most "missing sound file" error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-06-13 00:42:41 +01:00
co-authored by Claude Opus 4.8
parent 8763470037
commit aed555cc2e
14 changed files with 87 additions and 5 deletions
+3
View File
@@ -60,6 +60,9 @@ internal sealed class AccessibleCheckBox : CheckBox
if (Focused)
{
NotifyWinEvent(EVENT_OBJECT_FOCUS, Handle, OBJID_CLIENT, CHILDID_SELF);
// 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.
CheckSoundService.Play(Checked);
}
}
}
+47
View File
@@ -0,0 +1,47 @@
using RemSound.Core;
namespace RemSound.App;
/// <summary>
/// Plays a short tick / untick sound whenever the user checks or unchecks a checkbox anywhere in
/// RemSound - instant audible feedback of which way a box just went, which matters most in the busy
/// inputs/outputs lists. Two normal machine-wide cues: CheckboxOn (check.wav) and CheckboxOff
/// (uncheck.wav), each with numbered variants + an off option in Preferences, like any other cue.
///
/// Wired from <see cref="AccessibleCheckBox"/> and the device <c>LiveCheckedListBox</c>, both gated
/// on the control being focused - so a genuine user toggle clicks, but the bulk programmatic
/// checking done on profile load or by "uncheck all" stays silent.
/// </summary>
internal static class CheckSoundService
{
private static CuePlayer? checkSound;
private static CuePlayer? uncheckSound;
/// <summary>(Re)load the tick/untick sounds from the current cue configuration. Call at startup
/// and whenever cue settings change.</summary>
public static void Reload()
{
var cfg = AppConfig.Load();
checkSound = LoadCue(MainForm.CueId.CheckboxOn, "check.wav", cfg);
uncheckSound = LoadCue(MainForm.CueId.CheckboxOff, "uncheck.wav", cfg);
}
public static void Play(bool isChecked)
{
var cfg = AppConfig.Load();
if (isChecked) { if (cfg.EnableCheckboxOnCue) checkSound?.Play(); }
else { if (cfg.EnableCheckboxOffCue) uncheckSound?.Play(); }
}
private static CuePlayer? LoadCue(string cueId, string defaultFile, AppConfig cfg)
{
try
{
string? path = cfg.MachineCueCustomPaths.TryGetValue(cueId, out var custom) && File.Exists(custom)
? custom
: CueSounds.ResolveDefaultPath(cueId, defaultFile, cfg);
return path is not null && File.Exists(path) ? new CuePlayer(path) : null;
}
catch { return null; }
}
}
+19 -2
View File
@@ -776,8 +776,8 @@ public sealed class MainForm : Form
// "Uncheck all inputs and outputs on all soundcards" — clears every device tick in one
// press. Button owns its own &-mnemonic (Alt+U), so AccessibleName stays clean per Ed's
// mnemonic convention.
uncheckAllDevicesButton.Text = "Uncheck all inputs and outputs on all soundcards (Alt+&U)";
uncheckAllDevicesButton.AccessibleName = "Uncheck all inputs and outputs on all soundcards";
uncheckAllDevicesButton.Text = "Uncheck all inputs and outputs on all soundcards and set ASIO driver to none (Alt+&U)";
uncheckAllDevicesButton.AccessibleName = "Uncheck all inputs and outputs on all soundcards and set ASIO driver to none";
uncheckAllDevicesButton.Click += (_, _) => UncheckAllDevices();
// Populate ASIO driver list at startup. Discovers all ASIO drivers via NAudio + a
@@ -4572,6 +4572,11 @@ public sealed class MainForm : Form
}
finally { suppressDeviceCheckChange = false; }
// Also reset the ASIO driver to "(none)" (row 0): the button now does a full reset to a
// clean WASAPI-only, nothing-selected state. Setting the index fires the driver-change
// handler, which saves the change and rebuilds the engine in WASAPI-only mode.
if (asioDriverBox.SelectedIndex > 0) asioDriverBox.SelectedIndex = 0;
ApplyAudioRuntime();
ApplyReceiveDevices();
MarkProfileDirty();
@@ -6512,6 +6517,9 @@ public sealed class MainForm : Form
public const string ReceiveOff = "receive-off";
public const string Hide = "hide";
public const string Show = "show";
// Played on every checkbox tick/untick across the whole app (CheckSoundService).
public const string CheckboxOn = "checkbox-on";
public const string CheckboxOff = "checkbox-off";
}
/// <summary>Load one cue sound. Resolution order:
@@ -6589,6 +6597,8 @@ public sealed class MainForm : Form
TryLoadCueSound(CueId.ReceiveOff, "recieve off.wav", out receiveOffSound);
TryLoadCueSound(CueId.Hide, "minimise.wav", out hideSound);
TryLoadCueSound(CueId.Show, "maximise.wav", out showSound);
// The app-wide checkbox tick/untick sounds live in their own service; keep them in step.
CheckSoundService.Reload();
}
/// <summary>
@@ -7209,6 +7219,13 @@ public sealed class MainForm : Form
private void WireCheckedListAccessibility(CheckedListBox list, Label statusLabel, string itemKind)
{
// Tick/untick sound for the inputs/outputs lists. Gated on the list being focused so a real
// user click/spacebar clicks, but the bulk programmatic (un)checking done on profile load or
// by "uncheck all" (focus is on the button, not the list) stays silent.
list.ItemCheck += (_, e) =>
{
if (list.Focused) CheckSoundService.Play(e.NewValue == CheckState.Checked);
};
list.SelectedIndexChanged += (_, _) =>
{
if (list.SelectedIndex >= 0) lastFocusedListIndices[list] = list.SelectedIndex;
+5
View File
@@ -194,6 +194,11 @@ internal sealed class PreferencesDialog : Form
c => c.EnableHideCue, (c, v) => c.EnableHideCue = v),
MachineRow("Restore (show) sound", MainForm.CueId.Show, "maximise.wav",
c => c.EnableShowCue, (c, v) => c.EnableShowCue = v),
// Played on every checkbox tick / untick across the whole app (CheckSoundService).
MachineRow("Checkbox ticked sound", MainForm.CueId.CheckboxOn, "check.wav",
c => c.EnableCheckboxOnCue, (c, v) => c.EnableCheckboxOnCue = v),
MachineRow("Checkbox unticked sound", MainForm.CueId.CheckboxOff, "uncheck.wav",
c => c.EnableCheckboxOffCue, (c, v) => c.EnableCheckboxOffCue = v),
];
}
+4
View File
@@ -137,6 +137,10 @@ internal static class Program
KeyClickService.Initialize(AppConfig.Load().EnableKeyboardClicks);
Application.ApplicationExit += (_, _) => KeyClickService.Shutdown();
// Tick/untick sounds for checkbox toggles app-wide (CheckSoundService). Loaded here; reloaded
// by MainForm.ReloadAllCueSounds whenever cue settings change in Preferences.
CheckSoundService.Reload();
// One-time "your settings moved" notice — only the launch that actually relocated files
// shows it (idempotent migration ⇒ MovedAnything is false on every later launch). Shown
// here, after the guard and before the profile picker, so the user reads it once up front.
+1
View File
@@ -307,6 +307,7 @@ internal static class SelfTest
{
"connect.wav", "disconnect.wav", "start up.wav",
"send on.wav", "send off.wav", "recieve on.wav", "recieve off.wav", "minimise.wav", "maximise.wav",
"check.wav", "uncheck.wav",
})
{
Check(CueSounds.Variants(cue).Count > 0,
+3
View File
@@ -106,6 +106,9 @@ public sealed class AppConfig
public bool EnableReceiveOffCue { get; set; } = true;
public bool EnableHideCue { get; set; } = true;
public bool EnableShowCue { get; set; } = true;
/// <summary>Tick / untick sounds played on every checkbox toggle anywhere in the app.</summary>
public bool EnableCheckboxOnCue { get; set; } = true;
public bool EnableCheckboxOffCue { get; set; } = true;
/// <summary>Custom WAV overrides for the machine-wide cues above, keyed by cue id. The
/// equivalent of <see cref="Profile.CustomCuePaths"/> but machine-wide, since these cues don't