feat(ngs2): implement custom PitchShift and external render jobs #11315
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11315"
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 kyon-eth on 2026-10-26T03:34:39Z.
What
Custom sampler/submixer racks containing PitchShift currently reject creation, and external job managers cannot schedule the render pipeline. Implement the supported one-buffer PitchShift path and slot-0 render scheduling, including dependency barriers and completion before callback publication.
The supporting changes reproduce sampler startup history/resampling, streaming and replacement state; buffer worker events and render parameters; preserve callback ordering and cross-thread setup/process/cleanup handoffs; and retain detached racks after system destruction. Correct the 232-byte rack-info layout and PitchShift parameter-position validation, including five-bit aliases and early termination of invalid linked parameter lists.
Unsupported paths still throw and are documented in library debt. Stream exports and stream-job routing, worker setup/block/filter/patch controls, broader custom-buffer/module configurations and complete title compatibility remain outside this change. This is not full NGS2 support.
Overlaps and landing order
Maintainers may choose the order. These are independent features, with no functional dependency; the later branch must retain both implementations and test registrations.
The refreshed scan still reports these overlaps. This is a landing plan and bounded validation record, not an overlap-free or all-authors-agreed claim.
Tested
Current-main validation (2026-10-27): integrated main
9ae2f7d22ainaea8616433, retaining its updated waveform parser and regressions. The rebuilt macOS x86-64 production-source fixture passes 44/44 registered NGS2 checks plus the alias check (45/45 total). Conventions, whitespace and privacy checks pass. No Linux/Windows execution by the author is claimed.Open blocker: the reported PPSA36591 VAG setup with flag
0x10remains unresolved on this published branch. That bit selects an alternate AJM decoder bank; the enabled VAG path requires AJM codec 22, which is not implemented here. Ignoring the flag would not reproduce decoder selection or error/accounting behavior. The separate local VAG integration is not included in this PR and has not passed its integration test. This main-sync update does not claim that the title regression is fixed or that this PR is ready to merge.macOS x86-64/Rosetta: built the production NGS2 sources and both library variants with a focused external CMake fixture using the repository module definitions and pinned local LibAtrac9. Unrelated host libc/kernel boundaries are adapted; this is not a full application build.
fe2b52c7e4. The last main advancement changed no tested NGS2 implementation source bytes. Conventions: zero warnings/errors; whitespace and privacy/scope checks pass. The required open-PR scan completed; overlaps are described above.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)Latest review evidence and remaining blocker
Linux title report on exact head
aea8616433confirms that Trails in the Sky 2nd passes the PitchShift refusal and then stops at the separate custom-Reverb refusal. This is not a combined-PR or complete-title result.Reported PPSA36591 rack options include a 216-byte ordinary sampler option with word 51 equal to 32 and VAG setup flag
0x10. This supports treating the report as the configured alternate-bank case, not the missing-bank case. The remaining review blocker is a real backend implementation gap: AJM codec 22 and its scheduling/output-accounting path are not implemented on this branch. The refusal remains explicit; this report does not justify ignoring the flag or claiming the title regression fixed.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T04:37:45Z.
Review: CHANGES_REQUESTED
I found a PCM sampler regression in the new block binding path. For non-ATRAC9 blocks,
AddWaveformBlocksvalidates storage for(num_skip_samples + num_samples) * frameBytes, and the previous renderer started frame reads atblock.data + num_skip_samples * frameByteswhile emitting exactlynum_samples. The newNgs2BindSamplerBlockinstead setspcmRemainingto the sum, andNgs2ReadSamplerPcmreads fromblock.data + dataCursorstarting at zero. A block with two skipped PCM frames followed by three playable frames will therefore render all five frames from the prefix instead of emitting only the last three; it also advances completion/callback timing by the skipped prefix. I did not find a PCMnum_skip_samplesregression in the new sampler tests. Please initialize the PCM cursor/count to skip the prefix while preserving the public decoded-sample accounting, and add a focused case that verifies the rendered samples and completion count. No approval yet: this is an audible wrong-result path in a broadly applicable block format. Hosted eligibility, conventions, intake, labels and report checks pass; product and relinker jobs were skipped by path policy. The author-reported isolated macOS/Rosetta test suite and reference comparisons were not independently rerun here.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T09:51:28Z.
Review: DISMISSED
Follow-up on unchanged exact head
316f48500a7193fb89aae6d3d9b2c260df55b409against currentmain4e43321bd6ceccdc1ae28568bbbc35d9a6446464.The PCM skipped-prefix regression from my earlier review is still present. In
Ngs2BindSamplerBlock, the non-ATRAC path setspcmRemainingtonum_samples + num_skip_samples, andNgs2ReadSamplerPcmstarts reading atblock.dataCursor == 0. The previous renderer addressedFrameAtatnum_skip_samples + frameand emitted onlynum_samples. For a PCM block with a skipped prefix, this implementation emits those prefix frames and delays block completion/callbacks. Please advance over the skipped PCM frames without counting them as rendered output, and add a test checking both sample values and completion accounting.The branch is 18 commits ahead and 254 behind current main. Since its base, main has changed
Render.cpp,Voice.cpp,Ngs2Render.cppand the shared debt file, all touched by this PR. Please rebase, preserve both sides, and rerun the affected sampler/render tests plus conventions on the resulting head.git diff --checkalso reports an added blank line at EOF intests/Ngs2JobTest.hpp; please remove it.The reported macOS/Rosetta fixture results and reference comparisons are detailed, but I did not independently reproduce them; hosted product jobs remain skipped by path policy. My earlier integration note about 32-bit channel masks with #11347 applies only if the wider-channel branch is combined; it remains a separate integration condition.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-27T08:55:25Z.
Review: CHANGES_REQUESTED
Thanks for the thorough work and the 13.60 comparisons. One blocker remains on the current head:
core/libs/prx/libSceNgs2.native/src/Voice.cpp:655: the newif (setup.channel_mask != 0) throwmakes a sampler setup thatmainaccepts abort. @nekomancer01 reported PPSA36591 (Steins;Gate) setting up a VAG, 2-channel, 48 kHz voice withchannel_mask0x10 and crashing on the first button press with this branch, whilemainplays on. You note that bit 0x10 selects an alternate decoder slot, so the throw is defensible in isolation, but this PR must not turn a working title into an abort. Either keep the previous behaviour for the flag until the alternate slot is implemented, scoped to whatmaindid, or implement the 0x10 slot selection for the formats it applies to, with a test pinning the result. If the throw stays, the PR needs evidence that no known title regresses.Not verified by us: the PCM skip semantics (skipped frames now emitted from the data start, 62 public decoded samples for skip=2/samples=3) rest on your 13.60 measurement; the full Linux/Windows Build run is the gate for everything else.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T22:08:13Z.
Review: CHANGES_REQUESTED
Reviewing exact head
0ec158e2df44e5ae6b72b52ef009e62924e42b14.What I ran
Results
Findings
Blocking
Custom.cpp,Render.cpp,Voice.cpp,Ngs2Types.hpp,Ngs2Internal.hpp,Rack.cpp, and NGS2 tests after the PR's documented integration at9ae2f7d22a. Those files overlap this PR's implementation and test changes. The branch's clean mergeability status does not establish the combined behavior. Please merge current main and rerun the focused NGS2 production-source suite on the combined head, including Gain/routing and lifecycle/scheduling tests. Report the exact head and any changes needed to preserve both main's current behavior and this PR's coverage.Non-blocking
0x10selects an AJM codec-22 path that this branch does not implement; the refusal and debt entry remain explicit. I am not treating that disclosed, separately scoped gap as a reason to silently accept or request removal of the guard.Sources
Not verified
To get this to a good state
Integrate current main and post exact-head focused results for the overlapping NGS2 implementation and tests; then request a re-review.