feat(audio): add multi-stream XMA2 decoding, WAVEFORMATEXTENSIBLE, and streaming voice control (#26) #189
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/189"
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 LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-25T01:13:23Z.
Summary
Adds multi-stream XMA2 decoding (1–4 streams, 1–8 channels including 5.1 / 7.1 surround), full
XMA2WAVEFORMATEXheader parsing/validation,WAVEFORMATEXTENSIBLEexport, and a streamingXma2Voicedecoder with the synthetic 2,048 / 512 / guard-byte / disabled-voice verification control requested in Issue #26.What changed
rust/anyxboxx-audio/src/multistream.rs:stream_channel_layout(channels, streams)supporting mono through 7.1 (1..=8channels across1..=4streams).MultiStreamDecoderusing FFmpeg'spacket_skip_countpacket-routing algorithm (libavcodec/wmaprodec.c, LGPL-2.1+), handling round-robin multi-stream routing, burstskip == 0packets,0xFFend-of-block sentinels, XMA2 block-boundary resets (BytesPerBlock), frame interleaving, EOF flush, andSamplesEncoded/PlayBegin/PlayLengthtrimming.rust/anyxboxx-audio/src/voice.rs:Xma2Voice: incremental FIFO-backed PCM voice decoder withsubmit_packets,pending_frames,set_enabled,render_pcm, andrender_pcm_bytes(leaves output buffers untouched when disabled, preserves pending queued samples across partial refills, and never writes past the destination slice).rust/anyxboxx-audio/src/lib.rs&src/main.rs:Xma2Formatandparse()to read and validate all 52 bytes ofXMA2WAVEFORMATEX(while keeping minimal 20-byte headers supported).decode()throughMultiStreamDecoderso multi-stream files decode cleanly instead of erroring.wav_extensible(channels, sample_rate, channel_mask, samples)(WAVEFORMATEXTENSIBLE0xFFFE) and CLI options--info <in.xma>and--extensible.rust/anyxboxx-audio/tests/multistream_and_voice.rs(5 integration tests including the exact synthetic 48 kHz mono 2,048 → 512 refill / 1,536 pending / 256 guard-byte / disabled-voice check from #26).tests/test_audio.py(5.1 6-channel WAV decode and--infometadata) and updates the test count (658→660) across all 9 READMEs.Verification
cargo build --release --manifest-path rust/Cargo.toml -p anyxboxx-audio— clean build.cargo test --release --manifest-path rust/Cargo.toml -p anyxboxx-audio— 9 passed, 0 failed (4 unit + 5 integration tests).cargo clippy --manifest-path rust/Cargo.toml -p anyxboxx-audio --all-targets -- -D warnings— 0 warnings.python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools— passed.python -m pytest -q— full suite passed (tests/test_audio.py: 4/4 passed;tests/test_readme_sync.py: 660 tests synced across all 9 languages).Refs #26
Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-25T15:00:35Z.
Closed by the maintainer during PR triage: since #199, VIctory lives in this repository and is what runs the game. It already has its own XMA decoder (
third_party/victory/crates/victory-formats/src/xma.rs) and GFX10 texture tiling (victory-formats/src/texture.rs), whilerust/anyxboxx-*is only used by a test. Improvements in this area should go to VIctory's crates instead. Thanks for the work.Pull request closed