audio: support NGS2 PCM16 samplers and rear low-pass filters #825
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!825
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/825/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?
@Cosmo on GitHub · 2026-09-25 11:14 UTC · original
Cosmo:ngs2-pcm16-playback-and-filters→main· +985 −96 · 3 files · 4 commits · merged 2026-09-25 11:44 UTCStandard NGS2 samplers currently do not reach the PCM rendering path, and rear low-pass filter controls are unsupported. In Quake II, this leaves most sound effects and music missing.
This enables standard PCM16 sampler playback with linear interpolation for sample-rate and pitch conversion, including loops, streaming blocks, and playback progress. Voice events interrupt sample consumption immediately. The INUSE flag is available before rendering; remaining state flags are published after rendering. Loop callbacks report repeat counts, playback queries report the next source address, and reusing a voice resets its routing.
It also adds rear low-pass FCQ filters at the system output rate, with per-channel history, 64-bit channel bypass masks, and filter tails preserved through streaming gaps and render boundaries.
Validation:
ngs2_samplerandaudio_out2_porttests passed.git diff --checkpassed.Manual testing:
Tested with Quake II, with improved music and sound effects. To reproduce:
NGS2 sampler filter is ignored.Scope is PCM16 playback and rear low-pass FCQ filters; other filter configurations remain unsupported. Manual testing covers the exercised playback paths, not complete audio coverage or exact console filter response.
@coderabbitai[bot] on GitHub · 2026-09-25 11:23 UTC · original · edited 2026-09-25 11:45 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
2ac2e5d5-56ef-4a7e-9673-fc862137ca9a📥 Commits
Reviewing files that changed from the base of the PR and between
fd119cc6d0andbcfe1fa1e5.📒 Files selected for processing (2)
src/libs/ngs2.cpptests/Ngs2SamplerTests.cpp🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
Walkthrough
NGS2 sampler playback now updates decoded counts, handles repeated PCM blocks, applies voice events immediately, and processes both regular and custom samplers. Regular samplers also support configurable low-pass filters with per-channel history. Sampler state reports accumulated counts and current block metadata. A new sampler test executable covers playback and filtering behavior and is registered with CTest.
Priority: ➖ Normal
Change: Feature
Merge Risk: ⚪ Minimal · up to
bcfe1No actionable merge-blocking issue is established. The inspected playback path preserves resampling phase when a stream temporarily runs out of blocks.
Security Architecture Review
Security architecture risk: 🟡 Moderate · up to
fd119The playback changes affect how application-provided audio data and callbacks interact with rendering. Existing controls cover several transitions, but memory ownership across rendering and the full effect of callback-driven reconfiguration remain uncertain.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment
@coderabbitai helpto get the list of available commands.@ -1313,3 +1445,3 @@if (voice.decoder == nullptr) {Ngs2AdvancePcm(voice);if (voice.blocks.empty()) {if (voice.state != Ngs2VoicePlayState::Playing || voice.blocks.empty()) {@coderabbitai[bot] on GitHub · 2026-09-25 11:23 UTC · original · edited 2026-09-25 11:36 UTC
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 7989
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42719
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 30271
Preserve the fractional phase across streaming starvation.
When a flag-
1PCM stream exhausts its queue, the voice remainsPlaying. This branch then clearssample_phase. A later block starts with interpolation fraction0instead of the residual phase. With a source rate such as 44.1 kHz and a 48 kHz output rate, this can cause an audible resampling step after starvation.Suggested fix
📝 Committable suggestion
✅ Addressed in commit
bcfe1fa@coderabbitai[bot] on GitHub · 2026-09-25 11:23 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
96bd139f-51ba-4ee5-aeac-11cfc080d14f📥 Commits
Reviewing files that changed from the base of the PR and between
3585cd8f03andfd119cc6d0.📒 Files selected for processing (3)
CMakeLists.txtsrc/libs/ngs2.cpptests/Ngs2SamplerTests.cppIncluded review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@Nmzik on GitHub · 2026-09-25 11:45 UTC · original
@Cosmo Thanks!