Repository navigation
host/audio_input: a DualSense's USB mic is selected and unmuted - #2999
Open
The-Inceptions wants to merge 1 commit into
Open
The-Inceptions wants to merge 1 commit into
The-Inceptions wants to merge 1 commit into
Conversation
A DualSense on a USB cable is a USB audio input device that the AUHAL capture records like any microphone, but its mic can be muted or in power saving. Over Bluetooth it is in no input-device list at all. When the capture opens a DualSense's USB audio (Sony's, on USB, with a DualSense or DualSense Edge HID device on USB beside it), the host first sends output report 0x02 (SetState) with only the mic sections allowed: the built-in mic, its volume at the top, echo and noise cancelling off, nothing muted, no power saving. The light bar, triggers and rumble keep what GameController set. dualsense_mic.c builds the report (no IOKit, so a test checks it byte for byte), and audio_input_dualsense.m finds the HID device in the registry and sends it. The launcher's picker marks that device "(USB)", for which the launcher now links IOKit. The report's layout is from the controllers wiki's DualSense data structures and awalol/DS5Dongle (MIT). Over Bluetooth the host never asks for the mic. The new reference entry "A DualSense's microphone over Bluetooth" (docs/reference/audio.md) records why that cannot work on a Mac: with the mic streaming (output report 0x32), GameController reads every mic frame, an input report 0x31 with byte 1 bit 1 set, as the pad's state (about 1,300 button presses and 300 sticks past half in 5 s with the controller lying still), and the Mac's 15 ms Bluetooth polling carries 43 of the mic's 100 frames a second. Checked on this base: t_dualsense_mic (make -C dm/host/tests GAME=<id> dualsense-mic), the host test suite, test_nsp_mac_app and the launcher type-check. In the game, on seedds#1822's capture before it was reworked into main (the hook sits at the same point, after the permission check): Ocarina of Time (0400486024DEC000, v131072) on an M5 Pro with macOS 27.2 and a DualSense on a USB-C cable: the log's "DualSense over USB (...): built-in mic selected and unmuted", captures at 48 kHz stereo with no underruns, zero fill or drops, and a live hum taken for Zelda's Lullaby at gain 2. Not checked: a DualSense Edge. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A DualSense on a USB cable is a USB audio input, so the Mac microphone capture from #1822 (taken into
mainasc25d4011) records it like any microphone, but the controller's own mic can be muted or in power saving. Over Bluetooth it is in no input-device list at all.When the capture opens a DualSense's USB audio (Sony's, on USB, with a DualSense or DualSense Edge HID device on USB beside it), the host first sends output report
0x02(SetState) with only the mic sections allowed: the built-in mic, its volume at the top, echo and noise cancelling off, nothing muted, no power saving. The light bar, triggers and rumble keep what GameController set.dualsense_mic.cbuilds the report (no IOKit, so a test checks it byte for byte), andaudio_input_dualsense.mfinds the HID device in the registry and sends it, after the capture's permission check. The launcher's device picker marks that device "(USB)", for which the launcher now links IOKit. The report layout is from the controllers wiki's DualSense data structures and awalol/DS5Dongle (MIT).The new reference entry "A DualSense's microphone over Bluetooth" (
docs/reference/audio.md, with a line in the Ocarina of Time note and the symptom index) records why the controller's mic cannot be used over Bluetooth on a Mac: with the mic streaming (output report0x32), GameController reads every mic frame, an input report0x31with byte 1 bit 1 set, as the pad's state (about 1,300 button presses and 300 sticks past half in 5 s with the controller lying still), and the Mac's 15 ms Bluetooth polling carries 43 of the mic's 100 frames a second.Checked
make -C dm/host/tests GAME=0400486024DEC000 dualsense-mic(the report, byte for byte) andaudio-input; the launcher type-check; the host test suite (make -C dm/host/tests GAME=0400486024DEC000 run);make -C dm/gfx/tests GAME=0400486024DEC000 -k runon Apple silicon: everything butcheck_t_dlss_mfxandcheck_t_dlss_scaler, which fail the same way onmain(0b5fd602);test_usage,test_nsp_mac_app,test_docs,test_env_switches;python3 dm/tools/docs_symptoms.py(no change);lint_c.py tidy --against mainwith LLVM 23.1.4: no finding in the changed files (the one file/check pair above the baseline,bugprone-suspicious-memory-comparisonindm/gfx/tests/t_gl_imports.m, is in a file this change does not touch);lint_python.py --against main: 0 new0400486024DEC000, v131072), on Audio input streams on the Mac's microphone: Ocarina of Time's ocarina can be played into it, with a launcher permission step, device picker and gain #1822's capture before it was reworked intomain(the hook sits at the same point here, after the permission check): the log'sDualSense over USB (...): built-in mic selected and unmuted, capture at 48 kHz stereo with no underruns, zero fill or drops, and a live hum taken for Zelda's Lullaby at gain 2. Not yet played on this base.regress.py:regress.py impactmaps the change to thehle:*InputStream*rows (the games that import the SDK's input streams; its new files are indm/tools/impact_map.tsv). The new code runs only when the microphone is on (DM_MIC=1) and the selected input is a DualSense on USB, so no game's default path changes and noregress.py checkwas run.Docs
docs/reference/audio.mdentry and the game note, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index)🤖 Generated with Claude Code