audio: play pad speaker ports on the DualSense speaker #868
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!868
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/868/head"
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?
@Cosmo on GitHub · 2026-09-27 16:46 UTC · original
Cosmo:dualsense-speaker→main· +499 −105 · 5 files · 2 commits · merged 2026-09-28 16:00 UTCAstro's Playroom (PPSA01325) plays sounds through the pad speaker audio port. Until now, these played on the main output.
Pad speaker ports now play on the DualSense speaker when the controller is connected over USB. The speaker is switched on with the output report values the Linux hid-playstation driver uses, and switched back when no pad speaker port plays anymore. Without a DualSense audio device (unplugged, Bluetooth, or another controller is active), the port plays on the main output as before.
Known limitation: headphones plugged into the controller are not detected. These sounds stay on the controller speaker, and the headphones are muted.
This also stops the previous DualSense's rumble when another DualSense becomes active. Before, its last rumble was sent again. This is covered by a unit test only.
Testing
pad_hapticstests.AI use
Research, implementation and tests were done with Claude Code at my direction.
I reviewed the code, and tested it as described above.
@coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · edited 2026-09-28 15:18 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
435ea7fb-1f4f-40f3-92e9-3bcc2d3c69cf📥 Commits
Reviewing files that changed from the base of the PR and between
3cca4ac288and79e6d1983f.📒 Files selected for processing (5)
.github/workflows/build.ymlsrc/libs/audio.cppsrc/libs/dualSenseHaptics.cppsrc/libs/dualSenseHaptics.htests/PadHapticsTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
📝 Walkthrough
Walkthrough
DualSense haptics streams now support speaker audio routing and report queued playback duration. Audio output attempts haptics for ports that have a haptics stream, uses SDL when haptics do not queue audio, and applies blocking timing to queued speaker audio. Tests cover speaker routing, controller and endpoint changes, and rumble behavior when switching controllers.
Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Feature
Merge Risk: ⚪ Minimal · up to
79e6dNo actionable issue was established that would prevent this DualSense speaker-routing change from merging after normal checks.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
79e6dController selection and main-output fallback limit the exposure, but a failed routing-restore command can leave a controller’s headphone routing in an uncertain state after playback ends.
Retained concerns
Security review details
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 6.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 4 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · edited 2026-09-28 15:09 UTC
On
src/libs/dualSenseHaptics.cppline 69 (outdated):🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not accept speaker audio when the routing report fails.
SDL_SendGamepadEffectcan return false, butRouteSpeakerdiscards that result. If the report fails while the audio stream accepts PCM,Queuereturns a nonzero duration andsrc/libs/audio.cppskips SDL fallback. The speaker audio can then be silent. Propagate routing failure toQueueand return zero, or establish another working route before accepting the audio. (wiki.libsdl.org)✅ Addressed in commit
79e6d19@coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · edited 2026-09-28 15:09 UTC
On
src/libs/dualSenseHaptics.cppline 172 (outdated):🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 11551
Update speaker routing when the controller changes.
When an existing speaker stream queues audio for a different PS5 controller,
FindDevice()can return the same device. In that case,Queuedoes not close and reopen the stream, andSelectSpeaker(controller)is not called.SelectControlleronly updates rumble state. The new controller can therefore remain unrouted while PCM is submitted.Track the last routed controller per stream and call
SelectSpeaker(controller)when it changes.Suggested fix
✅ Addressed in commit
79e6d19@coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · edited 2026-09-28 15:09 UTC
On
src/libs/dualSenseHaptics.cppline 172 (outdated):🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Match the audio endpoint to the selected controller.
FindDevice()chooses the first quad-channel device named “DualSense,” while this line routes thecontrollerargument. With two USB DualSense controllers, selecting the second pad can send PCM to the first pad’s endpoint and route the second pad’s speaker. Match the endpoint and controller before accepting speaker audio; otherwise, return zero so the pad-speaker port can use SDL fallback.✅ Addressed in commit
79e6d19@coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · reviewed
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
c0603d43-6c74-4ab2-8dc1-cb41f1daff37📥 Commits
Reviewing files that changed from the base of the PR and between
421684e75fand3cca4ac288.📒 Files selected for processing (4)
src/libs/audio.cppsrc/libs/dualSenseHaptics.cppsrc/libs/dualSenseHaptics.htests/PadHapticsTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@Cosmo on GitHub · 2026-09-27 17:05 UTC · original
The coderabbit findings get interesting, when we have multiplayer / multi-controller support on main.
@Cosmo on GitHub · 2026-09-28 14:19 UTC · original
This video demonstrates this PR's feature:
https://github.com/user-attachments/assets/3e8a3c4b-ab79-4d2c-89a5-9a1fe4f777e9
@Nmzik on GitHub · 2026-09-28 15:08 UTC · original
@Cosmo Please re-check. CodeRabbit findings have been fixed where possible.
@Cosmo on GitHub · 2026-09-28 15:57 UTC · original
Works great, thanks!
@Rool-IO on GitHub · 2026-09-28 16:26 UTC · original
Thank you so very much ! Full Dualsense experience now possible, verified in Playroom and AstroBot :)