Add system mute control via setMute action

Introduce a setMute protocol action and an NAudio-backed
AudioControlService so the Android client can toggle the Windows
render endpoint mute state over WebSocket.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-06-17 22:12:13 +08:00
parent ad9a9021cc
commit 30da1680f2
9 changed files with 126 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ namespace WirelessTextSyncer.Windows.Tray;
public sealed class TrayApplicationContext : ApplicationContext
{
private readonly KeyboardInjectionService keyboard;
private readonly AudioControlService audio;
private readonly WebSocketServerService server;
private readonly DiscoveryResponderService discovery;
private readonly NotifyIcon notifyIcon;
@@ -21,7 +22,8 @@ public sealed class TrayApplicationContext : ApplicationContext
AppLogger.Info("Tray application starting.");
uiContext = SynchronizationContext.Current ?? new WindowsFormsSynchronizationContext();
keyboard = new KeyboardInjectionService();
var handler = new SyncMessageHandler(keyboard);
audio = new AudioControlService();
var handler = new SyncMessageHandler(keyboard, audio);
server = new WebSocketServerService(handler);
server.StatusChanged += (_, _) => uiContext.Post(_ => UpdateTrayStatus(), null);
@@ -62,6 +64,7 @@ public sealed class TrayApplicationContext : ApplicationContext
connectedIcon.Dispose();
waitIcon.Dispose();
discovery.Dispose();
audio.Dispose();
server.Dispose();
}