Port managed client audio and Windows application
.NET port / test (macos-latest) (push) Canceled after 0s
.NET port / test (ubuntu-24.04) (push) Canceled after 0s
.NET port / test (windows-latest) (push) Canceled after 0s
.NET port / cpp-conformance (push) Canceled after 0s

This commit is contained in:
2026-09-16 16:48:06 +02:00
parent 5a226ba543
commit 82ad4c2811
56 changed files with 2304 additions and 250 deletions
+20 -72
View File
@@ -1,95 +1,43 @@
# VoiceCat — Windows client
# VoiceCat — Windows client
WinForms (.NET 10 LTS) UI over `voicecat.dll` (MinGW-built `libvoicecat` shared library).
The WinForms .NET 10 client uses `VoiceCat.Core` for TLS, TOFU, protocol state and encrypted UDP, and `VoiceCat.Audio` for streams, jitter, Opus and mixing. Its only native runtime component is `voicecat_media.dll`, the narrow Opus/RNNoise C shim. The old `voicecat.dll` core is no longer loaded or published.
## Prerequisites
## Build
| Tool | Version | Notes |
|------|---------|-------|
| .NET SDK | 10.0.x | `dotnet --version` should report `10.0.*` |
| CMake | 3.25+ | For building the C++ DLL |
| MinGW-w64 / MSYS2 UCRT64 | GCC 13+ | `C:\tools\msys64\ucrt64` is the expected location |
| vcpkg | any | `VCPKG_ROOT` env var must point to a bootstrapped clone |
## Build order
### 1. Build the server (for testing)
Stage the pinned native media dependencies once, then build the solution:
```powershell
cmake --preset dev
cmake --build --preset dev --target voicecat-server
./dotnet/build-native.ps1
dotnet restore clients/windows/VoiceCat.slnx --locked-mode
dotnet build clients/windows/VoiceCat.slnx -c Release --no-restore
```
### 2. Build the DLL
The original `VoiceCat.Interop` project remains in the repository as a migration oracle. The app references `VoiceCat.Managed`, whose compatibility facade lets the existing accessible WinForms UI keep its event-pump shape while all networking and audio state live in the idiomatic managed libraries.
## Publish
```powershell
cmake --preset windows-client
cmake --build --preset windows-client
./clients/windows/publish-client.ps1
```
Output: `build/windows-client/bin/voicecat.dll`
This produces a self-contained `win-x64` distribution in `dotnet/artifacts/client/win-x64`. The script requires `voicecat_media.dll` and fails if the legacy `voicecat.dll` appears.
**Verify no MinGW runtime dependencies remain:**
```powershell
& "C:\tools\msys64\ucrt64\bin\objdump.exe" -p build/windows-client/bin/voicecat.dll |
Select-String "DLL Name"
```
Expected: only Windows system DLLs (`KERNEL32.dll`, `WS2_32.dll`, `BCRYPT.dll`, etc.).
If `libgcc_s_seh-1.dll`, `libstdc++-6.dll`, or `libwinpthread-1.dll` appear, the
`-static-libgcc -static-libstdc++ -static -lwinpthread` link flags in `core/CMakeLists.txt`
are not taking effect — check the CMake log for the `VOICECAT_BUILD_SHARED+WIN32` branch.
### 3. Build the C# solution
The noninteractive startup and real WASAPI device check is:
```powershell
cd clients/windows
dotnet build VoiceCat.slnx
./dotnet/artifacts/client/win-x64/VoiceCat.App.exe --smoke-test --audio
```
The app's `Directory.Build.props` copies `voicecat.dll` from `../../build/windows-client/bin/`
into the output directory automatically on every build.
`--smoke-test` constructs the real main form and pumps the managed client. `--audio` additionally opens the default WASAPI capture and render endpoints, moves PCM through both for three seconds, and fails if capture produces no samples.
## Running manually
## Run manually
```powershell
# Terminal 1 — start the server
./build/dev/bin/voicecat-server.exe --name "My Server"
# Terminal 1
./dotnet/artifacts/server/win-x64/VoiceCat.Server.exe
# Terminal 2 — launch the client
# Terminal 2
dotnet run --project clients/windows/VoiceCat.App/VoiceCat.App.csproj
```
On first connect to a new server:
- Enter `127.0.0.1` as the host (not `localhost` — Windows resolves `localhost` to `::1`
first, and while the server now dual-stacks, `127.0.0.1` is cleaner for local testing).
- The server identity dialog will appear. The TLS leaf-cert SHA-256 fingerprint is shown;
accept to pin it. Subsequent connects to the same server will be silent (MATCHED).
## M5 — Moderation & admin UI
The WinForms client now exposes all M5 operations through the main menu and context menus:
- **Admin → Server accounts…** — create, reset password, and delete server accounts
(requires `can_admin_accounts`).
- **Channel tree right-click** — create, edit, and delete channels. The edit dialog exposes the
full per-channel Opus configuration: mono/stereo, sample rate, bitrate, frame size,
application mode, FEC, expected packet loss, DTX, and complexity.
- **User list right-click** — move, kick, ban, server mute/deafen, and set permissions
(items are gated by your own permissions).
- **Activity log** shows async `GenericResult` feedback for every moderation request.
- **User list** shows text indicators for self-mute, self-deafen, server-mute, and
server-deafen states.
These operations require an admin-provisioned account with the appropriate permissions; the
connect dialog already supports username/password auth.
## Known limitations
- **PTT is focus-scoped** — the push-to-talk key only works while the VoiceCat window has
focus. A system-wide `WH_KEYBOARD_LL` hook is not used in v1 (permissions + AV risk).
- **Receive-side noise reduction** checkbox in per-user tuning is wired end-to-end but is a
passthrough no-op until a real APM/NS backend is built (no working Windows/MSVC port of
`webrtc-audio-processing` upstream — see `docs/tech-stack.md §1`).
- **TOFU pins the TLS leaf cert**, not the declared Ed25519 identity fingerprint. Both are
shown in the identity dialog, but the cert fingerprint is the value that is actually
verified on reconnect. See `docs/security.md §1.1`.
Manual release validation still includes NVDA navigation and a ten-minute two-client listen test, as required by `docs/porting-to-dotnet.md`.