APU: decode-convert and PCM rate conversion #218
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!218
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/218/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?
@Quat3rnion on GitHub · 2026-11-24 01:32 UTC · original
Quat3rnion:victory-apu-convert→main· +661 −32 · 3 files · 2 commits · closed without mergingWhat
The console's APU accepted only
DecodeOpus. Titles that connected forDecodeConvertOpusorConvertPCMgotE_NOTIMPL, so their resampled audiowas silent. This adds both process types with the documented
maxFrameCountPerOutputvalues, pitch and frame-count handling, anddeinterleaved input and output. A portable streaming resampler holds the
conversion arithmetic and has its own unit tests.
An AI tool wrote part of this change.
Tested
cargo check --target x86_64-pc-windows-gnu -p victory-hle --testspasses. The three new APU tests compile but were not run; there is no Windows host here.cargo test --workspaceon a tree carrying PR #112's Linux build fix: 172 passed, 0 failed, 3 ignored. All eight resampler tests pass. Basemaindoes not build the workspace on Linux yet, which is what #112 addresses.Checklist
cargo fmton the changed files; clippy and workspace tests pass on a tree with #112's build fix.cargo xtask policypasses (151 files ok). No game files or data from them were added.@jeremygold02 on GitHub · 2026-11-24 05:12 UTC · original
Thanks @Quat3rnion for adding decode-convert and PCM rate conversion coverage.
I tested commit
200943e067b78bc1a469fd8d24a450be17522e12with:The aggregate
apurun had 10 passed and 2 failed (80 filtered). The dedicated resampler filter passed all 8 tests (84 filtered), covering unit/half/double pitch, stereo pairing, carry between commands, flush of a partial frame, pitch ramps, and invalid shapes. The title-driven Opus decode test and both conversion-kind connection setup also passed.The two failures reproduce when run individually:
converts_float_pcm_at_the_target_pitchexpected S_OK, 8 frames, pitch 2.0, and 32 output bytes; it received S_OK, 15 frames, pitch 1.0, and 60 bytes at the assertion on line 845.decodes_and_converts_an_opus_streamfails the half-pitch assertion that converted output contains more than 960 frames (line 895).These two failing tests are introduced in this PR and are absent from base commit
d2a4bae1f49533ef5cb512fd1b1ba1513f2e1989, so their same-name baseline behavior could not be tested there. This covers synthetic PCM/Opus buffers and the resampler; it does not exercise audio playback through a real title or output device.@etcetera-yt on GitHub · 2026-11-24 05:36 UTC · original
On
main(d2a4bae) plus #218 alone, Windows 10 19045, Rust 1.98.1,cargo test -p victory-hle modules::apu:The resampler's own tests (
apu_resample::tests::*, 8) pass, so the target pitch seems not to reach the resamplerthrough the APU command path: the result has pitch 1.0 and the unconverted frame count. Possibly host-dependent
(output device or sample rate); worth checking on another machine.
AI use: Claude Code, Claude Opus 5.5.
@KevinPratap on GitHub · 2026-11-24 07:13 UTC · original
The two failing tests here (
converts_float_pcm_at_the_target_pitch,decodes_and_converts_an_opus_stream) come from a zeropitch_rampnever moving the pitch. Fix with a test, against this branch: https://github.com/Quat3rnion/VIctory/pull/1 (10 → 13 passing incargo test -p victory-hle --lib apu). AI-assisted.@Quat3rnion on GitHub · 2026-11-24 07:30 UTC · original
Rebased on current main and added a fix for the two failing conversion tests: a zero pitch ramp left the resampler at its initial 1.0, so target_pitch was ignored. The pitch is now set directly when no ramp is set. New head 7175608. The APU tests are Windows-gated, so I could not run them here — could you re-run the two reported failures? Thanks.
@lameloball2813-ui on GitHub · 2026-11-24 08:15 UTC · original
Re-ran the APU tests at the new head
7175608on Windows 11, Rust 1.98.1, debug:cargo test -p victory-hle --lib modules::apu. All 13 passed, 0 failed, including the two that failed before:modules::apu::tests::converts_float_pcm_at_the_target_pitch... okmodules::apu::tests::decodes_and_converts_an_opus_stream... okThe new
apu_resampletests pass too (a_zero_ramp_applies_the_target_immediately,pitch_ramps_towards_the_target,stereo_channels_stay_pairedand the rest).@MamaLeVrai on GitHub · 2026-11-24 17:41 UTC · original · edited 2026-11-24 18:26 UTC
Correction to my earlier comment: the CI run of this PR did run and fails on the same lints. For reference, the three errors of
cargo clippy --workspace --all-targets --locked -- -D warningson this PR merged ontomainatffe310e, all inmodules/apu.rs:needless_option_as_deref(decoder.as_deref_mut()on anOption<&mut _>; usedecoder)manual_is_multiple_of(frames % multiple != 0; use!frames.is_multiple_of(multiple))chunks_exact_to_as_chunks(.chunks_exact(4); useas_chunks::<4>().0.iter())Clippy suggests each fix. The tests pass. AI-assisted (Claude Code); no game data.
@Marvisak on GitHub · 2026-11-25 00:00 UTC · original
Automated triage for the maintainers. Closing because it breaks a repository rule (see
docs/asset-policy.mdand the project rules): nothing taken from the console SDK or the game, no weakening of the asset policy, and the title stays offline.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed