Fix XAudio2 2.7→2.9 effect chain compatibility and GetState flags (tryname) - #1
Open
passed111 wants to merge 2 commits into
Open
Fix XAudio2 2.7→2.9 effect chain compatibility and GetState flags (tryname)#1passed111 wants to merge 2 commits into
passed111 wants to merge 2 commits into
Conversation
## Fix: XAudio2 2.7→2.9 effect chain compatibility and GetState flags This PR fixes three audio bugs in the Audio Proxy module when redirecting the game's XAudio2 2.7 engine to the system 2.9 engine: ### 1. GetState flags not cleared (crash/visual bug) The game (built against 2.7) calls `IXAudio2SourceVoice::GetState` with the 2.7 single-argument signature. The 2.9 engine added a `Flags` argument that the 2.7 caller never initialises, so the 2.9 engine reads a garbage `Flags` value. When bit 1 (`XAUDIO2_VOICE_NOSAMPLESPLAYED`) is set, `SamplesPlayed` is zeroed out, causing: - Lip-sync twitches on OG (1.10.163) - Audio state-machine collapse on AE (no voice / music reset / sirens) Fix: pass `Flags=0` explicitly when forwarding to the 2.9 engine. ### 2. Effect chain dropped (dry radio / power-armor audio) The `AD_USE_AUDIOFX_XAPO=0` branch replaced `pEffectChain` with `nullptr` in all `Create*Voice` / `SetEffectChain` calls, silently stripping every effect (radio EQ, power-armor processing, etc.). Fix: forward `pEffectChain` verbatim. ### 3. 2.7 APO rejected by 2.9 engine (E_NOINTERFACE) The game's built-in APO classes (BSStateVariableFilter, BSOverdrive, BSDelayEffect, BSCXAPOWrapper, MonitorAPO) are compiled against the 2.7 DXSDK and only recognise `IID_IXAPO27`. The 2.9 engine queries for `IID_IXAPO_29` and rejects them, so even with the effect chain forwarded the effects are never attached. Fix: `EnsureEffectChainCompat` patches each 2.7 APO vtable's `QueryInterface` slot on first use to also accept `IID_IXAPO_29`. --- Credit: the GetState and QI compatibility approach is adapted from the **AudioDeviceFollowFix** plugin by **tryname** (Nexus Mods).
… tryname) ## Fix: XAudio2 2.7→2.9 effect chain compatibility and GetState flags This PR fixes three audio bugs in the Audio Proxy module when redirecting the game's XAudio2 2.7 engine to the system 2.9 engine: ### 1. GetState flags not cleared (crash/visual bug) The game (built against 2.7) calls `IXAudio2SourceVoice::GetState` with the 2.7 single-argument signature. The 2.9 engine added a `Flags` argument that the 2.7 caller never initialises, so the 2.9 engine reads a garbage `Flags` value. When bit 1 (`XAUDIO2_VOICE_NOSAMPLESPLAYED`) is set, `SamplesPlayed` is zeroed out, causing: - Lip-sync twitches on OG (1.10.163) - Audio state-machine collapse on AE (no voice / music reset / sirens) Fix: pass `Flags=0` explicitly when forwarding to the 2.9 engine. ### 2. Effect chain dropped (dry radio / power-armor audio) The `AD_USE_AUDIOFX_XAPO=0` branch replaced `pEffectChain` with `nullptr` in all `Create*Voice` / `SetEffectChain` calls, silently stripping every effect (radio EQ, power-armor processing, etc.). Fix: forward `pEffectChain` verbatim. ### 3. 2.7 APO rejected by 2.9 engine (E_NOINTERFACE) The game's built-in APO classes (BSStateVariableFilter, BSOverdrive, BSDelayEffect, BSCXAPOWrapper, MonitorAPO) are compiled against the 2.7 DXSDK and only recognise `IID_IXAPO27`. The 2.9 engine queries for `IID_IXAPO_29` and rejects them, so even with the effect chain forwarded the effects are never attached. Fix: `EnsureEffectChainCompat` patches each 2.7 APO vtable's `QueryInterface` slot on first use to also accept `IID_IXAPO_29`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: XAudio2 2.7→2.9 effect chain compatibility and GetState flags
This PR fixes three audio bugs in the Audio Proxy module when redirecting the game's XAudio2 2.7 engine to the system 2.9 engine:
1. GetState flags not cleared (crash/visual bug) The game (built against 2.7) calls
IXAudio2SourceVoice::GetStatewith the 2.7 single-argument signature. The 2.9 engine added aFlagsargument that the 2.7 caller never initialises, so the 2.9 engine reads a garbageFlagsvalue. When bit 1 (XAUDIO2_VOICE_NOSAMPLESPLAYED) is set,SamplesPlayedis zeroed out, causing:Fix: pass
Flags=0explicitly when forwarding to the 2.9 engine.2. Effect chain dropped (dry radio / power-armor audio) The
AD_USE_AUDIOFX_XAPO=0branch replacedpEffectChainwithnullptrin allCreate*Voice/SetEffectChaincalls, silently stripping every effect (radio EQ, power-armor processing, etc.).Fix: forward
pEffectChainverbatim.3. 2.7 APO rejected by 2.9 engine (E_NOINTERFACE) The game's built-in APO classes (BSStateVariableFilter, BSOverdrive, BSDelayEffect, BSCXAPOWrapper, MonitorAPO) are compiled against the 2.7 DXSDK and only recognise
IID_IXAPO27. The 2.9 engine queries forIID_IXAPO_29and rejects them, so even with the effect chain forwarded the effects are never attached.Fix:
EnsureEffectChainCompatpatches each 2.7 APO vtable'sQueryInterfaceslot on first use to also acceptIID_IXAPO_29.Credit: the GetState and QI compatibility approach is adapted from the AudioDeviceFollowFix plugin by tryname (Nexus Mods).