fix(libSceAudioOut): implement sceAudioOutSetPadSpkVolume and unblock PSBox (PPSA99810) #12791
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12791"
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?
Imported from boykopovar/AnyPS5. Originally posted by Elma7e on 2026-10-29T09:26:00Z.
What
sceAudioOutSetPadSpkVolumethrewNotImplemented_nid_no_patchfromUnimplemented.cpp. When PPSA99810 plays alert chimes on its detached controller speaker worker thread (src/media/audio_out_ps5.cpp:184), the uncaught exception terminates the process withSIGABRT(exit 134).This PR:
sceAudioOutSetPadSpkVolumeintoAudioOut.cpp.PADSPK_VOLUME_MAX = 127andDEFAULT_PORT_STATE_VOLUME = 127.0x80260003INVALID_PORT).PADSPK_VOLUME_MAX, returning0x80260009(INVALID_VOLUME) for values outside that range.0x8026000A(INVALID_PORT_TYPE) for non-PORT_TYPE_PADSPKports.padSpkVolumeon the port and reflects it insceAudioOutGetPortState.padSpkVolumeinprepareBufferto scale both float and 16-bit PCM audio output streams byvolume / 127, so the write actually controls audio output rather than dropping its data.docs/dev/debt/libSceAudioOut.mdunder Silent stubs, noting that volume linearly scales pad speaker output and bounds/error codes are assumed from title scaling and sibling calls, and removes the unimplemented stub entry.AudioOutMixLevelPadSpk.cppwithTestPadSpeakerVolume()using a ±16384 alternating block, verifying valid levels, volume 0 muting (silence), invalid handles, wrong port types, and out-of-range volumes.Tested
exit 0).AudioOut.cppto throwing stub causesTestPadSpeakerVolumeto abort as expected.python3 tools/check_conventions.py --base upstream/main --head HEAD: passed with 0 errors.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T10:50:01Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The new
TestPadSpeakerVolumeaborts every time it runs, and the range check, the error codes and thesceAudioOutGetPortStatevolume rest only on the title's call site, which the project rules do not accept as a source for library behaviour.What I ran
Head
bb9c53974580183c23e82cada844204350040d16, merged with--no-ffontomain1db077e876a839f75d11a56e728e7f56a4a8c25e(no conflicts). Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release build with Ninja, in a clean worktree.Results
maingit diff --checkcheck_conventions.pyAll conventions checks passed.libSceAudioOut,libs, all)audio_out_mix_level_pad_spk(PR as submitted)Subprocess abortedin 0.32 saudio_out|public_headers(117 tests)audio_out_mix_level_pad_spkfailsTestPadSpeakerVolumeblock changed to ±16384Failure and backtrace
Negative control
With the test changed only so that it can pass (the ±16384 block, see the first blocking finding) and
AudioOut.cppandUnimplemented.cpprestored frommain, the test fails as it should:Output
The test as submitted fails with and without the production change, so it does not show anything about the change yet.
Findings
Blocking
The new test always aborts.
TestPadSpeakerVolumeusesRamp()and compares againstScaled(block, defaultMixLevel).Scaledrequiressample * level % 32768 == 0. TheRamp()samples are ±256·(k+1) and 11626 = 2·5813, so the product is a multiple of 32768 only when k+1 is a multiple of 64. 254 of the 256 samples fail, starting with the first one, soRequireaborts before the comparison runs, on any machine. This does not match "all assertions passing" in Tested.TestDefaultLeveluses a ±16384 block for this reason. With that block inTestPadSpeakerVolumethe test passes on this tree, and the negative control above then fails. Fix: use a ±16384 block, or a ramp whose samples are multiples of 32768 / gcd(11626, 32768) = 16384, and quotectest -R audio_out_mix_level_pad_spkin Tested, as already asked in the earlier comment.The behaviour comes from a call site, which the rules do not accept as a source for this.
sceAudioOutSetPadSpkVolumereturns 0x80260009 outside 0–127, uses a fixed check order and returns success otherwise.sceAudioOutGetPortStatenow reports the stored value asvolumefor pad speaker ports. The debt entry says all of this is assumed from "the title's scaling and sibling calls". REVERSE_ENGINEERING.md says: "A call site doesn't settle what the library writes, which error codes it returns, its side effects, or the values a title happens to accept … Everything that the call site and the other sources leave open throws". It also says a silent stub is allowed only when it affects the UI, and "a write that drops its data, is not UI". CONTRIBUTING.md says the same. Here the volume is stored but never applied to the pad speaker audio, so listing it under Silent stubs does not fit. This goes further than the earlier collaborator comment, which suggested Silent stubs together with the assumption wording. In practice this means:GetPortState.volumechanges from 127 to whatever the title last set. Nothing shows that the console reports it there.Fix: settle the behaviour from a stronger source before implementing it, for example the export in a PS5
libSceAudioOutmodule (the same debt file already cites the 13.60 module forsceAudioOut2LoTerminate) or a console measurement. That source would give the range, the error codes, the check order, and whether the value reaches the output andGetPortState. Then apply the volume to the pad speaker output if the console does. Until then the export should keep throwing.Non-blocking
VOLUME_MAX = 127constant, but the code uses the literal127in three places (L121, L384, L702). It also gives the crash as "SIGABRT(0xC0000005/ exit 134)". 0xC0000005 is a Windows access violation, while an uncaught exception on Linux is SIGABRT / exit 134. If the code stays, a named constant next toDEFAULT_VOLUMEwould keep the three uses in step.Not verified
sceAudioOutSetPadSpkVolumedoes on a console: its range, error codes, check order and effect on output and port state. I found no source in the PR or in the tree.To get this to a good state
TestPadSpeakerVolumeinput block so thatScaledcan succeed, and quote a passingctest -R audio_out_mix_level_pad_spkrun.NotImplemented_nid_no_patchand the original Unknown function info entry.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T11:45:47Z.
Review: CHANGES_REQUESTED
Re-checked — changes still requested
The new commit fixes the test input block and adds the named constant, and the test now passes and fails without the change as it should; the export still implements a range, error codes and a
GetPortStateeffect that come only from the title's call site.What changed since my last review
159d10a5a9on top of5c32f54c11, which is the same patch as the previously reviewedbb9c539745rebased on newermain. The range-diff shows no other change.TestPadSpeakerVolumenow uses a ±16384 alternating block instead ofRamp().PADSPK_VOLUME_MAX = 127replaces the three literal127s inAudioOut.cpp.What I ran
Head
159d10a5a9009d88d693e181fb7819eb97a9b618, merged with--no-ffontomainba5b5330b37724bca4b99f30faab504653635a04(no conflicts), in a clean worktree. Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release build with Ninja.maingit diff --checkcheck_conventions.pyAll conventions checks passed.libSceAudioOut,libs, all)audio_out_mix_level_pad_spkaudio_out|public_headers(117 tests)main)Negative control output
Previous findings
TestPadSpeakerVolumenow uses the ±16384 block. The test passes on the merged tree and fails with the production files frommain(see above). Tested still quotes only a standalone build. Thectestrun above covers this.sceAudioOutSetPadSpkVolumeis the same as before apart from the constant. It accepts 0–127, returns 0x80260009 / 0x8026000A in a fixed order, and stores the value.sceAudioOutGetPortStatereports it. The debt entry now says all of this is assumed. Saying so is accurate, but the rules do not allow it. REVERSE_ENGINEERING.md on currentmainsays that error codes, side effects and the values a title accepts which the call site leaves open must throw. It also says that "a write that drops its data, is not UI", so this does not qualify as a silent stub either (CONTRIBUTING.md). The stored volume does not reach the pad speaker output. The test confirms this: the output is stillScaled(block, defaultMixLevel)after the volume is set to 0. The earlier collaborator comment asked for the "assumed" wording, and the branch now has it. That wording records the gap, but it does not make the export acceptable under the rule.PADSPK_VOLUME_MAXreplaces the literals.New findings
Blocking
None beyond the open finding above.
Non-blocking
sceAudioOutGetPortStatenow reportsPADSPK_VOLUME_MAXasvolumefor main, BGM, voice and every other non-pad-speaker port. The value is still 127, as onmain, but the constant's name ties it to the pad speaker. If this code stays, use a neutral constant for the other ports' reported volume.Not verified
sceAudioOutSetPadSpkVolumedoes on a console: range, error codes, check order, effect on the output and onGetPortState. The PR and the tree still give no source for any of this.To get this to a good state
libSceAudioOutmodule (the debt file already cites the 13.60 module forsceAudioOut2LoTerminate) or a console measurement. Implement what it shows, including applying the volume to the pad speaker output if the console does. Cite the source in the debt entry.NotImplemented_nid_no_patch) and keep the original Unknown function info entry.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T21:23:35Z.
Review: CHANGES_REQUESTED
Re-checked — changes still requested
The new commit applies the pad speaker volume to the output as a linear
volume / 127gain, adds a test that volume 0 mutes the output, and adds a neutral constant for the volumeGetPortStatereports on other ports. The range, the error codes, the check order and now the gain law still come only from the title's call site.What changed since my last review
659c03096b, one commit replacing5c32f54c11+159d10a5a9.prepareBuffermultiplies pad speaker samples bypadSpkVolume / PADSPK_VOLUME_MAX, for both float and S16.DEFAULT_PORT_STATE_VOLUME = 127is now the volumesceAudioOutGetPortStatereports for ports that are not pad speakers.TestPadSpeakerVolumeadds a playback with volume 0 that must be silent, and checks the reported volume of a main port.What I ran
Head
659c03096b914e1a46d9a2d5b9985f5db9e8b9bc, merged with--no-ffontomain9090972b7e91fd266819cbd77a8b058e177b5682(merged tree1f07e2e621), in a clean worktree. Debian 13 VM, GCC 14.2.0, Release, Ninja. The script built the merged tree and ran the selected tests.git diff --checkcheck_conventions.pyAll conventions checks passed.unwrap_self, also fails onmain; one test was skipped as expected. No new failures or timeoutsaudio_out_mix_level_pad_spk+public_headers*(66 tests)audio_out_mix_level_pad_spkalonemain)git status --porcelainis emptyPrevious findings
Blocking 1, the test always aborted: Resolved, and it stays resolved. The test passes on the merged tree and fails with the production files from
main.Blocking 2, the behaviour comes from a call site: Still open. The new commit removes one half of the objection: the volume now reaches the output, so the export no longer stores a value without using it. Everything else is still unsourced:
AudioOut.cpp#L704-L718);GetPortStatevalue.The debt entry itself calls all of this "assumed, not console-measured". REVERSE_ENGINEERING.md on current
mainsays that error codes, side effects and the values a title accepts, when the call site leaves them open, must throw. The entry is also in the wrong section:Non-blocking 1, description and literals: Resolved, and it stays resolved.
Non-blocking 2,
PADSPK_VOLUME_MAXreported for non-pad ports: Resolved. Other ports now reportDEFAULT_PORT_STATE_VOLUME(L601). The test checks that a main port reports 127.New findings
Blocking
None beyond the open finding above.
Non-blocking
GetPortState, so any mapping with 0 → silent and 127 → unity would pass. The S16 path also divides twice: first by the mix level and channel volume, then byPADSPK_VOLUME_MAX(L247). Each division truncates toward zero. If a sourced gain law is ever added, check an intermediate level against exact expected samples, and fold the factor into a single division.Not verified
sceAudioOutSetPadSpkVolumedoes on a console: range, error codes, check order, gain law and theGetPortStatevalue. The PR and the tree still give no source for any of this.To get this to a good state
libSceAudioOutmodule (the debt file already cites the 13.60 module forsceAudioOut2LoTerminate), or a console measurement. Implement what that source shows, cite it in the debt entry, and move the entry out of Silent stubs, keeping only what is still unverified.NotImplemented_nid_no_patch) and restore the original Unknown function info entry.Pull request closed