audio: play pad speaker ports on the DualSense speaker #868

Manually merged
github merged 2 commits from gh-pr/868/head into gh-pr/868/base 2026-11-26 09:35:34 +00:00
Owner

@⁠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 UTC

Astro'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

  • Windows build and pad_haptics tests.
  • Astro's Playroom with a DualSense over USB: the sounds play on the controller speaker, move to the PC speakers when the cable is unplugged, and return when it is plugged back in.
  • Earbuds in the controller jack: the sounds stay on the controller speaker, and the earbuds are silent.
  • Xbox controller active with the DualSense plugged in: the sounds play on the PC speakers. After disconnecting the Xbox controller, they move to the DualSense.
  • DualSense over Bluetooth: the sounds play on the PC speakers.

AI use

Research, implementation and tests were done with Claude Code at my direction.
I reviewed the code, and tested it as described above.

**@⁠Cosmo** on GitHub · 2026-09-27 16:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868) `Cosmo:dualsense-speaker` → `main` · +499 −105 · 5 files · 2 commits · merged 2026-09-28 16:00 UTC Astro'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 - Windows build and `pad_haptics` tests. - Astro's Playroom with a DualSense over USB: the sounds play on the controller speaker, move to the PC speakers when the cable is unplugged, and return when it is plugged back in. - Earbuds in the controller jack: the sounds stay on the controller speaker, and the earbuds are silent. - Xbox controller active with the DualSense plugged in: the sounds play on the PC speakers. After disconnecting the Xbox controller, they move to the DualSense. - DualSense over Bluetooth: the sounds play on the PC speakers. ## AI use Research, implementation and tests were done with Claude Code at my direction. I reviewed the code, and tested it as described above.
Route the right channel to the speaker with the audio-control values the Linux hid-playstation
driver uses without headphones, and fall back to the main output while no DualSense audio device
is active. Also stop the previous DualSense's rumble when another DualSense becomes active.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:35:33 +00:00
github manually merged commit 79e6d1983f into gh-pr/868/base 2026-11-26 09:35:34 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · edited 2026-09-28 15:18 UTC

Review in Change Stack →

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 3cca4ac288 and 79e6d1983f.

📒 Files selected for processing (5)
  • .github/workflows/build.yml
  • src/libs/audio.cpp
  • src/libs/dualSenseHaptics.cpp
  • src/libs/dualSenseHaptics.h
  • tests/PadHapticsTests.cpp

Included 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: nmzik

Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to 79e6d

No 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 79e6d

Controller 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

  • Low · security · inferred: A failed headphone-restore report on controller switch or final stream close is not retried: routing ownership is cleared even though the controller may remain in speaker mode with headphones muted.
Security review details

Security Blast Radius

  • inferred — The changed output path affects locally connected controller audio, not a service or shared data store. Selection rejects multiple DualSenses or multiple matching endpoints, limiting—but not proving—the intended device association.

Security Findings and Attack Paths

  • inferred — If headphone restoration fails after speaker playback, tracked ownership is discarded. Other audio using that controller could then encounter unintended speaker routing or muted headphones; the hardware state after a failed report has not been established.

Trust Boundaries and Controls

  • observed — Game audio reaches the controller only after active-controller, connection and endpoint checks. Rejected or failed controller playback returns zero so a pad-speaker port can use its main-output stream.

Resilience and Maintainability Implications

  • observed — Failed speaker setup is not counted as an active stream, and controller changes close the prior stream before refreshing the device. These controls do not resolve a failed headphone-restore report during cleanup.

Hardening Proposals

  • proposed — Retain or retry routing ownership when the headphone-restore report fails, and exercise failure specifically during switch, final close and shutdown.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: routing pad speaker audio ports to the DualSense speaker.
