Commit 14c44d0b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

xaudio2: Use the preprocessor to modify definitions in xaudio2.idl and xaudio2fx.idl.

Instead of including the IDLs directly, define a local IDL that #includes them, with XAUDIO2_VER defined, and include that generated header. Get rid of compat.c, and use XAUDIO2_VER to modify the code in the other source files. Build the tests for both xaudio2_7 and xaudio2_8 using PARENTSRC, and use XAUDIO2_VER to select between them. This mirrors the approach taken for d3dcompiler, and makes it easier to test more xaudio2 versions in the future.
parent c80285ff
......@@ -22028,6 +22028,7 @@ wine_fn_config_makefile dlls/xaudio2_6 enable_xaudio2_6
wine_fn_config_makefile dlls/xaudio2_7 enable_xaudio2_7
wine_fn_config_makefile dlls/xaudio2_7/tests enable_tests
wine_fn_config_makefile dlls/xaudio2_8 enable_xaudio2_8
wine_fn_config_makefile dlls/xaudio2_8/tests enable_tests
wine_fn_config_makefile dlls/xaudio2_9 enable_xaudio2_9
wine_fn_config_makefile dlls/xinput1_1 enable_xinput1_1
wine_fn_config_makefile dlls/xinput1_2 enable_xinput1_2
......
......@@ -3265,6 +3265,7 @@ WINE_CONFIG_MAKEFILE(dlls/xaudio2_6)
WINE_CONFIG_MAKEFILE(dlls/xaudio2_7)
WINE_CONFIG_MAKEFILE(dlls/xaudio2_7/tests)
WINE_CONFIG_MAKEFILE(dlls/xaudio2_8)
WINE_CONFIG_MAKEFILE(dlls/xaudio2_8/tests)
WINE_CONFIG_MAKEFILE(dlls/xaudio2_9)
WINE_CONFIG_MAKEFILE(dlls/xinput1_1)
WINE_CONFIG_MAKEFILE(dlls/xinput1_2)
......
......@@ -10,3 +10,5 @@ C_SRCS = \
xaudio_allocator.c
RC_SRCS = version.rc
IDL_SRCS = xaudio_classes.idl
......@@ -8,3 +8,5 @@ C_SRCS = \
xapo.c \
xapofx.c \
xaudio_allocator.c
IDL_SRCS = xaudio_classes.idl
......@@ -10,3 +10,5 @@ C_SRCS = \
xaudio_allocator.c
RC_SRCS = version.rc
IDL_SRCS = xaudio_classes.idl
......@@ -8,3 +8,5 @@ C_SRCS = \
xapo.c \
xapofx.c \
xaudio_allocator.c
IDL_SRCS = xaudio_classes.idl
......@@ -8,3 +8,5 @@ C_SRCS = \
xapo.c \
xapofx.c \
xaudio_allocator.c
IDL_SRCS = xaudio_classes.idl
......@@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
xapo.c \
xaudio_allocator.c \
xaudio_dll.c
......
......@@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
xapo.c \
xaudio_allocator.c \
xaudio_dll.c
......
......@@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
xapo.c \
xaudio_allocator.c \
xaudio_dll.c
......
......@@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
xapo.c \
xaudio_allocator.c \
xaudio_dll.c
......
......@@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
xapo.c \
xaudio_allocator.c \
xaudio_dll.c
......
......@@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
xapo.c \
xaudio_allocator.c \
xaudio_dll.c
......
......@@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
xapo.c \
xaudio_allocator.c \
xaudio_dll.c
......
......@@ -4,7 +4,6 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid
EXTRAINCL = $(FAUDIO_PE_CFLAGS)
C_SRCS = \
compat.c \
x3daudio.c \
xapo.c \
xapofx.c \
......
This source diff could not be displayed because it is too large. You can view the blob instead.
TESTDLL = xaudio2_7.dll
IMPORTS = ole32
EXTRADEFS = -DXAUDIO2_VER=7
C_SRCS = \
xaudio2.c
IDL_SRCS = xaudio_classes.idl
/*
* COM Classes for xaudio
*
* Copyright 2015 Guillaume Charifi
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep header
#include "xaudio2.idl"
#include "xaudio2fx.idl"
......@@ -24,7 +24,6 @@
#define COBJMACROS
#include "xaudio_private.h"
#include "xaudio2fx.h"
#include "xapofx.h"
#include "wine/debug.h"
......@@ -366,11 +365,11 @@ static HRESULT WINAPI xapocf_CreateInstance(IClassFactory *iface, IUnknown *pOut
return CLASS_E_NOAGGREGATION;
#if XAUDIO2_VER < 8 && !defined(XAPOFX1_VER)
if (IsEqualGUID(This->class, &CLSID_AudioVolumeMeter27))
if (IsEqualGUID(This->class, &CLSID_AudioVolumeMeter))
{
hr = volume_meter_create(&object);
}
else if (IsEqualGUID(This->class, &CLSID_AudioReverb27))
else if (IsEqualGUID(This->class, &CLSID_AudioReverb))
{
hr = reverb_create(&object);
}
......
......@@ -18,188 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep header
#pragma makedep register
#if XAUDIO2_VER == 7
[
helpstring("XAudio2 Class"),
threading(both),
uuid(5a508685-a254-4fba-9b82-9a24b00306af)
]
coclass XAudio27 { interface IXAudio27; }
[
helpstring("XAudio2 Volume Meter Class"),
threading(both),
uuid(cac1105f-619b-4d04-831a-44e1cbf12d57)
]
coclass AudioVolumeMeter { interface IUnknown; }
[
helpstring("XAudio2 Reverb Class"),
threading(both),
uuid(6a93130e-1d53-41d1-a9cf-e758800bb179)
]
coclass AudioReverb { interface IUnknown; }
#endif /* XAUDIO2_VER == 7 */
#if XAUDIO2_VER == 6
[
helpstring("XAudio2.6 Class"),
threading(both),
uuid(3eda9b49-2085-498b-9bb2-39a6778493de)
]
coclass XAudio26 { interface IXAudio27; }
[
helpstring("XAudio2.6 AudioReverb Class"),
threading(both),
uuid(cecec95a-d894-491a-bee3-5e106fb59f2d)
]
coclass AudioReverb26 { interface IXAPO; }
[
helpstring("XAudio2.6 AudioVolumeMeter Class"),
threading(both),
uuid(e48c5a3f-93ef-43bb-a092-2c7ceb946f27)
]
coclass AudioVolumeMeter26 { interface IXAPO; }
#endif /* XAUDIO2_VER == 6 */
#if XAUDIO2_VER == 5
[
helpstring("XAudio2.5 Class"),
threading(both),
uuid(4c9b6dde-6809-46e6-a278-9b6a97588670)
]
coclass XAudio25 { interface IXAudio27; }
[
helpstring("XAudio2.5 AudioReverb Class"),
threading(both),
uuid(d06df0d0-8518-441e-822f-5451d5c595b8)
]
coclass AudioReverb25 { interface IXAPO; }
[
helpstring("XAudio2.5 AudioVolumeMeter Class"),
threading(both),
uuid(2139e6da-c341-4774-9ac3-b4e026347f64)
]
coclass AudioVolumeMeter25 { interface IXAPO; }
#endif /* XAUDIO2_VER == 5 */
#if XAUDIO2_VER == 4
[
helpstring("XAudio2.4 Class"),
threading(both),
uuid(03219e78-5bc3-44d1-b92e-f63d89cc6526)
]
coclass XAudio24 { interface IXAudio27; }
[
helpstring("XAudio2.4 AudioReverb Class"),
threading(both),
uuid(8bb7778b-645b-4475-9a73-1de3170bd3af)
]
coclass AudioReverb24 { interface IXAPO; }
[
helpstring("XAudio2.4 AudioVolumeMeter Class"),
threading(both),
uuid(c7338b95-52b8-4542-aa79-42eb016c8c1c)
]
coclass AudioVolumeMeter24 { interface IXAPO; }
#endif /* XAUDIO2_VER == 4 */
#if XAUDIO2_VER == 3
[
helpstring("XAudio2.3 Class"),
threading(both),
uuid(4c5e637a-16c7-4de3-9c46-5ed22181962d)
]
coclass XAudio23 { interface IXAudio27; }
[
helpstring("XAudio2.3 AudioReverb Class"),
threading(both),
uuid(9cab402c-1d37-44b4-886d-fa4f36170a4c)
]
coclass AudioReverb23 { interface IXAPO; }
[
helpstring("XAudio2.3 AudioVolumeMeter Class"),
threading(both),
uuid(e180344b-ac83-4483-959e-18a5c56a5e19)
]
coclass AudioVolumeMeter23 { interface IXAPO; }
#endif /* XAUDIO2_VER == 3 */
#if XAUDIO2_VER == 2
[
helpstring("XAudio2.2 Class"),
threading(both),
uuid(b802058a-464a-42db-bc10-b650d6f2586a)
]
coclass XAudio22 { interface IXAudio22; }
[
helpstring("XAudio2.2 AudioReverb Class"),
threading(both),
uuid(629cf0de-3ecc-41e7-9926-f7e43eebec51)
]
coclass AudioReverb22 { interface IXAPO; }
[
helpstring("XAudio2.2 AudioVolumeMeter Class"),
threading(both),
uuid(f5ca7b34-8055-42c0-b836-216129eb7e30)
]
coclass AudioVolumeMeter22 { interface IXAPO; }
#endif /* XAUDIO2_VER == 2 */
#if XAUDIO2_VER == 1
[
helpstring("XAudio2.1 Class"),
threading(both),
uuid(e21a7345-eb21-468e-be50-804db97cf708)
]
coclass XAudio21 { interface IXAudio22; }
[
helpstring("XAudio2.1 AudioReverb Class"),
threading(both),
uuid(f4769300-b949-4df9-b333-00d33932e9a6)
]
coclass AudioReverb21 { interface IXAPO; }
[
helpstring("XAudio2.1 AudioVolumeMeter Class"),
threading(both),
uuid(c1e3f122-a2ea-442c-854f-20d98f8357a1)
]
coclass AudioVolumeMeter21 { interface IXAPO; }
#endif /* XAUDIO2_VER == 1 */
#if XAUDIO2_VER == 0
[
helpstring("XAudio2.0 Class"),
threading(both),
uuid(fac23f48-31f5-45a8-b49b-5225d61401aa)
]
coclass XAudio20 { interface IXAudio20; }
[
helpstring("XAudio2.0 AudioReverb Class"),
threading(both),
uuid(6f6ea3a9-2cf5-41cf-91c1-2170b1540063)
]
coclass AudioReverb20 { interface IXAPO; }
[
helpstring("XAudio2.0 AudioVolumeMeter Class"),
threading(both),
uuid(c0c56f46-29b1-44e9-9939-a32ce86867e2)
]
coclass AudioVolumeMeter20 { interface IXAPO; }
#endif /* XAUDIO2_VER == 0 */
#include "xaudio2.idl"
#include "xaudio2fx.idl"
......@@ -20,7 +20,14 @@
#include "windef.h"
#include "wine/list.h"
#include "xaudio2.h"
/* Don't include xaudio2.h directly; it's generated from an IDL with ifdefs and
* hence is frozen at version 2.7. Instead include that IDL in a local IDL and
* include the generated header.
*
* Because shared sources are compiled from the C file in the xaudio2_7
* directory, we need to use angle brackets here to prevent the compiler from
* picking up xaudio_classes.h from that directory for other versions. */
#include <xaudio_classes.h>
#include "xapo.h"
#include <FAudio.h>
......@@ -52,31 +59,10 @@ typedef struct _XA2XAPOFXImpl {
typedef struct _XA2VoiceImpl {
IXAudio2SourceVoice IXAudio2SourceVoice_iface;
#if XAUDIO2_VER == 0
IXAudio20SourceVoice IXAudio20SourceVoice_iface;
#elif XAUDIO2_VER <= 3
IXAudio23SourceVoice IXAudio23SourceVoice_iface;
#elif XAUDIO2_VER <= 7
IXAudio27SourceVoice IXAudio27SourceVoice_iface;
#endif
IXAudio2SubmixVoice IXAudio2SubmixVoice_iface;
#if XAUDIO2_VER == 0
IXAudio20SubmixVoice IXAudio20SubmixVoice_iface;
#elif XAUDIO2_VER <= 3
IXAudio23SubmixVoice IXAudio23SubmixVoice_iface;
#elif XAUDIO2_VER <= 7
IXAudio27SubmixVoice IXAudio27SubmixVoice_iface;
#endif
IXAudio2MasteringVoice IXAudio2MasteringVoice_iface;
#if XAUDIO2_VER == 0
IXAudio20MasteringVoice IXAudio20MasteringVoice_iface;
#elif XAUDIO2_VER <= 3
IXAudio23MasteringVoice IXAudio23MasteringVoice_iface;
#elif XAUDIO2_VER <= 7
IXAudio27MasteringVoice IXAudio27MasteringVoice_iface;
#endif
FAudioVoiceCallback FAudioVoiceCallback_vtbl;
FAudioEffectChain *effect_chain;
......@@ -101,16 +87,6 @@ typedef struct _XA2VoiceImpl {
typedef struct _IXAudio2Impl {
IXAudio2 IXAudio2_iface;
#if XAUDIO2_VER == 0
IXAudio20 IXAudio20_iface;
#elif XAUDIO2_VER <= 2
IXAudio22 IXAudio22_iface;
#elif XAUDIO2_VER <= 3
IXAudio23 IXAudio23_iface;
#elif XAUDIO2_VER <= 7
IXAudio27 IXAudio27_iface;
#endif
CRITICAL_SECTION lock;
struct list voices;
......@@ -127,39 +103,6 @@ typedef struct _IXAudio2Impl {
IXAudio2EngineCallback **cbs;
} IXAudio2Impl;
#if XAUDIO2_VER == 0
extern const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio20SourceVoice(IXAudio20SourceVoice *iface) DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio20SubmixVoice(IXAudio20SubmixVoice *iface) DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio20MasteringVoice(IXAudio20MasteringVoice *iface) DECLSPEC_HIDDEN;
#elif XAUDIO2_VER <= 3
extern const IXAudio23SourceVoiceVtbl XAudio23SourceVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio23SourceVoice(IXAudio23SourceVoice *iface) DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio23SubmixVoice(IXAudio23SubmixVoice *iface) DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio23MasteringVoice(IXAudio23MasteringVoice *iface) DECLSPEC_HIDDEN;
#elif XAUDIO2_VER <= 7
extern const IXAudio27SourceVoiceVtbl XAudio27SourceVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio27SubmixVoiceVtbl XAudio27SubmixVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio27MasteringVoiceVtbl XAudio27MasteringVoice_Vtbl DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio27SourceVoice(IXAudio27SourceVoice *iface) DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio27SubmixVoice(IXAudio27SubmixVoice *iface) DECLSPEC_HIDDEN;
extern XA2VoiceImpl *impl_from_IXAudio27MasteringVoice(IXAudio27MasteringVoice *iface) DECLSPEC_HIDDEN;
#endif
#if XAUDIO2_VER == 0
extern const IXAudio20Vtbl XAudio20_Vtbl DECLSPEC_HIDDEN;
#elif XAUDIO2_VER <= 2
extern const IXAudio22Vtbl XAudio22_Vtbl DECLSPEC_HIDDEN;
#elif XAUDIO2_VER <= 3
extern const IXAudio23Vtbl XAudio23_Vtbl DECLSPEC_HIDDEN;
#elif XAUDIO2_VER <= 7
extern const IXAudio27Vtbl XAudio27_Vtbl DECLSPEC_HIDDEN;
#endif
/* xaudio_dll.c */
extern HRESULT xaudio2_initialize(IXAudio2Impl *This, UINT32 flags, XAUDIO2_PROCESSOR proc) DECLSPEC_HIDDEN;
extern FAudioEffectChain *wrap_effect_chain(const XAUDIO2_EFFECT_CHAIN *pEffectChain) DECLSPEC_HIDDEN;
......
EXTRADEFS = -DXAUDIO2_VER=8
MODULE = xaudio2_8.dll
IMPORTLIB = xaudio2_8
IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid
EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
x3daudio.c \
xapo.c \
xapofx.c \
......
TESTDLL = xaudio2_8.dll
IMPORTS = ole32 xaudio2_8
EXTRADEFS = -DXAUDIO2_VER=8
PARENTSRC = ../../xaudio2_7/tests
C_SRCS = \
xaudio2.c
IDL_SRCS = xaudio_classes.idl
......@@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
x3daudio.c \
xapo.c \
xapofx.c \
......
......@@ -18,114 +18,58 @@
import "unknwn.idl";
[
uuid(c0c56f46-29b1-44e9-9939-a32ce86867e2)
]
coclass AudioVolumeMeter20 {
interface IUnknown;
}
#ifndef XAUDIO2_VER
#define XAUDIO2_VER 9
#endif
#if XAUDIO2_VER < 8
[
threading(both),
#if XAUDIO2_VER == 0
uuid(c0c56f46-29b1-44e9-9939-a32ce86867e2)
#elif XAUDIO2_VER == 1
uuid(c1e3f122-a2ea-442c-854f-20d98f8357a1)
]
coclass AudioVolumeMeter21 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 2
uuid(f5ca7b34-8055-42c0-b836-216129eb7e30)
]
coclass AudioVolumeMeter22 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 3
uuid(e180344b-ac83-4483-959e-18a5c56a5e19)
]
coclass AudioVolumeMeter23 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 4
uuid(c7338b95-52b8-4542-aa79-42eb016c8c1c)
]
coclass AudioVolumeMeter24 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 5
uuid(2139e6da-c341-4774-9ac3-b4e026347f64)
]
coclass AudioVolumeMeter25 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 6
uuid(e48c5a3f-93ef-43bb-a092-2c7ceb946f27)
]
coclass AudioVolumeMeter26 {
interface IUnknown;
}
[
#else
uuid(cac1105f-619b-4d04-831a-44e1cbf12d57)
#endif
]
coclass AudioVolumeMeter27 {
interface IUnknown;
}
coclass AudioVolumeMeter {}
[
threading(both),
#if XAUDIO2_VER == 0
uuid(6f6ea3a9-2cf5-41cf-91c1-2170b1540063)
]
coclass AudioReverb20 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 1
uuid(f4769300-b949-4df9-b333-00d33932e9a6)
]
coclass AudioReverb21 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 2
uuid(629cf0de-3ecc-41e7-9926-f7e43eebec51)
]
coclass AudioReverb22 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 3
uuid(9cab402c-1d37-44b4-886d-fa4f36170a4c)
]
coclass AudioReverb23 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 4
uuid(8bb7778b-645b-4475-9a73-1de3170bd3af)
]
coclass AudioReverb24 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 5
uuid(d06df0d0-8518-441e-822f-5451d5c595b8)
]
coclass AudioReverb25 {
interface IUnknown;
}
[
#elif XAUDIO2_VER == 6
uuid(cecec95a-d894-491a-bee3-5e106fb59f2d)
]
coclass AudioReverb26 {
interface IUnknown;
}
[
#else
uuid(6a93130e-1d53-41d1-a9cf-e758800bb179)
#endif
]
coclass AudioReverb27 {
interface IUnknown;
}
coclass AudioReverb {}
#else
HRESULT __stdcall CreateAudioReverb(IUnknown **out);
HRESULT __stdcall CreateAudioVolumeMeter(IUnknown **out);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment