feat(libSceNgs2.native): stream 16-bit PCM waveforms through appended waveform blocks #1038
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1038"
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 gjonn on 2026-10-07T02:55:12Z.
What
Streams 16-bit PCM through appended waveform blocks. A 16-bit PCM block whose
num_samplesexceed its data was rejected withNGS2: waveform block 0 does not fit its data. It now starts a stream, and asceNgs2SamplerVoiceAddWaveformBlockscall with flag0x2(namedSCE_NGS2_WAVEFORM_BLOCKS_FLAG_APPENDhere) adds more data to it. While the voice has played everything appended andCONTINUEis set, it outputs silence without advancing. It ends atnum_samplesor, onceCONTINUEis cleared, at the end of the appended data.sceNgs2VoiceGetStatereportsdecoded_data_sizeandwaveform_datafor the data actually played. Appending to a block that is not a stream, other waveform formats, skipped samples, repeats and partial frames throw. No reference describes flag0x2, so its meaning is inferred from the title's calls and recorded in TechnicalDebt.PPSA21402 (Balatro) streams its music this way: one block whose
num_samplesis the whole track and whose data is a 16 KiB first piece, withCONTINUE, then one flag-0x2block for each further piece, releasing its queued data asdecoded_data_sizegrows. Onmainplus #1020 and #1032, and with the flip queue limited to 2 pending flips (otherwise the GPU worker aborts the title after about 10 s, see #1034), the title stops about 18 s after start withNGS2: waveform block 0 does not fit its data. With this change it keeps running.Tested
ctest -R ngs2passes (all 6 Ngs2 suites). The newngs2_streamsuite renders a stream that ends atnum_samplesafter three pieces (silence while it waits for data,waveform_dataanddecoded_data_sizeafter each render), a stream that is closed by clearingCONTINUEbeforenum_samples, and the rejections above. With stream detection disabled it aborts withNGS2: waveform block 0 does not fit its data.main+ #1020 + #1032 withVIDEO_OUT_FLIP_QUEUE_CAPACITYset to 2 locally (not part of this PR, see #1034). Without this change the title stopped withNGS2: waveform block 0 does not fit its dataat frame about 820, roughly 14 s after the first frame (2 of 2 runs). With it, 3 of 3 runs were still rendering after 60 s at 59.6 to 60.0 FPS. I cannot listen to the audio here, so how the music sounds is not verified.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-07T05:05:41Z.
Thanks. #1032 has landed, and this now conflicts with
mainindocs/dev/TechnicalDebt.mdonly (the NGS2 lines); keeping both sides should be all it needs. Could you rebase it? It can go in once CI is green on the new head. Thengs2_atrac9failure on #1020 is separate and doesn't block this one.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T05:40:37Z.
Rebased onto current
main(only conflict: theforeachtest list inlibSceNgs2.native/CMakeLists.txt, now... Custom Parse Stream). Build and ctest green locally (416/416,ngs2_streamincluded); without the change the new test doesn't build. Merging once CI is green on the rebased head.