Description check ✅ Passed The description directly explains DualSense speaker routing, fallback behavior, limitations, rumble handling, and testing for the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
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 help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-27 16:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868#issuecomment-5857828907) · edited 2026-09-28 15:18 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/868"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> Navigate logical layers of code changes, visualize relationships, and explore their blast radius. <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `435ea7fb-1f4f-40f3-92e9-3bcc2d3c69cf` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 3cca4ac288db7651314f6c93d50b443710414ef4 and 79e6d1983ff325bb9e4d8dd53754abcf7b627a72. </details> <details> <summary>📒 Files selected for processing (5)</summary> * `.github/workflows/build.yml` * `src/libs/audio.cpp` * `src/libs/dualSenseHaptics.cpp` * `src/libs/dualSenseHaptics.h` * `tests/PadHapticsTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## 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:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"79e6d1983ff325bb9e4d8dd53754abcf7b627a72" --> **Change:** Feature <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `79e6d` <!-- final_review_risk_coverage:{"sourceCommitId":"79e6d1983ff325bb9e4d8dd53754abcf7b627a72","coveredCommitId":"79e6d1983ff325bb9e4d8dd53754abcf7b627a72","kind":"reviewed"} --> No actionable issue was established that would prevent this DualSense speaker-routing change from merging after normal checks. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🔵 Low_ · up to `79e6d` Controller 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** - **Low · security · inferred:** A failed headphone-restore report on controller switch or final stream close is not retried: routing ownership is cleared even though the controller may remain in speaker mode with headphones muted. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The changed output path affects locally connected controller audio, not a service or shared data store. Selection rejects multiple DualSenses or multiple matching endpoints, limiting—but not proving—the intended device association. **Security Findings and Attack Paths** - _inferred_ — If headphone restoration fails after speaker playback, tracked ownership is discarded. Other audio using that controller could then encounter unintended speaker routing or muted headphones; the hardware state after a failed report has not been established. **Trust Boundaries and Controls** - _observed_ — Game audio reaches the controller only after active-controller, connection and endpoint checks. Rejected or failed controller playback returns zero so a pad-speaker port can use its main-output stream. **Resilience and Maintainability Implications** - _observed_ — Failed speaker setup is not counted as an active stream, and controller changes close the prior stream before refreshing the device. These controls do not resolve a failed headphone-restore report during cleanup. **Hardening Proposals** - _proposed_ — Retain or retry routing ownership when the headphone-restore report fails, and exercise failure specifically during switch, final close and shutdown. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | 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… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly identifies the main change: routing pad speaker audio ports to the DualSense speaker. | | Description check | ✅ Passed | The description directly explains DualSense speaker routing, fallback behavior, limitations, rumble handling, and testing for the changeset. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> <details> <summary>Full details: Docstring Coverage</summary> **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.) </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=868)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · edited 2026-09-28 15:09 UTC
On src/libs/dualSenseHaptics.cpp line 69 (outdated):

