feat(xaudio2): forward X3DAudio and the XAudio2FX reverb and volume-meter factories to the host #40

Open
github-bot wants to merge 2 commits from github-bot/gh-40 into main AGit
Owner

@⁠wildheathen on GitHub · 2026-11-21 19:28 UTC · original
wildheathen:feat/xaudio2-x3daudio-fx → main · +212 −11 · 4 files · 2 commits · open

Summary

Titles import X3DAudioInitialize/X3DAudioCalculate and the XAudio2FX factories from the same DLL as XAudio2, so xaudio2_9.dll now exports them and forwards each to the host's own XAudio2_9.dll, the way XAudio2Create already works:

  • X3DAudioInitialize(UINT32 SpeakerChannelMask, FLOAT32 SpeedOfSound, X3DAUDIO_HANDLE) and X3DAudioCalculate(...).
  • CreateAudioReverb(void** ppApo) and CreateAudioVolumeMeter(void** ppApo): the factories behind the inline XAudio2CreateReverb/XAudio2CreateVolumeMeter wrappers. Forwarding hands the title the host's real XAPO (reference counting, IXAPO, IXAPOParameters and the DSP are the host's), so nothing about the effect is reimplemented.

Details:

  • The host DLL is loaded from System32 by full path. LoadLibraryW("XAudio2_9.dll") would find our own shim.
  • If the host DLL or the export is missing the forwarders answer E_FAIL (X3DAudioCalculate does nothing); a null output pointer on a factory is E_POINTER.
  • The host COM apartment helper that XAudio2Create used is factored out so the factories can use it too.
  • Signatures from the public X3DAudio and XAudio2FX references (learn.microsoft.com). Our ABI header declares only the two factories; the X3DAudio entry points are exported through the .def file because <x3daudio.h> already declares them.

Tests

tests/test_xaudio2.cpp (Windows): an emitter to the right of the listener gives the right channel more volume; each factory returns an object that answers IXAPO and IXAPOParameters, rejects an unknown IID with E_NOINTERFACE, releases to zero, and returns E_POINTER for a null output. The checks skip with a message when the host has no XAudio2_9.dll.

Verification

  • Built with MSVC + Ninja x64. Full suite: everything passes except the three tests that already fail on an unmodified origin/main (test_boot_hello_scarlett, test_boot_rt_showcase, test_d3d12_guest_texture; see #1 and #2).
**@⁠wildheathen** on GitHub · 2026-11-21 19:28 UTC · [original](https://github.com/Freminet/ScarlettX/pull/40) `wildheathen:feat/xaudio2-x3daudio-fx` → `main` · +212 −11 · 4 files · 2 commits · open ## Summary Titles import `X3DAudioInitialize`/`X3DAudioCalculate` and the XAudio2FX factories from the same DLL as XAudio2, so `xaudio2_9.dll` now exports them and forwards each to the host's own `XAudio2_9.dll`, the way `XAudio2Create` already works: - `X3DAudioInitialize(UINT32 SpeakerChannelMask, FLOAT32 SpeedOfSound, X3DAUDIO_HANDLE)` and `X3DAudioCalculate(...)`. - `CreateAudioReverb(void** ppApo)` and `CreateAudioVolumeMeter(void** ppApo)`: the factories behind the inline `XAudio2CreateReverb`/`XAudio2CreateVolumeMeter` wrappers. Forwarding hands the title the host's real XAPO (reference counting, `IXAPO`, `IXAPOParameters` and the DSP are the host's), so nothing about the effect is reimplemented. Details: - The host DLL is loaded from `System32` by full path. `LoadLibraryW("XAudio2_9.dll")` would find our own shim. - If the host DLL or the export is missing the forwarders answer `E_FAIL` (`X3DAudioCalculate` does nothing); a null output pointer on a factory is `E_POINTER`. - The host COM apartment helper that `XAudio2Create` used is factored out so the factories can use it too. - Signatures from the public X3DAudio and XAudio2FX references (learn.microsoft.com). Our ABI header declares only the two factories; the X3DAudio entry points are exported through the `.def` file because `<x3daudio.h>` already declares them. ## Tests `tests/test_xaudio2.cpp` (Windows): an emitter to the right of the listener gives the right channel more volume; each factory returns an object that answers `IXAPO` and `IXAPOParameters`, rejects an unknown IID with `E_NOINTERFACE`, releases to zero, and returns `E_POINTER` for a null output. The checks skip with a message when the host has no `XAudio2_9.dll`. ## Verification - Built with MSVC + Ninja x64. Full suite: everything passes except the three tests that already fail on an unmodified `origin/main` (`test_boot_hello_scarlett`, `test_boot_rt_showcase`, `test_d3d12_guest_texture`; see #1 and #2).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:56:45 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/40/head:github-bot/gh-40'
git switch 'github-bot/gh-40'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-40'
git switch 'github-bot/gh-40'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-40'
git switch 'github-bot/gh-40'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-40'
git switch 'main'
git merge --squash 'github-bot/gh-40'
git switch 'main'
git merge --ff-only 'github-bot/gh-40'
git switch 'main'
git merge 'github-bot/gh-40'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.