Skip to content

feat(windows,audio,proto): plug the controller's microphone into Windows hosts through usbip-win2 - #151

Merged
sqlpxc merged 1 commit into
mainfrom
feat/usb-microphone
Dec 4, 2026
Merged

sqlpxc merged 1 commit into
mainfrom
feat/usb-microphone

Conversation

@sqlpxc

@sqlpxc sqlpxc commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Windows hosts no longer put the controller's microphone into Steam Streaming Microphone (Steam had to be installed, its driver was installed from Steam's files with administrator rights, and its two sides usually needed exclusive mode). The microphone is now Airhand Microphone, a USB Audio Class 1.0 microphone from airhand-dock 0.3.0 plugged through usbip-win2 like the gamepads. Windows drives it with its own usbaudio.sys: nothing else to install, no administrator rights, no exclusive mode, no sound settings changed, and the same name as on Mac and Linux.

Host (client/src-tauri/src/host/mic/usb.rs)

  • Plugged on a session's first "microphone on"; ready once Windows has published its recording device (found by interface name), about 1 s.
  • The first time a computer sees it, Windows sets the device up and disables the recording device for about 2 s shortly after it appears, which breaks programs that opened it. A device that PnP doesn't know yet (USB\VID_1D6B&PID_0101\<serial>) is only reported ready once its recording device has settled, about 6 s.
  • Turning the microphone off or switching to another connection doesn't unplug it, so programs that chose it don't fall back to the computer's own microphone; it records silence. It's unplugged once every session that turned it on has ended: at once for a normal end, after 30 s without a reconnect for a dropped one (also when the session task is aborted).
  • A fixed USB serial keeps programs' choice and the default recording device.
  • host/dock.rs: one airhand-dock Dock per process for gamepads and the microphone.
  • The render loop's opener now says why it can't open yet (no driver, preparing) and polls faster while preparing. WASAPI device format parsing, the Steam driver installer and the zip dependency are gone.

Protocol and UI

  • MicState::NoDriver (usbip-win2 missing); the host re-checks every 5 s, so installing it needs no restart. NoDevice, SteamMissing and SetupFailed are only sent by older Windows hosts, and the console keeps their texts. Older controllers treat NoDriver as unsupported.
  • The console names the device Airhand Microphone on every platform and shows the usbip-win2 hint.
  • The installer's usbip-win2 prompt, its README and the docs (usage, architecture, limitations, development, README) describe it as the gamepad and microphone driver.

Tests

  • Unit: holder bookkeeping, endpoint name matching, the render loop waiting for a device that isn't ready yet, sample formats.
  • mic_reaches_airhand_microphone (Windows, usbip-win2 0.9.8.1): records a 1 kHz tone back through the real device with no gaps; still plugged after the microphone is turned off and after a dropped session, unplugged after a normal end. AIRHAND_TEST_MIC_SERIAL=<new> simulates a first plug (ready after ≈6 s, no invalidated recording).
  • e2e_mic through a local relay with 1 in 7 datagrams dropped: 3 s of tone, 0 silent 10 ms windows. e2e_roundtrip and plugs_a_virtual_gamepad pass.
  • cargo test --lib, clippy, npm test, airhand-proto / airhand-link tests pass. macOS and Linux builds weren't compiled here; their code changes are the opener signature and the new no-op ended / MicSession.

…ows hosts through usbip-win2

Windows hosts no longer use Steam Streaming Microphone (Steam had to be
installed, its driver was installed from Steam's files with administrator
rights, and its two sides usually needed exclusive mode). The controller's
microphone is now Airhand Microphone, a USB Audio Class 1.0 microphone
served by airhand-dock 0.3.0 and plugged through usbip-win2, like the
gamepads: Windows drives it with its own usbaudio.sys, so nothing else is
installed, no administrator rights, no exclusive mode, no sound settings
changed, and it has the same name on every platform.

- host/mic/usb.rs: plugged on the first "microphone on" of a session and
  ready once Windows has published its recording device (found by its
  interface name). The first time a computer sees it, Windows sets it up
  and briefly disables the recording device; the host waits for it to
  come back (about 6 s instead of 1 s). Turning the microphone off or
  switching connections doesn't unplug it, so programs that chose it don't
  fall back to the computer's own microphone; it is unplugged when every
  session that turned it on has ended (at once for a normal end, after
  30 s without a reconnect otherwise). A fixed USB serial keeps programs'
  choice and the default device setting.
- host/dock.rs: one airhand-dock Dock per process for gamepads and the
  microphone.
- proto: MicState::NoDriver (usbip-win2 missing). NoDevice, SteamMissing
  and SetupFailed are only sent by older Windows hosts; the console keeps
  their texts.
- The render loop's opener now says why it can't open yet (no driver,
  preparing) and polls faster while preparing; device format parsing for
  WASAPI is gone, as are the zip and tempfile dependencies.
- Installer, usbip-win2 README and docs describe usbip-win2 as the gamepad
  and microphone driver.
- Tests: mic_reaches_airhand_microphone records a 1 kHz tone back through
  the real device (AIRHAND_TEST_MIC_SERIAL simulates a first plug);
  e2e_mic uses it on Windows.
@sqlpxc
sqlpxc merged commit b3362bb into main Dec 4, 2026
1 check passed
@sqlpxc
sqlpxc deleted the feat/usb-microphone branch December 4, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant