Skip to content

fix(libSceAudioOut): match the sceAudioOutSetVolume flag bit to the channel it reads on 8-channel STD ports - #2093

Open
Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/28318
Open

Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/28318

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#28318, originally opened by Ducengarth.

Source commit: 470e97d1eded49e2246db1a09c4fed8e21deedcc. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


What

On an 8-channel STD port (sceAudioOutOpen format 6 or 7), sceAudioOutSetVolume with a flag that does not set the rear pairs symmetrically changes the wrong channel: a title that lowers channel 6 alone leaves it at full level and overwrites the gain of channel 4 with an array entry it never flagged.

The loop walked host channels, tested flag bit i, and then read vol[srcIdx] for the swapped channel (4<->6, 5<->7), the order prepareBuffer plays an STD port in. So the flag bit and the array entry named different channels. The loop now tests the flag bit of the channel it reads, using the same STD_8CH_MAP as prepareBuffer. Ports that are not STD, and flags that set both channels of a swapped pair (such as 0xFF), behave as before.

Negative control: the new audio_out_set_volume_channel_mask plays an 8-channel block through the SDL disk driver with one channel flagged at half volume and the other array entries at 0, for each of the eight channels, on formats 2, 5, 6 and 7, plus a two-channel flag (4 and 7) on the STD formats. On main it aborts with only the flagged channel takes its own volume; with the change it passes.

The existing debt entry for sceAudioOutSetVolume ("reads one volume per flagged channel from the array") already describes the intended behaviour, so there is no debt fragment. boykopovar#16597, boykopovar#18272, boykopovar#20630 and boykopovar#24632 edit the same loop for other reasons (range, empty flag, guest copies) and will conflict textually; none of them changes which flag bit is tested.

Tested

Linux (WSL2 Ubuntu 24.04, GCC 13.3, Release), upstream/main b385636:

  • audio_out_set_volume_channel_mask: fails on main (Subprocess aborted), passes with the change.
  • audio_out_set_volume, audio_out_mix_level_pad_spk, guest_audio_out: pass with the change.
  • python3 tools/check_conventions.py: all checks passed.

Not built on Windows or macOS.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed channel-specific volume handling for eight-channel audio. Individual and combined volume adjustments now apply to the intended channels in supported surround formats, including signed 16-bit and floating-point audio. This improves consistency when adjusting channel levels in standard eight-channel layouts.

…hannel it reads on 8-channel STD ports

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Audio output channel-volume masks

Layer / File(s) Summary
Channel flag mapping
core/libs/prx/libSceAudioOut/src/AudioOut.cpp
sceAudioOutSetVolume checks the flag at each source-channel index. Standard eight-channel formats use STD_8CH_MAP.
Recorded-output tests
core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp, core/libs/prx/libSceAudioOut/CMakeLists.txt
The test checks individual and paired channel volumes in recorded audio. CMake builds and registers the test executable.

Suggested reviewers: boykopovar

Change: Bug fix

Merge Risk: Minimal · up to 470e9

This fixes the per-channel volume flag mapping on 8-channel standard audio ports and adds a regression test. No merge-blocking issues were found.

Security architecture risk: Minimal · up to 470e9

On standard eight-channel ports, sceAudioOutSetVolume now changes the channels the caller selected. The fix does not add a production entrypoint or change how libSceAudioOut is deployed.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 3
  • Waived: $0.75 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c3cf52a0-7390-42da-8bc0-5cd6cbd2bd1b
Commits

Reviewing files that changed from the base of the PR and between 4131f51 and 470e97d.

Files selected for processing: 3

  • core/libs/prx/libSceAudioOut/CMakeLists.txt
  • core/libs/prx/libSceAudioOut/src/AudioOut.cpp
  • core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 1 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 4 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 5 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 6 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 7 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 8 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 9 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 10 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 11 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 12 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 13 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 14 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 15 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 16 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 17 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 18 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 19 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp
PR 20 core/libs/prx/libSceAudioOut/tests/AudioOutSetVolumeChannelMask.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants