[PATCH] xaudio2: Avoid redefining several F3DAudio related constants.

Andrew Eikum aeikum at codeweavers.com
Thu Apr 30 07:40:41 CDT 2020


On Thu, Apr 30, 2020 at 12:28:10AM +0200, Gerald Pfeifer wrote:
> I noticed a bunch of compiler warnings like the following issued
> by GCC 10:
> 
>   In file included from ../xaudio2_7/x3daudio.c:29:
>   .../include/F3DAudio.h:69: warning: "SPEAKER_2POINT1" redefined
>   ../../include/x3daudio.h:127: note: this is the location of the previous definition
> 
> Our own include/x3daudio.h tries to prevent that via
> 
>   #ifndef _SPEAKER_POSITIONS_
>   #define _SPEAKER_POSITIONS_
> 
> However, current it is included *before* the system provided F3DAudio.h,
> so this safety net falls short.
> 
> Fixed thusly by changing the order of these two include files so that the
> system provided one comes first.
> 

I'm not opposed to this, but I think there's a better solution. The
platform SDK and Wine's header both check for "#ifndef SPEAKER_MONO"
before defining the speaker arrangements symbols.  However, FAudio's
header checks for "#ifndef _SPEAKER_COMBINATIONS_" instead. This
symbol doesn't occur in the platform SDK.

Perhaps we should change FAudio's header to check for SPEAKER_MONO
instead, to match the platform SDK?

Andrew

> Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
> ---
>  dlls/xaudio2_7/x3daudio.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/dlls/xaudio2_7/x3daudio.c b/dlls/xaudio2_7/x3daudio.c
> index 240cd5c101..6f16ba3470 100644
> --- a/dlls/xaudio2_7/x3daudio.c
> +++ b/dlls/xaudio2_7/x3daudio.c
> @@ -20,15 +20,13 @@
>  #include "config.h"
>  
>  #include <stdarg.h>
> -
> +#include <F3DAudio.h>
>  #include "windef.h"
>  #include "winbase.h"
>  #include "x3daudio.h"
>  
>  #include "wine/debug.h"
>  
> -#include <F3DAudio.h>
> -
>  #if XAUDIO2_VER >= 8 || defined X3DAUDIO1_VER
>  WINE_DEFAULT_DEBUG_CHANNEL(xaudio2);
>  #endif
> -- 
> 2.25.0



More information about the wine-devel mailing list