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

@@ -9,5 +9,6 @@ public enum SyncAction
ReplaceAll,
Backspace,
Enter,
Ping
Ping,
SetMute
}

View File

@@ -19,6 +19,7 @@ public sealed class SyncActionJsonConverter : JsonConverter<SyncAction>
"backspace" => SyncAction.Backspace,
"enter" => SyncAction.Enter,
"ping" => SyncAction.Ping,
"setMute" => SyncAction.SetMute,
_ => throw new JsonException($"Unsupported sync action: {value}")
};
}
@@ -35,6 +36,7 @@ public sealed class SyncActionJsonConverter : JsonConverter<SyncAction>
SyncAction.Backspace => "backspace",
SyncAction.Enter => "enter",
SyncAction.Ping => "ping",
SyncAction.SetMute => "setMute",
_ => throw new JsonException($"Unsupported sync action: {value}")
};

View File

@@ -9,4 +9,7 @@ public sealed record SyncMessage
[JsonPropertyName("text")]
public string? Text { get; init; }
[JsonPropertyName("muted")]
public bool? Muted { get; init; }
}