@@ -42,14 +45,42 @@ void ApplyRumble() { // Caller holds g_mutex; no calls into Audio or Controller.
 
 void SelectController(int controller) {
 	if (g_controller != controller) {
-		g_haptics_until = 0;
+		g_haptics_until = g_rumble_until = 0;
 		ApplyRumble();
 		g_controller  = controller;
 		g_large_motor = g_small_motor = 0;
-		g_rumble_until                = 0;
 	}
 }
 
+void RouteSpeaker(int controller, bool speaker) { // Caller holds g_mutex.
+	// Route the right channel to the speaker and mute the headphones with the values Linux uses
+	// without headphones (output report 0x02). Plugged-in headphones are not checked.
+	std::array<uint8_t, 38> report {};
+	report[0] = 0x80; // Audio control valid
+	if (speaker) {
+		report[0] |= 0x20; // Speaker volume valid
+		report[1]  = 0x80; // Audio control 2 valid
+		report[5]  = 0x64; // Speaker volume
+		report[7]  = 0x30; // Output path: right channel to the speaker, headphones muted
+		report[37] = 0x02; // Speaker preamp +6 dB
+	}
+	SDL_LockJoysticks();
+	if (auto* pad = SDL_GetGamepadFromID(static_cast<SDL_JoystickID>(controller)); pad != nullptr) {
+		(void)SDL_SendGamepadEffect(pad, report.data(), static_cast<int>(report.size()));

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not accept speaker audio when the routing report fails.

SDL_SendGamepadEffect can return false, but RouteSpeaker discards that result. If the report fails while the audio stream accepts PCM, Queue returns a nonzero duration and src/libs/audio.cpp skips SDL fallback. The speaker audio can then be silent. Propagate routing failure to Queue and 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](https://github.com/KytyPS5/KytyPS5/pull/868#discussion_r4116141297) · edited 2026-09-28 15:09 UTC On `src/libs/dualSenseHaptics.cpp` line 69 (outdated): ```diff @@ -42,14 +45,42 @@ void ApplyRumble() { // Caller holds g_mutex; no calls into Audio or Controller. void SelectController(int controller) { if (g_controller != controller) { - g_haptics_until = 0; + g_haptics_until = g_rumble_until = 0; ApplyRumble(); g_controller = controller; g_large_motor = g_small_motor = 0; - g_rumble_until = 0; } } +void RouteSpeaker(int controller, bool speaker) { // Caller holds g_mutex. + // Route the right channel to the speaker and mute the headphones with the values Linux uses + // without headphones (output report 0x02). Plugged-in headphones are not checked. + std::array<uint8_t, 38> report {}; + report[0] = 0x80; // Audio control valid + if (speaker) { + report[0] |= 0x20; // Speaker volume valid + report[1] = 0x80; // Audio control 2 valid + report[5] = 0x64; // Speaker volume + report[7] = 0x30; // Output path: right channel to the speaker, headphones muted + report[37] = 0x02; // Speaker preamp +6 dB + } + SDL_LockJoysticks(); + if (auto* pad = SDL_GetGamepadFromID(static_cast<SDL_JoystickID>(controller)); pad != nullptr) { + (void)SDL_SendGamepadEffect(pad, report.data(), static_cast<int>(report.size())); ``` _🎯 Functional Correctness_ | _🟠 Major_ | _⚡ Quick win_ **Do not accept speaker audio when the routing report fails.** `SDL_SendGamepadEffect` can return false, but `RouteSpeaker` discards that result. If the report fails while the audio stream accepts PCM, `Queue` returns a nonzero duration and `src/libs/audio.cpp` skips SDL fallback. The speaker audio can then be silent. Propagate routing failure to `Queue` and return zero, or establish another working route before accepting the audio. ([wiki.libsdl.org](https://wiki.libsdl.org/SDL3/SDL_SendGamepadEffect?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:fe56ab208785c8482c789c19 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 79e6d19
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · edited 2026-09-28 15:09 UTC
On src/libs/dualSenseHaptics.cpp line 172 (outdated):

@@ -131,6 +167,10 @@ void Queue(Stream* stream, int controller, const void* data, uint32_t frames, ui
 					{
 						Common::LockGuard lock(g_mutex);
 						g_playback_streams++;
+						if (stream->speaker) {
+							g_speaker_streams++;
+							SelectSpeaker(controller);

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,260p' src/libs/dualSenseHaptics.cpp
sed -n '250,320p' tests/PadHapticsTests.cpp

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, Queue does not close and reopen the stream, and SelectSpeaker(controller) is not called. SelectController only 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
 struct Stream {
 	uint32_t           freq       = 0;
 	bool               speaker    = false;
+	int                speaker_controller = -1;
 	SDL_AudioStream*   sdl        = nullptr;
 	SDL_AudioDeviceID  device     = 0;
@@
 						if (stream->speaker) {
 							g_speaker_streams++;
 							SelectSpeaker(controller);
+							stream->speaker_controller = controller;
 						}
@@
 	if (stream->sdl == nullptr) {
 		return 0;
 	}
+	if (stream->speaker) {
+		Common::LockGuard lock(g_mutex);
+		if (stream->speaker_controller != controller) {
+			SelectSpeaker(controller);
+			stream->speaker_controller = controller;
+		}
+	}

✅ Addressed in commit 79e6d19

**@⁠coderabbitai[bot]** on GitHub · 2026-09-27 16:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868#discussion_r4116141301) · edited 2026-09-28 15:09 UTC On `src/libs/dualSenseHaptics.cpp` line 172 (outdated): ```diff @@ -131,6 +167,10 @@ void Queue(Stream* stream, int controller, const void* data, uint32_t frames, ui { Common::LockGuard lock(g_mutex); g_playback_streams++; + if (stream->speaker) { + g_speaker_streams++; + SelectSpeaker(controller); ``` _🎯 Functional Correctness_ | _🟠 Major_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '1,260p' src/libs/dualSenseHaptics.cpp sed -n '250,320p' tests/PadHapticsTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 11551 --- </details> **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, `Queue` does not close and reopen the stream, and `SelectSpeaker(controller)` is not called. `SelectController` only 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. <details> <summary>Suggested fix</summary> ```diff struct Stream { uint32_t freq = 0; bool speaker = false; + int speaker_controller = -1; SDL_AudioStream* sdl = nullptr; SDL_AudioDeviceID device = 0; @@ if (stream->speaker) { g_speaker_streams++; SelectSpeaker(controller); + stream->speaker_controller = controller; } @@ if (stream->sdl == nullptr) { return 0; } + if (stream->speaker) { + Common::LockGuard lock(g_mutex); + if (stream->speaker_controller != controller) { + SelectSpeaker(controller); + stream->speaker_controller = controller; + } + } ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:0995da5399913d39dfc03c85 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 79e6d19
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-27 16:50 UTC · original · edited 2026-09-28 15:09 UTC
On src/libs/dualSenseHaptics.cpp line 172 (outdated):

@@ -131,6 +167,10 @@ void Queue(Stream* stream, int controller, const void* data, uint32_t frames, ui
 					{
 						Common::LockGuard lock(g_mutex);
 						g_playback_streams++;
+						if (stream->speaker) {
+							g_speaker_streams++;
+							SelectSpeaker(controller);

🎯 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 the controller argument. 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](https://github.com/KytyPS5/KytyPS5/pull/868#discussion_r4116141304) · edited 2026-09-28 15:09 UTC On `src/libs/dualSenseHaptics.cpp` line 172 (outdated): ```diff @@ -131,6 +167,10 @@ void Queue(Stream* stream, int controller, const void* data, uint32_t frames, ui { Common::LockGuard lock(g_mutex); g_playback_streams++; + if (stream->speaker) { + g_speaker_streams++; + SelectSpeaker(controller); ``` _🎯 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 the `controller` argument. 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. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:66441718a63634634a62b978 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 79e6d19
Author
Owner

@⁠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 421684e75f and 3cca4ac288.

📒 Files selected for processing (4)
  • src/libs/audio.cpp
  • src/libs/dualSenseHaptics.cpp
  • src/libs/dualSenseHaptics.h
  • tests/PadHapticsTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-27 16:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868#pullrequestreview-5331213270) · **reviewed** **Actionable comments posted: 3** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `c0603d43-6c74-4ab2-8dc1-cb41f1daff37` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 421684e75f75e6d1a2c4b0817ca573a2e800f748 and 3cca4ac288db7651314f6c93d50b443710414ef4. </details> <details> <summary>📒 Files selected for processing (4)</summary> * `src/libs/audio.cpp` * `src/libs/dualSenseHaptics.cpp` * `src/libs/dualSenseHaptics.h` * `tests/PadHapticsTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠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-27 17:05 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868#issuecomment-5857940058) The coderabbit findings get interesting, when we have multiplayer / multi-controller support on main.
Author
Owner

@⁠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

**@⁠Cosmo** on GitHub · 2026-09-28 14:19 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868#issuecomment-5871843791) This video demonstrates this PR's feature: https://github.com/user-attachments/assets/3e8a3c4b-ab79-4d2c-89a5-9a1fe4f777e9
Author
Owner

@⁠Nmzik on GitHub · 2026-09-28 15:08 UTC · original

@⁠Cosmo Please re-check. CodeRabbit findings have been fixed where possible.

**@⁠Nmzik** on GitHub · 2026-09-28 15:08 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868#issuecomment-5872776804) @⁠Cosmo Please re-check. CodeRabbit findings have been fixed where possible.
Author
Owner

@⁠Cosmo on GitHub · 2026-09-28 15:57 UTC · original

Works great, thanks!

**@⁠Cosmo** on GitHub · 2026-09-28 15:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868#issuecomment-5873722517) Works great, thanks!
Author
Owner

@⁠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 :)

**@⁠Rool-IO** on GitHub · 2026-09-28 16:26 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/868#issuecomment-5874192687) Thank you so very much ! Full Dualsense experience now possible, verified in Playroom and AstroBot :)
This discussion has been locked. Commenting is limited to contributors.
No description provided.