ngs2: size 16-bit PCM blocks in Ngs2CalcWaveformBlock (The Binding of Isaac: Repentance) #1968
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1968
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1968/head"
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?
@gl-ungus on GitHub · 2026-10-29 06:19 UTC · original
gl-ungus:ngs2-pcm-waveform-block→main· +10 −0 · 2 files · 1 commits · merged 2026-10-30 04:39 UTCGame: The Binding of Isaac: Repentance (PPSA03311, 01.000.000).
Problem: the game boots and runs at 60 FPS but has no audio at all: no music, sound effects or menu sounds (#667). It streams 16-bit PCM (waveform type
0x12) into a sampler voice. Before queueing each 16 KiB chunk, it callsNgs2CalcWaveformBlock(format, 0, 4096, &block). For anything other than ATRAC9, that function zeroes the block and returnsNGS2_ERROR_UNKNOWN_WAVEFORM_FORMAT. The game ignores the error and passes the zeroed block (data_size = 0,num_samples = 0) to0x10000001.AddWaveformBlocksdrops such blocks, so the voice stays Playing with no data, and every render is silent (AudioOutOutputpeak 0 on the main port).Change (src/libs/ngs2.cpp):
Ngs2CalcWaveformBlocknow handles 16-bit PCM. Its frames have a fixed size ofnum_channels * 2bytes, sodata_offset = sample_pos * frame_size,data_size = num_samples * frame_size, andnum_skip_samples = 0. Other non-ATRAC9 types still returnNGS2_ERROR_UNKNOWN_WAVEFORM_FORMAT, because the sampler only decodes 16-bit PCM.Tests: I added a PCM case to
TestWaveformBlockGeometryintests/Ngs2SamplerTests.cpp.ctest -R ngs2passes.Testing: CachyOS Linux, Intel Core i7-14700K, NVIDIA GeForce RTX 4070, built from
5e837a9. With temporary logging, the music voice now receives 16384-byte, 4096-sample blocks. The main port, which was always peak 0, now carries nonzero PCM from the title screen onward.Fixes #667
🤖 Generated with Claude Code
@coderabbitai[bot] on GitHub · 2026-10-29 06:22 UTC · original
No actionable comments were generated in the recent review.
b0994672-7c2d-4a3a-b81e-b0c3818622b2Reviewing files that changed from the base of the PR and between
5e837a9beaand7601e54ef7.src/libs/ngs2.cpptests/Ngs2SamplerTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
Ngs2CalcWaveformBlocknow calculates byte offsets and sizes for waveform type0x12using the sample position, sample count, channel count, and 16-bit sample size. The geometry test checks a 4096-frame stereo PCM block with a 16384-byte offset and size, zero skipped samples, and 4096 samples.Suggested reviewers:
nmzikPriority:
Normal
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk:
Minimal · up to
7601eThe change is ready to merge; PCM block geometry is covered by the implementation and regression test.
Pre-merge checks:
4 ·
1
#667.Ngs2CalcWaveformBlocknow sizes waveform blocks for 16-bit PCM type0x12usingnum_channels * 2bytes per frame. It sets the offset, size, …src/libs/ngs2.cppand its focused regression test intests/Ngs2SamplerTests.cpp. The implementation preserves unsupported handling for oth…Full details: Linked Issues check
Explanation
The PR addresses the coding requirement in issue
#667.Ngs2CalcWaveformBlocknow sizes waveform blocks for 16-bit PCM type0x12usingnum_channels * 2bytes per frame. It sets the offset, size, sample count, and zero skip count. The newTestWaveformBlockGeometryPCM case checks stereo 48 kHz geometry. The reported runtime test produced nonzero title-screen PCM output.Full details: Out of Scope Changes check
Explanation
The reported changes are limited to PCM block geometry in
src/libs/ngs2.cppand its focused regression test intests/Ngs2SamplerTests.cpp. The implementation preserves unsupported handling for other non-ATRAC9 formats. These changes directly support issue#667and include no demonstrated unrelated behavior.Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.