From d341efeff071532801fdc224062eb9e60dc5aea0 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Thu, 23 May 2019 13:01:31 -0400 Subject: [PATCH] xaudio2: Use new features from FAudio 19.06 (but keep compatibility for <=19.05). Signed-off-by: Ethan Lee Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- configure | 17 +++++++++++++++++ configure.ac | 4 ++++ dlls/xaudio2_7/x3daudio.c | 6 ++++++ dlls/xaudio2_7/xaudio_dll.c | 6 +++++- include/config.h.in | 6 ++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/configure b/configure index c206e8d6400..2ad2639596d 100755 --- a/configure +++ b/configure @@ -14966,6 +14966,23 @@ CPPFLAGS=$ac_save_CPPFLAGS test -z "$FAUDIO_CFLAGS" || FAUDIO_CFLAGS=`echo " $FAUDIO_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` test -z "$FAUDIO_LIBS" || FAUDIO_LIBS=`echo " $FAUDIO_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` + ac_wine_check_funcs_save_LIBS="$LIBS" +LIBS="$LIBS $FAUDIO_LIBS" +for ac_func in \ + FAudio_CommitOperationSet \ + F3DAudioInitialize8 +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +LIBS="$ac_wine_check_funcs_save_LIBS" fi if test "x$ac_cv_lib_soname_FAudio" = "x"; then : case "x$with_faudio" in diff --git a/configure.ac b/configure.ac index 83a8181f33c..f548e3eb4cb 100644 --- a/configure.ac +++ b/configure.ac @@ -1690,6 +1690,10 @@ then WINE_PACKAGE_FLAGS(FAUDIO,[faudio],[-lFAudio],,, [AC_CHECK_HEADERS([FAudio.h], [WINE_CHECK_SONAME(FAudio,FAudioCreate,,,[$FAUDIO_LIBS],[[libFAudio*]])])]) + WINE_CHECK_LIB_FUNCS(\ + FAudio_CommitOperationSet \ + F3DAudioInitialize8, + [$FAUDIO_LIBS]) fi WINE_NOTICE_WITH(faudio,[test "x$ac_cv_lib_soname_FAudio" = "x"], [libFAudio ${notice_platform}development files not found, XAudio2 won't be supported.]) diff --git a/dlls/xaudio2_7/x3daudio.c b/dlls/xaudio2_7/x3daudio.c index ee3367e092c..5bc7c8473c6 100644 --- a/dlls/xaudio2_7/x3daudio.c +++ b/dlls/xaudio2_7/x3daudio.c @@ -17,6 +17,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" + #include #include "windef.h" @@ -51,8 +53,12 @@ HRESULT CDECL X3DAudioInitialize(UINT32 chanmask, float speedofsound, X3DAUDIO_HANDLE handle) { TRACE("0x%x, %f, %p\n", chanmask, speedofsound, handle); +#ifdef HAVE_F3DAUDIOINITIALIZE8 + return F3DAudioInitialize8(chanmask, speedofsound, handle); +#else F3DAudioInitialize(chanmask, speedofsound, handle); return S_OK; +#endif } #endif /* XAUDIO2_VER >= 8 */ diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c index 70ba24375fd..f1356425246 100644 --- a/dlls/xaudio2_7/xaudio_dll.c +++ b/dlls/xaudio2_7/xaudio_dll.c @@ -1797,9 +1797,13 @@ static HRESULT WINAPI IXAudio2Impl_CommitChanges(IXAudio2 *iface, { IXAudio2Impl *This = impl_from_IXAudio2(iface); - TRACE("(%p)->(0x%x): stub!\n", This, operationSet); + TRACE("(%p)->(0x%x)\n", This, operationSet); +#ifdef HAVE_FAUDIO_COMMITOPERATIONSET + return FAudio_CommitOperationSet(This->faudio, operationSet); +#else return FAudio_CommitChanges(This->faudio); +#endif } static void WINAPI IXAudio2Impl_GetPerformanceData(IXAudio2 *iface, diff --git a/include/config.h.in b/include/config.h.in index 774e9ee50e1..ce5c1570541 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -146,9 +146,15 @@ /* Define to 1 if you have the `expm1f' function. */ #undef HAVE_EXPM1F +/* Define to 1 if you have the `F3DAudioInitialize8' function. */ +#undef HAVE_F3DAUDIOINITIALIZE8 + /* Define to 1 if you have the `fallocate' function. */ #undef HAVE_FALLOCATE +/* Define to 1 if you have the `FAudio_CommitOperationSet' function. */ +#undef HAVE_FAUDIO_COMMITOPERATIONSET + /* Define to 1 if you have the header file. */ #undef HAVE_FAUDIO_H