XAudio 2.9 and Windows 10 introduced a new SideDelay field in the middle of the XAUDIO2FX_REVERB_PARAMETERS structure, which causes other fields to be offseted and incorrectly read from the parameter buffer.
FAudio 20.08 introduces this new interface to create reverb effects that use the new parameter structure layout.
This fixes audio glitches in Dragon Quest Builders 2.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- configure.ac | 3 ++- dlls/xaudio2_7/xapo.c | 11 +++++++++++ include/config.h.in | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 65a7c5d6252..0573cb65e20 100644 --- a/configure.ac +++ b/configure.ac @@ -1778,7 +1778,8 @@ then [WINE_CHECK_SONAME(FAudio,FAudioCreate,,,[$FAUDIO_LIBS],[[libFAudio*]])]) WINE_CHECK_LIB_FUNCS([FAudio_CommitOperationSet \ F3DAudioInitialize8 \ - FAudioLinkedVersion], [$FAUDIO_LIBS]) + FAudioLinkedVersion \ + FAudioCreateReverb9WithCustomAllocatorEXT], [$FAUDIO_LIBS]) ]) fi WINE_NOTICE_WITH(faudio,[test "x$ac_cv_lib_soname_FAudio" = "x"], diff --git a/dlls/xaudio2_7/xapo.c b/dlls/xaudio2_7/xapo.c index e64523ea199..e47442959d3 100644 --- a/dlls/xaudio2_7/xapo.c +++ b/dlls/xaudio2_7/xapo.c @@ -313,6 +313,16 @@ static inline HRESULT get_fapo_from_clsid(REFCLSID clsid, FAPO **fapo) XAudio_Internal_Free, XAudio_Internal_Realloc ); +#if XAUDIO2_VER >= 9 && HAVE_FAUDIOCREATEREVERB9WITHCUSTOMALLOCATOREXT + if(IsEqualGUID(clsid, &CLSID_AudioReverb27)) + return FAudioCreateReverb9WithCustomAllocatorEXT( + fapo, + 0, + XAudio_Internal_Malloc, + XAudio_Internal_Free, + XAudio_Internal_Realloc + ); +#else if(IsEqualGUID(clsid, &CLSID_AudioReverb27)) return FAudioCreateReverbWithCustomAllocatorEXT( fapo, @@ -322,6 +332,7 @@ static inline HRESULT get_fapo_from_clsid(REFCLSID clsid, FAPO **fapo) XAudio_Internal_Realloc ); #endif +#endif #if XAUDIO2_VER >= 8 || defined XAPOFX1_VER if(IsEqualGUID(clsid, &CLSID_FXReverb) || IsEqualGUID(clsid, &CLSID_FXEQ) || diff --git a/include/config.h.in b/include/config.h.in index 4d479a6cb3d..292ac55eeb8 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -152,6 +152,9 @@ /* Define to 1 if you have the `fallocate' function. */ #undef HAVE_FALLOCATE
+/* Define to 1 if you have the `FAudioCreateReverb9WithCustomAllocatorEXT' function. */ +#undef HAVE_FAUDIOCREATEREVERB9WITHCUSTOMALLOCATOREXT + /* Define to 1 if you have the `FAudioLinkedVersion' function. */ #undef HAVE_FAUDIOLINKEDVERSION
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Wed, Aug 05, 2020 at 09:08:10AM +0200, Rémi Bernon wrote:
XAudio 2.9 and Windows 10 introduced a new SideDelay field in the middle of the XAUDIO2FX_REVERB_PARAMETERS structure, which causes other fields to be offseted and incorrectly read from the parameter buffer.
FAudio 20.08 introduces this new interface to create reverb effects that use the new parameter structure layout.
This fixes audio glitches in Dragon Quest Builders 2.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
configure.ac | 3 ++- dlls/xaudio2_7/xapo.c | 11 +++++++++++ include/config.h.in | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 65a7c5d6252..0573cb65e20 100644 --- a/configure.ac +++ b/configure.ac @@ -1778,7 +1778,8 @@ then [WINE_CHECK_SONAME(FAudio,FAudioCreate,,,[$FAUDIO_LIBS],[[libFAudio*]])]) WINE_CHECK_LIB_FUNCS([FAudio_CommitOperationSet \ F3DAudioInitialize8 \
FAudioLinkedVersion], [$FAUDIO_LIBS])
FAudioLinkedVersion \
FAudioCreateReverb9WithCustomAllocatorEXT], [$FAUDIO_LIBS]) ])
fi WINE_NOTICE_WITH(faudio,[test "x$ac_cv_lib_soname_FAudio" = "x"], diff --git a/dlls/xaudio2_7/xapo.c b/dlls/xaudio2_7/xapo.c index e64523ea199..e47442959d3 100644 --- a/dlls/xaudio2_7/xapo.c +++ b/dlls/xaudio2_7/xapo.c @@ -313,6 +313,16 @@ static inline HRESULT get_fapo_from_clsid(REFCLSID clsid, FAPO **fapo) XAudio_Internal_Free, XAudio_Internal_Realloc ); +#if XAUDIO2_VER >= 9 && HAVE_FAUDIOCREATEREVERB9WITHCUSTOMALLOCATOREXT
- if(IsEqualGUID(clsid, &CLSID_AudioReverb27))
return FAudioCreateReverb9WithCustomAllocatorEXT(
fapo,
0,
XAudio_Internal_Malloc,
XAudio_Internal_Free,
XAudio_Internal_Realloc
);
+#else if(IsEqualGUID(clsid, &CLSID_AudioReverb27)) return FAudioCreateReverbWithCustomAllocatorEXT( fapo, @@ -322,6 +332,7 @@ static inline HRESULT get_fapo_from_clsid(REFCLSID clsid, FAPO **fapo) XAudio_Internal_Realloc ); #endif +#endif #if XAUDIO2_VER >= 8 || defined XAPOFX1_VER if(IsEqualGUID(clsid, &CLSID_FXReverb) || IsEqualGUID(clsid, &CLSID_FXEQ) || diff --git a/include/config.h.in b/include/config.h.in index 4d479a6cb3d..292ac55eeb8 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -152,6 +152,9 @@ /* Define to 1 if you have the `fallocate' function. */ #undef HAVE_FALLOCATE
+/* Define to 1 if you have the `FAudioCreateReverb9WithCustomAllocatorEXT' function. */ +#undef HAVE_FAUDIOCREATEREVERB9WITHCUSTOMALLOCATOREXT
/* Define to 1 if you have the `FAudioLinkedVersion' function. */ #undef HAVE_FAUDIOLINKEDVERSION
-- 2.27.0