Skip to content

fix(libSceAudioOut): report the port's channel count from sceAudioOut2PortGetState - #4778

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/audioout2-port-state-channels-v2
Oct 14, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/audioout2-port-state-channels-v2

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

sceAudioOut2PortGetState reported the two channels of the host output for every port. It now reports the channel count of the port's data format, and clears the whole state first so the reserved fields no longer keep the caller's stack contents. Output (main), volume (127), reroute counter and flags are unchanged.

The channel count follows SharpEmu, another emulator. There is no console measurement for it; this is recorded in docs/dev/debt/libSceAudioOut.md.

New test audio_out2_device_state covers sceAudioOut2PortGetState (mono, stereo float and S16, 7.1, 7.1.4; invalid and destroyed handle; null state), sceAudioOut2GetSpeakerInfo and sceAudioOut2GetSystemState (null checks and reported values). None of the three had a test before.

Related to #4317 (ASTRO BOT PPSA21564, ASTRO's PLAYROOM PPSA01284: assertion prop->m_pParent == this). That issue has an A/B in which the reported AudioOut2 state decides the assertion, but it has not isolated which field; GetSpeakerInfo and output already match on main, so the channel count is the only remaining difference to the values described there. This PR does not claim to fix the assertion.

Tested

Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, built and run on main ffa198407:

  • audio_out2_device_state, audio_out2_port_layouts, audio_out2_port_buffers, audio_out2_pad_mix, audio_out2_latency and audio_out2_timing pass (6 of 6).

  • audio_out2_device_state fails without the change to AudioOut2Port.cpp (the mono port reports 2 channels).

  • The branch is rebased onto main 584cc4c57 without a conflict in the code (TechnicalDebt.md moved to docs/dev/debt/, so the entry is in debt/libSceAudioOut.md). I did not rebuild on that main: it needs the new libusb-cmake submodule, which is not available here. python tools/check_conventions.py --base upstream/main passes on the rebased branch.

  • The current head 72fae2087 is based on 6d7b87370, a later rebase than the one described above; it was not rebuilt (not recorded). git merge-tree of it against main 068ab2aba (13 October) is clean. The overlap bot lists feat(libSceAudioOut): declare 19 AudioOut2 exports by their hash-verified names #5119 for docs/dev/debt/libSceAudioOut.md L18, the debt file this change also touches; whichever lands second needs a small rebase there.

  • No title run; ASTRO BOT and ASTRO's PLAYROOM are not available here. Linux not tested. Ports of other types (pad routes) are not covered by the test; output stays main for them, as before. A search of open PRs for sceAudioOut2PortGetState found only this one.

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

  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt

  • No notes, investigation .md files or images added to the repository

  • New third-party code is a submodule built from source (none added)

  • Generic behaviour, not specific to one title

  • Depends on: none

  • Unblocks: none

  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

@nicolasfalesy

Copy link
Copy Markdown
Contributor

Linux test (Arch, GCC 16.2.1, Release, PipeWire), this PR merged onto main 7e181fc (clean merge): all 10 audio_out* tests pass, including audio_out2_device_state. With AudioOut2Port.cpp put back to main's version, audio_out2_device_state fails on Linux too, so the new check guards the change on both systems. No title run.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 13, 2026
…2PortGetState

sceAudioOut2PortGetState returned the two channels of the host output for
every port. It now reports the channel count of the port's data format and
clears the rest of the state, so the reserved fields no longer keep the
caller's stack contents. The speaker info and system state calls are
unchanged; a new test covers all three, since none had one.

The channel count follows SharpEmu, another emulator; no console
measurement exists, recorded in TechnicalDebt.md. ASTRO BOT and ASTRO's
PLAYROOM reportedly stop on an assertion that depends on the reported
state (boykopovar#4317); which field matters is not isolated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@xXPBSXx
xXPBSXx force-pushed the fix/audioout2-port-state-channels-v2 branch from 1e0c05c to 72fae20 Compare October 13, 2026 07:56
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 13, 2026
@coltken95

Copy link
Copy Markdown

Linux validation (Ubuntu 24.04, GCC 13.3, Release), this PR's commit on main at 77b9f72: audio_out2_device_state passes. With main's sources and this PR's test it aborts, so the test catches the reported channel count.

AI-assisted: yes

@xXPBSXx

xXPBSXx commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the Linux validations, @nicolasfalesy and @coltken95. Noted for the record: the overlap bot lists #5119 for docs/dev/debt/libSceAudioOut.md L18; whichever PR lands second needs a small rebase there. No change to the code.

AI-assisted (Claude Code).

@adriadam10 adriadam10 self-assigned this Oct 14, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on this PR merged onto main: build and ctest of libSceAudioOut (12/12) pass, and audio_out2_device_state fails with AudioOut2Port.cpp reverted. Linux runs from @nicolasfalesy and @coltken95 agree. The channel count follows another emulator only, which the debt entry records; merging.

@adriadam10
adriadam10 merged commit fe1ccd7 into boykopovar:main Oct 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants