hle: implement the xapu conversion kinds (Opus decode+convert, PCM convert) #184
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ReTerryDavis--ReVIctory!184
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-183"
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?
@SovietBearz0r on GitHub · 2026-12-05 22:28 UTC · original
SovietBearz0r:larp-audio→main· +452 −43 · 1 files · 1 commits · openSummary
The console audio decoder (
xapu.dll) has three connection kinds: plain Opus decode, Opus decode and sample-rate conversion, and float-PCM conversion. Our HLE accepted only plain decode and refused the other two withE_NOTIMPL(crates/victory-hle/src/modules/apu.rs), so the title's phone-call/voice path - which connects for converted output - had no decoded audio.This port adds
DECODE_CONVERT_OPUSandCONVERT_PCM:pitchinput frames per output frame, moved toward each command'starget_pitchby itspitch_rampper output frame (1/8..8 clamp), as the console's hardware does;frames_per_output(256/480/512/960/1024) with theXApuStatebits andstate_data,Flushfor the remainder, deinterleaved input/output, and reset (decoder only, or decoder and converter);Ported from gamingwithhomie/larp
1250552dd9e17421011ba9d971f62dac247d30f4("Fix phone call audio: port xapu DECODE_CONVERT_OPUS/CONVERT_PCM and XMA2 overlap carry"), GPL-3.0-or-later; the converter is their linear-interpolation one. Not ported from that commit: the XMA2 overlap carry/resume informats/xma.rs(separate, bigger change) - a stream that resumes a decoder from another's overlap buffer may still glitch.Verification
cargo test --locked -p victory-hle --lib apu: 5 passed (newthe_converter_follows_its_pitch, newpcm_converts_in_whole_outputsend to end throughXApuConnect/Activate/Process/DequeueResult, plus the three existing Opus decode tests).cargo clippy --locked -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 442 files ok.scripts/bench.ps1can record a run, but a call is manual).Why now
From the LARP borrow review: this was the highest-QOL item - missing phone-call/dialogue voice with correct-looking logs. If you want, the XMA2 overlap-carry half can be a follow-up port.
The console's audio decoder connections come in three processing kinds. Our xapu implementation accepted only plain Opus decoding: a title connecting for decode-and-convert or PCM-convert was refused with E_NOTIMPL, so the phone-call/voice path that uses those connections got no decoded audio. This adds the other two kinds (DECODE_CONVERT_OPUS, CONVERT_PCM): a per-stream sample-rate converter (linear interpolation; the pitch moves toward each command's target by its ramp rate, as on the console's hardware), whole outputs of the connection's frames_per_output size with the XApuState bits and state_data, Flush, deinterleaved input/output, and reset (decoder only or both). Plain Opus connections keep their path and results. Ported from gamingwithhomie/larp 1250552dd9e17421011ba9d971f62dac247d30f4 ("Fix phone call audio: port xapu DECODE_CONVERT_OPUS/CONVERT_PCM and XMA2 overlap carry"), GPL-3.0-or-later. Not ported from it: the XMA2 overlap carry/resume in formats/xma.rs, which is a separate, larger change; a title stream that resumes a decoder from another's overlap may still glitch. Verified by unit tests: the converter's pitch/ramp behaviour, and the PCM conversion end to end through XApuConnect/Activate/Process/DequeueResult; the existing Opus decode tests pass. The title's phone-call path itself was not run (no game run); that still wants an in-game check.@SovietBearz0r on GitHub · 2026-12-05 22:55 UTC · original
In-game smoke on this box (RX 9070 XT, diag build,
bench.ps1builtin:cruise): INCONCLUSIVE for the conversion path — the route never requested the new kinds.Evidence:
audio decoder connected streams=256 process=1 chunk=0 …(process=1=DECODE_OPUSonly;DECODE_CONVERT_OPUS=2 /CONVERT_PCM=3 were never asked), 0×processing kind not implemented, 0×E_NOTIMPL, 0 ERROR, 0 device removals, exit 0, normal Opus/DSP activity. The binary does contain the new code. The new conversion path needs a voice/phone-call route (a phone call in game) to be exercised; the bench route doesn't call it. Log:data\logs\larp-audio.log, reportdata\ingame-verify\larp-results.md.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.