XAudio2: an XMA voice keeps the decoder's channels beyond 8 #1287
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1287
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1287"
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?
@emirduran707 on GitHub · 2026-11-24 14:20 UTC · original
emirduran707:xaudio2-xma-voice-channels→main· +69 −2 · 1 files · 1 commits · openThe XMA2 decoder accepts up to 16 channels (
xma2::MAX_CHANNELS), and a decoded XMA voice is created with the decoder's channel count. Butpcm16_for_rateclamped it to 8, so a voice with 9–16 channels got an 8-channel PCM voice. Each decoded frame still carried all its channels: with 10 channels, XAudio2 read every 10 samples as 1.25 frames of 8 channels, so the channels landed on the wrong speakers, drifted every frame, and the buffer played 1.25 times too long (2 times with 16 channels). XAudio2's limit isXAUDIO2_MAX_AUDIO_CHANNELS(64). On this machine, xaudio2_9 created plain PCM16 voices of 9, 10, 12, 16, 32 and 64 channels that played at the right length, and refused 65 (XAUDIO2_E_INVALID_CALL).pcm16_for_ratenow clamps to 1–64. The XMA voice's state takes the decoder's channel count too: the silence that stands in for an undecodable buffer is sized from it, and with 8 there Windows refused the submit of a 10-channel voice. Silent fallback voices and Opus voices still use 8, as before.What is in it
crates/xcl/src/hle/xaudio2.rs:pcm16_keeps_up_to_64_channels, which needs no device;xma_voice_keeps_the_decoders_ten_channels, which skips without an audio device. It uses anXMA2WAVEFORMATEXwith 10 channels in 5 streams: the voice reports 10 channels, and an undecodable buffer submits.Tested
cargo test --workspace -- --test-threads=4onfe5b1f3: 743 passed, 0 failed, 41 ignored; no SKIPPED GPU tests (the audio tests ran; an audio device is present)pcm16_keeps_up_to_64_channelsleft: (8, 16, 768000),right: (10, 20, 960000); with it both new tests passRegression run
main:
this PR:
Not tested
avg_bytesin the same function): the two merge cleanly, and its test's 8-channel case is unchanged by the 64 clamp; not run together.AI use
🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@futurepro62 on GitHub · 2026-11-24 14:34 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
fe5b1f3(on its base47efa2e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 743 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.pcm16_keeps_up_to_64_channels,xma_voice_keeps_the_decoders_ten_channels.Not tested
AI use
@thehollowedone on GitHub · 2026-11-24 14:35 UTC · original
Independent native 16-channel XMA check on
fe5b1f3and its parent930e8b4. Windows 11 build 26300, system XAudio2 2.9, Rust 1.99.1 MSVC, debug.I submitted a synthetic XMA2 packet that produces no decoded samples to a muted voice. With the PR, the native voice reported 16 input channels and queued 15,360 zero PCM bytes for 480 frames. XAudio2 consumed exactly 480 source frames, drained the queue, and XCL freed the fallback buffer. The parent consumed 480 frames too, but its voice had eight channels and queued only 7,680 bytes. The stock 10-channel test also passed without a skip.
This checks native playback of synthetic fallback silence. Valid multichannel XMA decoding and retail audio were outside this run. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixture and drafted this report.
@S1m0ne1997 on GitHub · 2026-11-25 14:46 UTC · original
Test report for
fe5b1f3b81b1ef64242c7ad1a8ef5f075b68d74a(this PR's head), for #1607.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)x86_64-pc-windows-msvc, debug.cargo build --workspace, thencargo test --workspace -- --test-threads=4at the head: 743 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).Regression run (retail title,
scripts/smoke.ps1 -Seconds 60, release;mainbuilt from the commit in its block, this PR from its head with no changes tocrates/, both run with thescripts/smoke.ps1ofmain, which hashes the name of the game folder)main:
this PR:
Not tested
AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.
@DavidM1911 on GitHub · 2026-11-26 01:17 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.Thanks!
— Devin
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.