feat(audio): the game's sounds on a DualSense's own speaker and headphones #1545
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1545
Loading…
Reference in a new issue
No description provided.
Delete branch "duducs9/Longshot:feat/controller-speaker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On the console, Navi, the menus and other close sounds come out of the controller, and headphones in it take all the
sound. On PC a DualSense's own speaker and its headphone jack stayed unused. This PR plays chosen kinds of the game's
sounds on the controller's speaker, from a Controller speaker page under Audio (Navi's voice and her flight,
Z-targeting, the ocarina, pick-ups, items, fairies, the menus, the Stone of Agony, the low-health alarm, fishing and
bottles, each Off, Controller only or Controller + TV), with a volume, a sync between the controller and the TV, and
headphones in the controller's jack taking the whole game as on the console.
Read first:
host/pad_speaker.c: the controller's output report (speaker or headphones), the ring that follows the pad's clock, thespeaker's high-pass and limiter, headphone detection. The speaker's two channels ride on the vibration's stream from #405
(
host/rumble_renhdrum.cusb_pullcallshos_pad_speaker_fill) while it plays the pad, so the pad's sound card has onestream; otherwise the speaker opens its own through
hos_sdl_audio_open. Thehos_sdlaudio-endpoint functions werereused from #405, by Stellarznith.
host/audio_source.c,.h: the game's sounds classed by the archive and asset a wave buffer plays from, read from theplayer's own sound archives at the start. Nothing of the game is in the source or the build.
host/nn_audio.c: the classed sounds to the pad, left out of the TV's mix for Controller only; a Controller sync below 0holds only the TV's copy of the Controller + TV sounds back (a delay line per mix); the whole mix to the headphones.
host/pad_sdl.c: the Vibration strength at half while an ocarina sound plays on the speaker (the motors shook it intocrackling).
gpu/vk/menu/controller_speaker.cpp: the page as a menu module (HOS_OPT_PAD_SPEAKER_*100 to 115), itspad_speaker_*keys, the texts in all 13 languages (
menu_i18n.h).See #405, #752 (the request for RenHD Rumble on a DualSense, which that endpoint serves) and #1433 (binaural 3D headphone
audio: this PR routes the game's sound to the DualSense's jack, without HRTF processing).
Testing
Tested: Windows 10 Pro 19045, RX 7800 XT, DualSense through a Raspberry Pi Pico 2 W running DS5Dongle v0.8.0
(https://github.com/awalol/DS5Dongle, by awalol), which exposes the DualSense's speaker and microphone over USB; plain
Bluetooth does not expose the controller's audio on Windows. In play, on this branch rebased onto
main@068fb8eb: theController speaker page under Audio (opens, Back to Audio, settings kept after a restart); Navi, targeting, items, the
ocarina and the menus from the controller as chosen; headphones in the controller's jack; and with
renhdrum.dllbesidethe game, the voice coils and the speaker together on one stream (
vibration: "DualSense Wireless Controller": fine haptics on its cable (RenHDrum), thenpad speaker: playing on the DualSense's endpoint (with the vibration's stream)),the speaker taking its own stream back while the vibration was off;
pad speaker: closed (the game is closing); 0 under-runs, 0 trims, 20.0 ms buffered on average. Rebased since ontomain@702a57a4without conflicts (no file of thespeaker's or the vibration's changed there): the renderer built and the speaker's, menu's and translations' checks run
again on it. Checks on this head (Windows):
mise run ci:smokepasses (6 tests);mise run lint's hooks pass but ruff stops with"the argument '--force-exclude' cannot be used multiple times", as it does on
main;mise run test: 283 pass, 59 failin the parallel run, 29 of those pass run alone, and the other 30 fail the same way on a clean
mainworktree(test_antilag, test_appimage_player_build, test_auto_handheld, test_bug_report, test_bug_report_defaults,
test_capture_read_once, test_capture_readback_visibility, test_crash_dialog, test_crt_options, test_damage_debug_menu,
test_dev_ab, test_dev_build, test_dev_migrate, test_dev_packs, test_display_startup_failure, test_dlss_feature_size,
test_draw_stream_visibility, test_failed_compile_keeps_objects, test_frame_overlap, test_fsr3_release_frees,
test_fsr4_bind_dispatch, test_fsr_image_retirement, test_fsr_uniform_ownership, test_game_menu_mouse_buttons,
test_guest_imported, test_high_fps_fixes, test_host_guest_writes, test_hud_layout_row, test_parallel_init_order,
test_pipeline_play_cache).
Still to test:
expecting Navi from the controller and
pad speaker: playing on the DualSense's endpointin the log (by hand)pad speaker:error lines and every sound on the TV (theAppImage's SDL2 has no endpoint calls) (@Beanstalk linux, start the game and open Audio, Controller speaker)
Measurements
Nothing to measure for speed: the mixer's added work is one mono sum per classed voice while a DualSense's endpoint is open, and none without it.
Switches and defaults
The settings' defaults were chosen by ear in the in-game test: the speaker's volume 100% (twice the mixer's level, for a
small speaker; 0 to 200%), the Controller sync 0 ms, headphones in the controller on All sound at 80%, and each kind of
sound Controller only or Controller + TV (
vk_menu.h,pad_speaker[12]). The switches (rows ingpu/vk/switches.def,docs/dev/reference/switches.md, "The controller speaker"):=0turning its part back for a run:HOS_AUDIO_SOURCE(the sounds classed from the player'sown sound archives),
HOS_PAD_SPEAKER(the endpoint opened while a kind of sound plays there),HOS_PAD_SPEAKER_HPF(a 250 Hz high-pass: bass the small speaker cannot play is left out),
HOS_PAD_SPEAKER_LIMITER(a look-ahead limiter: noclipping at 200%),
HOS_PAD_SPEAKER_LOW_LATENCY(a 20 ms buffer that follows the pad's clock: fewer crackles thanthe earlier 40 ms),
HOS_PAD_SPEAKER_TV_DELAY(a sync below 0 holds the TV's copy back).HOS_PAD_SPEAKER_GAIN4 (the pad's preamp: louder withoutdistortion),
HOS_PAD_SPEAKER_BUFFER_MS20,HOS_PAD_SPEAKER_OCARINA_RUMBLE50 (the motors shook the speaker intocrackling during the ocarina),
HOS_PAD_SPEAKER_PATH3 (the speaker alone).HOS_AUDIO_SOURCE_TRACE,HOS_PAD_SPEAKER_TEST,HOS_PAD_SPEAKER_HEADPHONES(unset: what the pad's input report says).
HOS_PAD_SPEAKER_VOLUME,HOS_PAD_SPEAKER_HEADPHONE_MODE,HOS_PAD_SPEAKER_NAVI_VOICE,HOS_PAD_SPEAKER_NAVI_SOUND,HOS_PAD_SPEAKER_TARGET,HOS_PAD_SPEAKER_OCARINA,HOS_PAD_SPEAKER_PICKUP,HOS_PAD_SPEAKER_ITEM,HOS_PAD_SPEAKER_FAIRY,HOS_PAD_SPEAKER_UI,HOS_PAD_SPEAKER_AGONY,HOS_PAD_SPEAKER_LOW_HEALTH,HOS_PAD_SPEAKER_FISHING,HOS_PAD_SPEAKER_BOTTLE.Risks
With the controller's endpoint open, a Controller only sound leaves the TV's mix and headphones in the controller silence
the TV (both by design, and logged). A pad that says headphones are in when they are not would silence the TV:
HOS_PAD_SPEAKER_HEADPHONES=0overrides it.HOS_PAD_SPEAKER=0leaves the controller alone, and each part has its ownswitch (
docs/dev/reference/switches.md, "The controller speaker"); or revert. After updating,longshot_options.inigainsthe
pad_speaker_*keys; saves and caches are unchanged.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
gpu/vk/switches.def.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 10 Pro 19045, RX 7800 XT, DualSense through a Raspberry Pi Pico 2 W running DS5Dongle v0.8.0: played with Navi, Z-targeting, items, the ocarina and the menus on the controller's speaker (HOS_AUDIO_SOURCE_TRACE=1: 932 sounds classed from 40 archives; pad speaker: 0 under-runs, 0 trims), no crackle on bombs and ocarina notes, the Controller sync lining the TV up, and headphones in the controller taking all the sound with the TV silent.
Possibly related, for context:
Full
tests/run_all.pyon this PC (Windows 10, llvm-mingw on PATH): this branch 596 passed, 129 failed, 46 skipped; main @4b68c42b584 passed, 138 failed, 46 skipped. Every test that failed here and not on main passed when run again alone (Windows held a test's temporary .exe: WinError 32), excepttest_linux_audio_output, which failed in that run and passes in the pushed commit (64424b37: the pad's endpoint calls moved out of the sound section it compiles). These fail on main too, on this PC:test_audio_in,test_auto_handheld,test_auto_settings,test_bug_report,test_bug_report_defaults,test_commit_room,test_compute_pin,test_compute_warm_apart,test_cpu_report,test_crash_dialog,test_crash_dump_policy,test_crt_options,test_damage_debug_menu,test_dev_packs,test_display_startup_failure,test_dlss_feature_size,test_draw_binds,test_draw_stream_visibility,test_failed_compile_keeps_objects,test_frame_overlap,test_fsr_image_retirement,test_fsr_uniform_ownership,test_fullscreen_monitor_platform,test_guest_imported,test_hd_rumble,test_hud_layout_row,test_import_reach,test_invalidate_quick,test_invalidate_vcore,test_job_queue,test_libc_hooks,test_linux_preflight,test_linux_pressure,test_lower_tld_ms,test_memory_priority,test_mirror_budget,test_mirror_inherit,test_missing_nup,test_oot_shadow,test_pads_after_menu,test_parallel_init_order,test_pending_guest_import,test_pipeline_play_cache,test_portable_builder_home,test_portable_builder_startup,test_prepare_workers,test_present_aspect,test_present_thread,test_profiling_mode,test_psychov35_fsr3_fg,test_psychov35_off,test_reactive_mask,test_readback_timeout_source,test_recorder_sync,test_reflex_swapchain_lifetime,test_replay_write_order,test_rumble_mapping,test_run_all_changed,test_run_all_junit,test_sdiv_overflow,test_seed_cs_pointers,test_seed_kept_loaded,test_shadow_mask_guard,test_share_message_i18n,test_slow_frames,test_sparse_bind_failure,test_sparse_spare,test_staging_burst,test_switch_table,test_target_image_pool,test_task_mesh_fallback_devices,test_tested_configurations,test_ub_gap,test_upscaler_rows,test_utf8_paths,test_vcore_escape,test_vk_occlusion_queries,test_walk_keyWIP: feat(audio): the game's sounds on a DualSense's own speaker and headphonesto feat(audio): the game's sounds on a DualSense's own speaker and headphones64424b37ed265079da35Rebased onto main @
10de79fb(57 new commits) and pushed as 265079da. Two conflicts, both small:nx2/build.py'sZSTD_HOST(both sides added a file: both kept,oot_heart_containers.clast, astests/test_heart_containers.pyreads it) andhost/nn_audio.c'sAppendWaveBuffer(main now hands the command the checked wave buffer: kept, the sound's class added on it). The option numbers 100 to 115 are still free.Description: Why now links #405 (the
hos_sdlaudio-endpoint functions were reused from it, by Stellarznith), #752 and #1433.Checks, as
mise.tomldefines them (mise is not installed on this PC, so each task's own command was run with Python 3.14 and llvm-mingw):mise run ci:smoke(python -I -B tests/test_run_all_junit.py):Ran 6 tests ... OK.mise run test(python -I -B tests/run_all.py --strict), on 020d2c68:610 passed, 164 failed, 49 skipped in 775 s. 85 of the failures were not in the earlier main run; run again one at a time, 72 passed (Windows holding a test's temporary .exe: WinError 32). Of the 13 left, 11 fail on main @10de79fbtoo (test_alt_enter,test_capture_read_once,test_capture_readback_visibility,test_fsr3fi_hudless_colour,test_game_menu_mouse_buttons,test_host_guest_writes,test_hud_layout,test_prepare_cache_save,test_present_source_crop,test_song_note_cue,test_vertex_bind),test_nvn_tex_builder_guardpasses when run again, andtest_heart_containerswas this branch's (theZSTD_HOSTorder): fixed in 265079da, it passes now.mise run lint: not run yet: it needs pre-commit and actionlint, which are not on this PC. It follows in a comment once they are.User-guide screenshot review (
python -I -B scripts/check_guide_screenshots.py --review-sources):Guide screenshot check failed: 23 issue(s), all forsettings-graphics.png, and main @10de79fbgives the same 23, none from this PR's files alone (gpu/vk/device_policy.h,vk_dlss.h,vk_vendor.hmissing, the fixturescripts/screenshots/menu.cpp, and others). This PR changes the Audio tab's Controller speaker page, not the Graphics tab the image shows. The review's recapture (scripts/screenshots/capture_menu.py) needs Linux, which this PC does not have, so the manifest is left as it is: refreshing its hashes without a capture is what the guide's README says not to do.265079da35c3ee73ab51Main moved 4 more commits while this was posted; rebased again onto main @
10fab152and pushed asc3ee73ab. One trivial conflict: tests/crash_record_test.c, where main and this branch each added a stub at the same place (both kept). Rechecked: the 15 checks this PR touches pass (test_pad_speaker, test_audio_source, test_audio_source_load, test_heart_containers, test_crash_record, test_windows_stop, test_menu_i18n, test_option_ids, test_menu_keys, test_readme_menu_rows, test_linux_audio_output, test_sdl_pad_diagnostics, test_audio_biquad, test_audio_wave_buffer_release), and the changed host files compile (llvm-mingw, syntax). Mergeable again.miseis installed on this PC now (2026.11.9, withmise install's pinned tools), and the three tasks ran as asked, onc3ee73ab:mise run ci:smoke:Ran 6 tests in 11.814sOK.mise run test:652 passed, 124 failed, 49 skipped in 808 s (windows, 16 at once). 55 of the failures were not in main's run; run again one at a time with mise's Python, 46 passed (Windows' temporary-file lock), and the other 9 fail on main @10de79fbtoo:test_capture_read_once,test_capture_readback_visibility,test_fsr3fi_hudless_colour,test_game_menu_mouse_buttons,test_host_guest_writes,test_prepare_cache_save,test_present_source_crop,test_song_note_cue,test_vertex_bind. The rest also fail on main on this PC (the list in the earlier comment).mise run lint: every pre-commit hook passes (check yaml and json: no files; end of files, trailing whitespace, gitleaks: Passed; ShellCheck: no files). actionlint then reports one finding, in a file this PR does not change, so main has it too:mooki referenced this pull request2026-11-19 02:05:59 +00:00
mooki referenced this pull request2026-11-19 02:34:02 +00:00
c3ee73ab51814c8db200Rebased onto current
main(@702a57a4), as one commit. Main had reworked three things this PR touched, so it is ported rather than replayed:hos_sdlaudio-endpoint functions (credit Stellarznith). While RenHDrum plays the pad's voice coils, the speaker's two channels ride on that same stream (host/rumble_renhdrum.cusb_pullcallshos_pad_speaker_fill), so the pad's sound card has one stream; when the vibration is off the speaker opens its own. The ocarina's half strength goes through main's Vibration strength.gpu/vk/menu/controller_speaker.cpp, with the samepad_speaker_*keys and the texts in all 13 languages;vk_menu.cppgets the page's tab (Back returns to Audio).docs/dev/reference/switches.md("The controller speaker"), the player's rows indocs/user/graphics-and-controls.md, and the description in the short template.Tested in play on Windows with a DualSense through DS5Dongle: the page, the speaker, headphones, and the voice coils together with the speaker on one stream (log lines in Testing). The checks' results are in Testing: no failure comes from this PR.
814c8db200e76e344e6a@review
Recommendation: Request changes. Queued sounds can be routed using the wrong sound’s settings, and a rejected controller output report can leave sounds missing from the TV. The change also adds unmeasured work for players without a usable controller speaker.
The feature routes selected sounds to a DualSense speaker and the full mix to its headphone jack. The reported dongle run demonstrates the feature in that setup, but the buffer classification and output-report failure paths need fixes, the ring counters need safe wraparound, and the cost on ordinary setups needs measurement.
Does it help: Unproven overall. The author reports successful speaker and headphone playback on Windows through DS5Dongle, but provides no before/after frame-time, startup-time or memory measurements. The code reads and decompresses archives and classifies wave buffers even without an available speaker.
Other systems: Linux and Steam Deck behavior, plain USB on Windows, other Tier 1 hardware, multiple controllers, rejected output reports and long sessions remain unverified. RenHDrum shares the endpoint and changes the output-report path; the author reports it working with the dongle. The renderer interface itself was not extended.
Switches: The PR adds HOS_AUDIO_SOURCE and HOS_PAD_SPEAKER feature kill switches, HPF, limiter, low-latency and TV-delay switches, gain 4, buffer 20 ms, ocarina rumble 50%, path 3, diagnostic trace/test/headphone overrides, and per-run menu overrides. Their rows and documentation are present, but the defaults were chosen by ear on one setup and are not supported by the measurements required by the project’s switch rules. The menu defaults are volume 100%, sync 0, headphones All sound at 80%, and class-dependent Controller only or Controller + TV.
Reviewed:
e76e344e6aagainsta104182b40: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the commit and diff statistics, controller_speaker.cpp, audio_source.c and audio_source.h. Read the changed audio, SDL, rumble, menu, build and interface hunks and relevant mixer queue and endpoint code; skimmed the switch tables and test coverage. I did not read every changed code file or test in full, nor all translations. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Blocking (to change before merge)
Suggestions (the author may take or leave)
Testing: Read-only review; no code, scripts, builds or tests were run. The author reports six smoke checks passing on head, with parallel test failures attributed to Windows file locks or reproduced on main; plain USB and Linux runs are still outstanding.
Overlaps and merge order: The description identifies #405 as the merged RenHDrum endpoint dependency and #1433 as related headphone processing. No open-PR overlap search was possible in the closed network.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -1303,6 +1417,7 @@ static void apply(const Cmd *k) { /* (with the lock held) */break;case OP_VOICE_APPEND:if (v->pending_wb > 0) v->pending_wb--;if (k->i0 >= 0) v->source = k->i0; /* (an asset's start; a buffer that continues a streamed one keeps its class) */Could the class travel with the queued buffer and become active when that buffer starts? If two different assets are queued on one voice, appending the second currently changes the routing of the first, potentially removing the wrong sound from the TV.
@ -1505,6 +1624,7 @@ HLE(_ZN2nn5audio17OpenAudioRendererEPNS0_19AudioRendererHandleEPNS_2os11SystemEvhos_system_event_init(renderer_event, 1);au_lock();au_unlock();hos_audio_source_load();This loads and decompresses the sound archives even without a usable controller speaker, and buffer appends also scan for headers. Please avoid or defer that work where possible and measure startup and frame-time cost against the base, including a no-controller setup.
@ -0,0 +223,4 @@float *f = ring[(unsigned)(w + i) & (RING - 1)];f[0] = f[1] = shape_sample(mono[i] * scale);}InterlockedExchange(&ring_w, w + frames);These signed free-running counters overflow after about 12.4 hours at 48 kHz. Please use unsigned wrap-safe arithmetic for both counters and their differences, with a test crossing the wrap boundary.
@ -0,0 +422,4 @@stream = own, stream_pad = pad;InterlockedExchange(&riding, own == NULL);InterlockedExchange(&route_all, all_route());pad_route(pad, to), stream_to = to;Please handle a rejected output report before marking this route active. An endpoint can open while the pad or bridge rejects the report; Controller-only sounds are then removed from the TV even though the requested speaker route was not established.
@fix
I changed this pull request where the review's points could be done here: the new head is
40d7234735.Changed
Left for the author
a104182b40, including a no-controller setup; measurements require running the game.a104182b40, including without a controller, because the game cannot be run here.Nothing was built or run: check the change. It will be reviewed again.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@rebase
Recommendation: Request changes. The checked-out head still has the defects identified in the previous review, and controller selection can overlook a usable wired DualSense. The reported fix commit is not available in this checkout, so its changes cannot be verified.
The feature sends selected game sounds to a DualSense speaker and can route the full mix to its headphone jack. The reported dongle test shows it working on one Windows setup, but the current head has unresolved routing and long-session defects, and adds unmeasured work to ordinary setups.
Does it help: Unproven overall. The author reports successful speaker, headphone and shared vibration playback through DS5Dongle, but provides no base-versus-PR startup, frame-time or memory measurements. Plain USB and Linux runs remain outstanding.
Other systems: Linux, Steam Deck, plain USB on Windows, multiple controllers and other Tier 1 hardware remain unverified. RenHDrum shares the endpoint; the reported dongle run covers that combination. With multiple DualSense controllers, selection can miss a usable wired pad or pair a pad with another pad's endpoint.
Switches: The PR adds HOS_AUDIO_SOURCE and HOS_PAD_SPEAKER controls, HPF, limiter, low-latency and TV-delay controls, gain 4, buffer 20 ms, ocarina rumble 50%, path 3, diagnostic trace, test and headphone overrides, and per-run menu overrides. Feature processing defaults on; diagnostics default off. The menu defaults to volume 100%, sync 0 ms, headphones All sound at 80%, and class-dependent Controller only or Controller + TV. Rows and documentation are present, but one setup's listening test does not establish the defaults across supported setups or measure their costs.
Reviewed:
e76e344e6aagainsta104182b40: This is a re-review ofe76e344e6aagainsta104182b40, the same head as review 1899. The comment claims fixes at40d7234735, but that object is unavailable locally; none of those fixes can be assessed. Read AGENTS.md, CONTRIBUTING.md, the PR template, the commit, audio routing and controller-selection changes. Skimmed other menu, build and interface hunks; did not read every changed code file or test in full, all translations, or all generated material. docs/review-checklist.md and the adjacent Tooling checkout are absent.; nothing run (a code review).Checked and fine:
Blocking (to change before merge)
Questions
Testing: No code, scripts, builds or tests were run. The author's recorded Windows results were considered; the requested plain USB and Linux tests have not been reported.
Overlaps and merge order: The PR identifies #405 for the shared vibration endpoint and #1433 for related headphone audio. No duplicate was established from the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -498,0 +500,4 @@void *dualsense = NULL;for (int i = 0; i < MAX_PADS && !dualsense; i++) {const char *name = pads[i].gc ? hos_sdl_pad_name(pads[i].gc) : NULL;if (name && pads[i].vendor == 0x054c && (strstr(name, "DualSense") || strstr(name, "PS5"))) dualsense = pads[i].gc;Could selection prefer an eligible wired DualSense? If a Bluetooth DualSense occupies an earlier slot, this stops there and never tries the wired pad, so its speaker remains unused.
@ -0,0 +371,4 @@const int n = hos_sdl_output_count();for (int i = 0; i < n; i++) {if (!hos_sdl_output_info(i, id, (int)sizeof id, name, (int)sizeof name)) continue;if (!strstr(name, "DualSense") && !strstr(name, "Wireless Controller")) continue;Could the endpoint be matched to the selected pad? With two DualSense controllers, the first matching endpoint can belong to the other pad, while the output report is sent to the selected one.
@fix
I changed this pull request where the review's points could be done here (the rest needs runs, measurements or decisions): the new head is
1b75d6dc60. I rebased it ontomain(3df5c13ed2).Conflicts resolved
Changed
Already done
40d7234735, and its fixes and focused tests are present.Left for the author
Nothing was built or run: check the change. It will be reviewed again.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
40d72347351b75d6dc60Recommendation: Request changes. Controller audio can fail for players whose game path contains characters outside the Windows system code page. The endpoint can also be paired with the wrong controller, and the feature’s runtime and loading costs remain unmeasured.
The feature routes selected sounds to a DualSense speaker and the full mix to its headphone jack. The reported dongle run shows it working on one Windows setup; the current head adds the previously reported queue, report-failure and counter fixes, and prefers a wired pad. The previously identified multiple-controller endpoint mismatch remains unresolved.
Does it help: Unproven overall. The author reports successful speaker, headphone and shared-vibration playback through DS5Dongle, but provides no base-versus-PR startup, frame-time or memory measurements. The latest fixes have not been run.
Other systems: Plain USB on Windows, Linux, Steam Deck, other affected Tier 1 hardware and two-controller operation remain unverified. The author reports the shared RenHDrum stream working through the dongle.
Switches: The PR adds HOS_AUDIO_SOURCE and HOS_PAD_SPEAKER, HPF, limiter, low-latency and TV-delay controls, all on by default; gain 4, buffer 20 ms, ocarina rumble 50% and path 3; diagnostic trace, test and headphone overrides; and per-run menu overrides. The menu defaults to volume 100%, sync 0 ms, headphones All sound at 80%, and class-dependent Controller only or Controller + TV. Rows and documentation are present, but listening on one setup and the missing cost measurements do not establish the defaults for supported setups.
Reviewed:
1b75d6dc60against3df5c13ed2: Re-review of1b75d6dcagainst3df5c13e: read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the commit list, audio_source.c and the main controller-speaker and mixer changes; inspected the endpoint, queue, SDL, vibration, menu, interface, build and relevant test hunks. Skimmed translations and recorded runs. I did not read every changed code file or test in full. docs/review-checklist.md and the adjacent Tooling checkout are absent.; nothing run (a code review).Checked and fine:
Blocking (to change before merge)
Testing: No code, scripts, builds or tests were run. The author’s recorded Windows results were considered; the current head’s fixes, plain USB and Linux runs remain unverified.
Overlaps and merge order: The PR identifies #405 for the shared vibration endpoint and #1433 for related headphone audio. No duplicate was established from the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -0,0 +111,4 @@char pattern[MAX_PATH], path[MAX_PATH], archive[MAX_PATH];snprintf(pattern, sizeof pattern, "%s/Sound/Resource/*.bars.zs", hos_romfs_dir);WIN32_FIND_DATAA fd;HANDLE find = FindFirstFileA(pattern, &fd);This uses a narrow Windows path for the UTF-8 RomFS directory; the fopen calls above do too. An install path outside the system code page can leave every sound unclassified even though the speaker opens. Please use UTF-8-safe directory and file APIs and cover a non-ASCII path.
@fix
I changed this pull request where the review's points could be done here (the rest needs runs, measurements or decisions): the new head is
ae2276df20.Changed
Already done
136f89efand1b75d6dc.Left for the author
3df5c13ewith an active speaker and with no controller, then reduce or move the work if its cost is material.Nothing was built or run: check the change. It will be reviewed again.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Recommendation: Request changes. The previously identified endpoint mismatch and unmeasured audio-loading and runtime costs remain unresolved. The UTF-8 archive-path fix is present, but has not been run.
The feature sends selected sounds to a DualSense speaker and can send the full mix to its headphone jack. The reported dongle run demonstrates it on one Windows setup; the gain is a new audio option, at the cost of added routing and mixing complexity and costs that have not yet been measured. Since review 1906, archive reads and enumeration use Windows wide APIs, with a non-ASCII path added to the fixture. The earlier endpoint-matching and measurement points remain open; they are not repeated as new comments.
Does it help: Unproven overall. The author reports successful speaker, headphone and shared vibration playback through DS5Dongle, with 0 underruns and 0 trims in the reported run. There are no base-versus-head frame-time, startup-time or memory numbers for the active and no-controller paths.
Other systems: Plain USB on Windows, Linux, Steam Deck and two-controller routing remain unverified. The shared RenHDrum stream worked in the reported dongle run. The endpoint selection still cannot reliably associate an audio endpoint with the selected controller.
Switches: HOS_AUDIO_SOURCE, HOS_PAD_SPEAKER, HPF, limiter, low latency and TV delay default on; gain defaults to 4, buffer to 20 ms, ocarina rumble to 50% and path to 3. Trace and test default off; the headphones override is unset. Volume, headphone mode and the twelve class overrides default to their menu settings. The menu defaults to volume 100%, sync 0 ms, headphones All sound at 80%, and class-dependent Controller only or Controller + TV. Rows and documentation are present; one listening setup and the missing cost measurements do not establish that these defaults are right across supported setups.
Reviewed:
ae2276df20against3df5c13ed2: Re-review ofae2276dfagainst3df5c13eand review 1906. Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, commit list, audio_source.c, the latest UTF-8 diff and its fixture changes; inspected the mixer, endpoint, routing, menu, interface, build and switch changes. Skimmed translations, tests and recorded runs. I did not read every changed code file or test in full. docs/review-checklist.md and ../Tooling/AGENTS.md are absent.; nothing run (a code review).Checked and fine:
Testing: No code, scripts, builds or tests were run. The author's recorded Windows results were considered; the latest fixes, plain USB and Linux runs remain unverified.
Overlaps and merge order: The PR identifies #405 for the shared vibration endpoint and #1433 for related headphone audio. No duplicate was established from the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@fix
I didn't change this pull request: what the review asks needs the author (runs, measurements or decisions, which can't be done here).
Left for the author
Nothing was pushed.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@fix
I changed this pull request where the review's points could be done here (the rest needs runs, measurements or decisions): the new head is
bac384e567.Changed
Left for the author
Nothing was built or run: check the change. It will be reviewed again.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Recommendation: Request changes. The new Windows matching can still send audio and vibration to the wrong DualSense because the per-pad cache keeps a boolean while the endpoint token is shared. The change also disables wired RenHDrum on Linux and can play buffered headphone audio through the controller speaker after unplugging.
The feature adds per-sound DualSense speaker routing, full-game audio through the controller’s headphone jack, and a shared stream with RenHDrum. Since review 1913, the PR matches Windows devices by container and rejects ambiguous endpoint names. That improves the speaker’s direct lookup, but the cached vibration path can lose the association. The existing measurement request remains open.
Does it help: Unproven on
bac384e56. The earlier Windows 10 DS5Dongle run demonstrated speaker, headphone and shared vibration playback, with 0 underruns, 0 trims and 20.0 ms buffered on average. It predates the new matcher. There are no matched base-versus-head startup, frame-time or memory measurements with controller audio active and with no controller. Archive loading is now deferred, but the ordinary mixer still does per-sample routing work when the speaker is inactive.Other systems: The matcher changes the existing wired RenHDrum path even with HOS_PAD_SPEAKER=0. Linux and Steam Deck fall back from that path. Plain USB, DS5Dongle and two-controller operation need current-head Windows runs. The audio mixer changes also reach players using ordinary desktop output, including the 5.1 path. The renderer callback structs, save handling and cache formats are unchanged.
Switches: HOS_AUDIO_SOURCE, HOS_PAD_SPEAKER_HPF, HOS_PAD_SPEAKER_LIMITER, HOS_PAD_SPEAKER_LOW_LATENCY and HOS_PAD_SPEAKER_TV_DELAY default on. HOS_PAD_SPEAKER defaults to automatic, with 0 disabling and 1 forcing it. GAIN defaults to 4, BUFFER_MS to 20 ms or 40 ms with low latency off, OCARINA_RUMBLE to 50%, and PATH to 3. AUDIO_SOURCE_TRACE and PAD_SPEAKER_TEST default off, and PAD_SPEAKER_HEADPHONES defaults to detection. The volume, headphone-mode and twelve sound-class overrides default to the saved menu values. The menu defaults are speaker volume 100%, sync 0 ms, headphones All sound at 80%, and class routes {1, 2, 1, 2, 1, 2, 2, 1, 1, 1, 1, 1} in menu order, where 1 is Controller only and 2 is Controller + TV. The low-latency path also sets and clears the existing SDL_AUDIO_DEVICE_SAMPLE_FRAMES hint. The rows and docs are present. The listening run does not establish the defaults required by the switch rules, and the player overrides duplicate saved settings.
Reviewed:
bac384e567against3df5c13ed2: Reviewedbac384e567against3df5c13ed2and compared it with review 1913. Read AGENTS.md, CONTRIBUTING.md, the Forgejo template, standards, commit messages, the archive reader and classifier, and the archive test sources. Inspected the speaker, SDL endpoint enumeration and open, pad selection, RenHDrum ownership, mixer, menu, build, shutdown and fixture changes with their relevant callers. Skimmed translations and recorded runs. Existing modified files and some fixtures were read in excerpts, without a full-file pass. The standalone review checklist and adjacent Tooling rules were absent.; nothing run (a code review).Checked and fine:
Blocking (to change before merge)
host/rumble_renhdrum.c:363The stream opens with the last globally looked-up token. If pad A finds its endpoint but fails to open, pad B can overwrite the token and later lose ownership. A can then retry using its cached positive result and open B’s endpoint. The speaker can ride that stream while its HID report goes to A. Cache the actual token per pad and pass it into the open call, or resolve it for that pad at open time. Cover failed open and ownership handoff with two pads.host/hos_sdl.c:726The non-Windows branch now rejects every endpoint for existing wired RenHDrum as well as for the new speaker. A Linux player whose four-channel endpoint was selectable on the base loses wired haptics even with controller speaker disabled. Preserve the existing vibration backend in this change or provide equivalent Linux matching. Keep the new speaker disabled wherever the owner cannot be established reliably.host/pad_speaker.c:427Changing from All sound headphones to the speaker keeps the ring’s queued samples and primed state. Unplugging during music can send the buffered full-game mix through the speaker before class routing takes over. Quiesce the producer and consumer and clear queued samples and filter history at the route change. The fixture currently clears the ring manually, so it should exercise the production transition instead.host/pad_speaker.c:469The requested 256-frame SDL3 hint is overwritten by the shared opener’s 480-frame default when the environment variable is unset. If the player set the variable, the speaker still replaces its hint and clears it afterward. Pass the buffer request to the shared opener, respect an explicit override, and verify what SDL actually opens.Suggestions (the author may take or leave)
host/rumble_renhdrum.c:363: This opens the last globally looked-up token, while the poll caches only a per-pad boolean. After a failed open and another pad’s lookup, the first pad can retry on the second pad’s endpoint. Pass the matched token with the pad and test the ownership handoff.Testing: Read-only review. git diff --check returned no findings. No build, script, test or game run was performed. The reported smoke, lint, suite and in-game results cover earlier revisions. Current-head Windows and Linux builds, the UTF-8 archive fixture on Windows, Tier 1 fallback checks and CI remain unverified.
Overlaps and merge order: #405 is in the base and supplies the vibration path this PR changes. The port already accounts for #1774 and #1802. #1433 covers related headphone audio and has no demonstrated merge-order dependency.
Automated code review by BeanBot (gpt-6.2-sol), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -628,0 +723,4 @@#else(void)pad;return -1;#endifThis also disables existing wired RenHDrum on Linux, even with HOS_PAD_SPEAKER=0. Preserve the existing vibration path or provide equivalent Linux matching. Require reliable ownership for the new speaker.
@ -0,0 +424,4 @@InterlockedExchange(&stream_on, 0);InterlockedExchange(&route_all, all_route()); /* (plugged, pulled, or the menu's rows moved: the pad told again) */if (!pad_route(pad, to)) { close_endpoint("output report rejected"); return; }stream_to = to;Unplugging in All sound leaves queued full-mix audio in the ring when the speaker takes over. Synchronize and clear the old route’s buffered audio before re-enabling playback. Test the switch with a populated ring.
@ -0,0 +466,4 @@if (device < 0) {if (!said++) hos_log("pad speaker: no matching four-channel audio endpoint for the DualSense");return;}The shared SDL3 opener sets 480 frames when the environment variable is unset, overwriting this 256-frame hint. Pass the request through the opener and preserve any explicit override.
@fix
I changed this pull request where the review's points could be done here (the rest needs runs, measurements or decisions): the new head is
3640f7ba94.Changed
Left for the author
Nothing was built or run: check the change. It will be reviewed again.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Recommendation: Request changes. Controller-routed sounds bypass the game's background mute, and the new endpoint matcher disables existing wired RenHDrum on Linux even with the speaker feature off. The Windows dongle run demonstrates the feature on an earlier build, while the current head's routing and cost remain unverified.
Adds per-sound DualSense speaker routing, full-game headphone output, and a shared stream with vibration. Since review 1935, the endpoint token is cached per pad, route changes clear the ring and reopen the SDL stream, and both openers receive the requested buffer size. These changes address the shared-token bug and the queued-audio case in the new unplug fixture. The shared reopen still needs to verify endpoint ownership.
Does it help: Unproven on
3640f7ba94. The earlier Windows 10 DS5Dongle run reported working speaker, headphone and shared vibration playback, with 0 underruns, 0 trims and 20.0 ms buffered on average. There are no matched, interleaved base and head runs for startup, frame times, RAM or audio dropouts with the feature active, off, and with no controller. The first active append still loads and decompresses archives under the mixer lock, and the inactive mixer still does per-sample routing work.Other systems: The mixer changes affect ordinary desktop output and 5.1. The headphone fixture checks the 5.1 center downmix. Linux and Steam Deck lose access to wired RenHDrum where the base could open a four-channel endpoint. Plain USB, DS5Dongle and two-pad Windows operation need current-head runs. The renderer callback structs, saves and cache formats are untouched. The build adds one host source to the existing zstd path.
Switches: HOS_AUDIO_SOURCE and HOS_PAD_SPEAKER_HPF, LIMITER, LOW_LATENCY and TV_DELAY default on. HOS_PAD_SPEAKER defaults to automatic, with 0 disabling and 1 forcing the route. GAIN defaults to 4, BUFFER_MS to 20 ms or 40 ms with low latency off, OCARINA_RUMBLE to 50%, and PATH to 3 on the standalone stream. HOS_AUDIO_SOURCE_TRACE and HOS_PAD_SPEAKER_TEST default off, and HOS_PAD_SPEAKER_HEADPHONES defaults to detection. The HOS_PAD_SPEAKER_ volume, headphone mode and twelve class overrides inherit saved settings. Menu defaults are speaker 100%, sync 0 ms, headphones All sound at 80%, and class routes {1, 2, 1, 2, 1, 2, 2, 1, 1, 1, 1, 1}, where 1 is Controller only and 2 is Controller + TV. SDL_AUDIO_DEVICE_SAMPLE_FRAMES keeps its environment override. Otherwise the shared stream now requests 256 frames by default even with speaker routing disabled. The switches have table rows and docs. The listening run does not establish the defaults across supported setups, and the player environment overrides duplicate saved settings without an A/B or rollback purpose stated in the PR.
Reviewed:
3640f7ba94against3df5c13ed2: Reviewed3640f7ba94against3df5c13ed2and compared the latest fixes withbac384e567and review 1935. Read AGENTS.md, CONTRIBUTING.md, the Forgejo template, standards, the guide screenshot rules, the commit messages, both audio_source files, both pad_speaker files, and the controller_speaker menu module. Read the changed hunks and relevant surrounding code in the existing mixer, SDL, vibration, menu, renderer, shutdown, build and fixture files. Existing modified files were read in excerpts. Skimmed translations, recorded runs and screenshot manifest entries. The standalone review checklist and adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Blocking (to change before merge)
Suggestions (the author may take or leave)
Testing: Read-only review. The author reports six smoke passes, a lint invocation error also seen on main, and 283 test passes with 59 failures on the earlier Windows checkout. The author reports that 29 failures passed alone and 30 reproduced on main. No current-head build, CI result or in-game run was supplied. Verify the UTF-8 fixture on Windows and exercise speaker, headphone and shared vibration routing on plain USB, DS5Dongle and two-controller setups. Compare Linux and Steam Deck vibration with the base.
Overlaps and merge order: #405 supplies the shared vibration endpoint and is already in the base. #1774 and #1802 are incorporated in the rebase. #1433 covers binaural headphone processing, a separate feature. No pending merge order was established.
Automated code review by BeanBot (gpt-6.2-sol), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -394,3 +395,3 @@/// The model's page for each MenuTab: the strip's tabs, then the pages a row opensconst char* const kTabIds[TAB_PAGE + 1] = {"graphics", "audio", "gameplay", "controls", "nfc","mods", "debug", "motion", "fps_details", "controls_page"};"mods", "debug", "motion", "controller_speaker", "fps_details",This changes a recorded guide screenshot input. Complete the required source review and update the recorded revision and hashes, recapturing if the pictured menu differs.
@ -7721,0 +7722,4 @@if (id == HOS_OPT_PAD_SPEAKER_SYNC) return opts.pad_speaker_sync;if (id == HOS_OPT_PAD_SPEAKER_HEADPHONES) return opts.pad_speaker_headphones;if (id == HOS_OPT_PAD_SPEAKER_HEADPHONE_VOLUME) return opts.pad_speaker_headphone_volume;if (id >= HOS_OPT_PAD_SPEAKER_CLASS && id < HOS_OPT_PAD_SPEAKER_CLASS + 9) // (HOS_OPT_PAD_SPEAKER_OF: 63 to 71, then 73 on)The option IDs in this comment are stale. The class IDs now form a contiguous range from 101 through 112.
@ -628,0 +722,4 @@return matches == 1 ? token : -1;#else(void)pad;return -1;Returning -1 here now also disables base's wired RenHDrum path on Linux, even with HOS_PAD_SPEAKER=0. Preserve the existing vibration path separately from verified speaker sharing, or provide a verified Linux match.
@ -1104,0 +1215,4 @@int hos_sdl_pad_headphones(void *pad) {static void *dev, *dev_pad;static int failed, last = -2;if (!f.HidReadTimeout || !f.HidOpenPath || !f.HidClose || !pad) return -1;The cached HID reader survives pad removal. SDL can reuse a controller pointer on reconnect, leaving the new pad with stale jack status or a latched read-open failure. Close and reset the reader as part of the pad's removal.
@ -600,2 +710,4 @@for (int i = 0; i < MAX_VOICES; i++)if (voices[i].used) render_voice(&voices[i]);tv_delay_frame();if (speaker_on) hos_pad_speaker_write(speaker_frame, FRAME); /* (every frame, silence too: the pad's stream runs on) */This write bypasses the gain and background mute applied after render_frame. Alt-tab with Mute in background on and a Controller-only sound can still play. Apply the existing mute and gain policy to this output and cover it in the mixer fixture.
@ -357,0 +383,4 @@AcquireSRWLockExclusive(&life);if (usb_stream) {hos_sdl_audio_close(usb_stream);usb_stream = hos_sdl_audio_open((unsigned)usb_token, 48000, 4, 0, hos_pad_speaker_frames(), usb_pull, NULL);Revalidate ownership before reopening. If another audio endpoint takes the old endpoint's SDL name before the next liveness check, this cached token can open the replacement while output reports still go to usb_pad.
@fix
I didn't change this pull request: what the review asks needs the author (runs, measurements or decisions, which can't be done here).
Left for the author
Nothing was pushed.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.