startup_stubs/audio_sink: add multi-channel downmix and linear resampling #1446
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1453"
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 R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:49:41Z.
Summary
Extend
x2w_audio::convert_blockandAudioSink::submitinsrc/startup_stubs/audio_sink.{h,cpp}to support:1/sqrt(2)for center and surround/side channels, LFE omitted) with[-1.0, 1.0]clamping, plus stereo to mono (0.5 * (L + R)).in.rate != out.rate(e.g. 24 kHz / 44.1 kHz to 48 kHz), with positive sample-rate validation (1000..384000Hz) andSubmit::Unsupportedfor invalid rates, unsupported channel counts, or empty/null blocks.AudioSink::submitto avoid per-submit heap allocations.docs/startup-runtime.mdand extendedtests/startup_audio_pure_check.handtests/startup_audio_output.cpp.Verification
g++ -std=c++17 -Wall -Wextra -Werror -O2withsmall/near/far/min/maxmacro collision test): PASSpython3 tests/docs_links_check.py: PASS (16 Markdown files, 325 links)python3 tests/bidi_controls_check.py: PASS (1190 tracked files)git diff --check origin/main..HEAD: PASSAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T11:59:43Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
fb2a4c0848ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:53:01Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
fb2a4c08486325b4404b3a6398c7d8e344edc6df:--preset dev):cmake --build --preset dev --target startup_audio_output startup_audio_pacing -- -j 6):4.99s(configure1.72s)ctest --preset dev -R '^startup_audio_' --parallel 4 --no-tests=error --output-on-failure): 0/3 passed (2.00s:startup_audio_output0.04s,startup_audio_pacing0.03s,startup_audio_provider1.90s); skipped (capability, no default render endpoint on server):startup_audio_output,startup_audio_pacing,startup_audio_provider/O2(--preset release):cmake --build --preset release --target startup_audio_output startup_audio_pacing -- -j 6):2.61s(configure1.69s)ctest --preset release -R '^startup_audio_' --parallel 4 --no-tests=error --output-on-failure): 0/3 passed (1.98s:startup_audio_output0.03s,startup_audio_pacing0.03s,startup_audio_provider1.89s); skipped (capability, no default render endpoint on server):startup_audio_output,startup_audio_pacing,startup_audio_providersccache: 0/8 hits; wall20.7sNote:
startup_audio_outputrunscheck_pure()before probing the WASAPI endpoint, so all pure conversion/downmix/resampling/negative-control assertions compiled and executed on MSVC Debug & Release/O2prior to the capability skip (exit 77).Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T11:53:09Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
fb2a4c0ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T11:59:43Z.
Code review location:
src/startup_stubs/audio_sink.h; line 156When consecutive blocks are submitted at a different sample rate,
AudioSink::submitinvokes this conversion afresh, restartingposat zero and independently rounding each output length. The pure converter produces 139,000 output frames for 1,000 128-frame blocks at 44.1-to-48 kHz, versus 139,320 when converting the same input as one block; a split 24-to-48-kHz ramp also loses the interpolation sample at the boundary. Thus packetization changes both playback timing and samples. Retain fractional phase and boundary history across accepted submissions rather than restarting the resampler for every block.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T11:59:43Z.
Code review location:
src/startup_stubs/audio_sink.h; line 107For 5.1/7.1-to-mono conversion, clipping
leftandrightbefore averaging distorts the mix even when the final mono sample would be within range. A valid 5.1 frame withFL=1,FR=-1,FC=1and all other channels zero should produce approximately0.7071, but the pure converter outputs0.3536because only the left intermediate clips. This attenuates the center contribution unnecessarily. For a mono target, average the unclipped stereo sums and then clamp the final mono value.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:08:58Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:09:02Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T12:28:46Z.
Maintainer update at
b1d43427preserves equal-channel playback and mono fan-out for four-channel endpoints, and clears interpolation state when reopening the endpoint. Windows Release startup_audio_output passed, including the new pure checks and the endpoint path.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:08:58Z.
Code review location:
src/startup_stubs/audio_sink.h; line 156Fixed in
66677341: Resampler phase and the boundary frame now carry across accepted blocks (ResampleState, reset on format change; committed only when a block is accepted), so output no longer depends on block splitting. Covered by new pure checks.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:09:02Z.
Code review location:
src/startup_stubs/audio_sink.h; line 107Fixed in
66677341: 5.1/7.1 to mono now averages the unclipped stereo sums and clamps only the final value (FL=1, FR=-1, FC=1 gives 0.7071); stereo targets still clamp per channel. Covered by new pure checks.