[PATCH 3/3 (try2)] xaudio2_8: Use shared source
Andrew Eikum
aeikum at codeweavers.com
Fri Jan 8 11:35:25 CST 2016
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
Here you can see the start of the cleanup of the internal Wine CLSIDs
to support different xaudio versions in one DLL. Not needed anymore!
try2: Also disable 2_8 at configure-time if openal is not present.
configure.ac | 1 +
dlls/xaudio2/x3daudio.c | 55 ++++++++++++++
dlls/xaudio2/xapofx.c | 83 ++++++++++++++++++++
dlls/xaudio2/xaudio_classes.idl | 16 +---
dlls/xaudio2/xaudio_dll.c | 42 +++++++++--
dlls/xaudio2_8/Makefile.in | 11 ++-
dlls/xaudio2_8/xaudio_dll.c | 163 ----------------------------------------
include/xapofx.h | 4 -
8 files changed, 186 insertions(+), 189 deletions(-)
create mode 100644 dlls/xaudio2/x3daudio.c
delete mode 100644 dlls/xaudio2_8/xaudio_dll.c
diff --git a/configure.ac b/configure.ac
index 2b1dd81..b7b55b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1663,6 +1663,7 @@ if test "x$ac_cv_have_openalsoft" != xyes
then
WINE_NOTICE([openal-soft ${notice_platform}development files not found (or too old), XAudio2 won't be supported])
enable_xaudio2_7=${enable_xaudio2_7:-no}
+ enable_xaudio2_8=${enable_xaudio2_8:-no}
fi
dnl **** Check for libkstat ****
diff --git a/dlls/xaudio2/x3daudio.c b/dlls/xaudio2/x3daudio.c
new file mode 100644
index 0000000..2966f56
--- /dev/null
+++ b/dlls/xaudio2/x3daudio.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016 Andrew Eikum for CodeWeavers
+ *
+ * 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
+ */
+
+#include <stdarg.h>
+
+#include "xaudio_private.h"
+#include "x3daudio.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(xaudio2);
+
+#if XAUDIO2_VER >= 8
+HRESULT CDECL X3DAudioInitialize(UINT32 chanmask, float speedofsound,
+ X3DAUDIO_HANDLE handle)
+{
+ FIXME("0x%x, %f, %p: Stub!\n", chanmask, speedofsound, handle);
+ return S_OK;
+}
+
+void CDECL X3DAudioCalculate(const X3DAUDIO_HANDLE handle,
+ const X3DAUDIO_LISTENER *listener, const X3DAUDIO_EMITTER *emitter,
+ UINT32 flags, X3DAUDIO_DSP_SETTINGS *out)
+{
+ static int once = 0;
+ if(!once){
+ FIXME("%p %p %p 0x%x %p: Stub!\n", handle, listener, emitter, flags, out);
+ ++once;
+ }
+
+ out->LPFDirectCoefficient = 0;
+ out->LPFReverbCoefficient = 0;
+ out->ReverbLevel = 0;
+ out->DopplerFactor = 1;
+ out->EmitterToListenerAngle = 0;
+ out->EmitterToListenerDistance = 0;
+ out->EmitterVelocityComponent = 0;
+ out->ListenerVelocityComponent = 0;
+}
+#endif /* XAUDIO2_VER >= 8 */
diff --git a/dlls/xaudio2/xapofx.c b/dlls/xaudio2/xapofx.c
index f71d2f0..e3c9fc9 100644
--- a/dlls/xaudio2/xapofx.c
+++ b/dlls/xaudio2/xapofx.c
@@ -777,3 +777,86 @@ IClassFactory *make_xapo_factory(REFCLSID clsid, DWORD version)
ret->ref = 0;
return &ret->IClassFactory_iface;
}
+
+#if XAUDIO2_VER >= 8
+HRESULT WINAPI CreateAudioVolumeMeter(IUnknown **out)
+{
+ IClassFactory *cf;
+ HRESULT hr;
+
+ cf = make_xapo_factory(&CLSID_AudioVolumeMeter27, 28);
+
+ hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void**)out);
+
+ IClassFactory_Release(cf);
+
+ return hr;
+}
+
+HRESULT WINAPI CreateAudioReverb(IUnknown **out)
+{
+ IClassFactory *cf;
+ HRESULT hr;
+
+ cf = make_xapo_factory(&CLSID_AudioReverb27, 28);
+
+ hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void**)out);
+
+ IClassFactory_Release(cf);
+
+ return hr;
+}
+
+HRESULT CDECL CreateFX(REFCLSID clsid, IUnknown **out, void *initdata, UINT32 initdata_bytes)
+{
+ HRESULT hr;
+ IUnknown *obj;
+ const GUID *class = NULL;
+ IClassFactory *cf;
+
+ *out = NULL;
+
+ if(IsEqualGUID(clsid, &CLSID_FXReverb27) ||
+ IsEqualGUID(clsid, &CLSID_FXReverb))
+ class = &CLSID_AudioReverb27;
+ else if(IsEqualGUID(clsid, &CLSID_FXEQ27) ||
+ IsEqualGUID(clsid, &CLSID_FXEQ))
+ class = &CLSID_FXEQ;
+
+ if(class){
+ cf = make_xapo_factory(class, 20 + XAUDIO2_VER);
+
+ hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void**)&obj);
+ IClassFactory_Release(cf);
+ if(FAILED(hr))
+ return hr;
+ }else{
+ hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&obj);
+ if(FAILED(hr)){
+ WARN("CoCreateInstance failed: %08x\n", hr);
+ return hr;
+ }
+ }
+
+ if(initdata && initdata_bytes > 0){
+ IXAPO *xapo;
+
+ hr = IUnknown_QueryInterface(obj, &IID_IXAPO, (void**)&xapo);
+ if(SUCCEEDED(hr)){
+ hr = IXAPO_Initialize(xapo, initdata, initdata_bytes);
+
+ IXAPO_Release(xapo);
+
+ if(FAILED(hr)){
+ WARN("Initialize failed: %08x\n", hr);
+ IUnknown_Release(obj);
+ return hr;
+ }
+ }
+ }
+
+ *out = obj;
+
+ return S_OK;
+}
+#endif /* XAUDIO2_VER >= 8 */
diff --git a/dlls/xaudio2/xaudio_classes.idl b/dlls/xaudio2/xaudio_classes.idl
index 2055a26..d7ddb42 100644
--- a/dlls/xaudio2/xaudio_classes.idl
+++ b/dlls/xaudio2/xaudio_classes.idl
@@ -20,6 +20,7 @@
#pragma makedep register
+#if XAUDIO2_VER == 7
[
helpstring("XAudio2 Class"),
threading(both),
@@ -84,13 +85,6 @@ coclass FXReverb14 { interface IXAPO; }
coclass FXReverb15 { interface IXAPO; }
[
- helpstring("XAudio2.8 FXReverb Class (Wine)"),
- threading(both),
- uuid(a90bc001-e897-e897-7439-43FF02000208)
-]
-coclass FXReverb28 { interface IXAPO; }
-
-[
helpstring("XAPOFX1.1 FXEQ Class (Wine)"),
threading(both),
uuid(a90bc001-e897-e897-7439-43FF00000101)
@@ -124,10 +118,4 @@ coclass FXEQ14 { interface IXAPO; }
uuid(a90bc001-e897-e897-7439-43FF00000105)
]
coclass FXEQ15 { interface IXAPO; }
-
-[
- helpstring("XAudio2.8 FXEQ Class (Wine)"),
- threading(both),
- uuid(a90bc001-e897-e897-7439-43FF00000208)
-]
-coclass FXEQ28 { interface IXAPO; }
+#endif /* XAUDIO2_VER == 7 */
diff --git a/dlls/xaudio2/xaudio_dll.c b/dlls/xaudio2/xaudio_dll.c
index 680eebd..d012a49 100644
--- a/dlls/xaudio2/xaudio_dll.c
+++ b/dlls/xaudio2/xaudio_dll.c
@@ -2073,10 +2073,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
IsEqualGUID(rclsid, &CLSID_WINE_FXReverb15)){
factory = make_xapo_factory(&CLSID_AudioReverb27, 27);
- }else if(IsEqualGUID(rclsid, &CLSID_WINE_FXReverb28)){
- factory = make_xapo_factory(&CLSID_AudioReverb27, 28);
-
-
}else if(IsEqualGUID(rclsid, &CLSID_WINE_FXEQ10)){
factory = make_xapo_factory(&CLSID_FXEQ, 21);
}else if(IsEqualGUID(rclsid, &CLSID_WINE_FXEQ11)){
@@ -2089,8 +2085,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
factory = make_xapo_factory(&CLSID_FXEQ, 26);
}else if(IsEqualGUID(rclsid, &CLSID_WINE_FXEQ15)){
factory = make_xapo_factory(&CLSID_FXEQ, 27);
- }else if(IsEqualGUID(rclsid, &CLSID_WINE_FXEQ28)){
- factory = make_xapo_factory(&CLSID_FXEQ, 28);
}
if(!factory) return CLASS_E_CLASSNOTAVAILABLE;
@@ -2098,6 +2092,42 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
return IClassFactory_QueryInterface(factory, riid, ppv);
}
+#if XAUDIO2_VER >= 8
+HRESULT WINAPI XAudio2Create(IXAudio2 **ppxa2, UINT32 flags, XAUDIO2_PROCESSOR proc)
+{
+ HRESULT hr;
+ IXAudio2 *xa2;
+ IXAudio27 *xa27;
+ IClassFactory *cf;
+
+ cf = make_xaudio2_factory(28);
+
+ hr = IClassFactory_CreateInstance(cf, NULL, &IID_IXAudio2, (void**)&xa2);
+ IClassFactory_Release(cf);
+ if(FAILED(hr))
+ return hr;
+
+ hr = IXAudio2_QueryInterface(xa2, &IID_IXAudio27, (void**)&xa27);
+ if(FAILED(hr)){
+ IXAudio2_Release(xa2);
+ return hr;
+ }
+
+ hr = IXAudio27_Initialize(xa27, flags, proc);
+ if(FAILED(hr)){
+ IXAudio27_Release(xa27);
+ IXAudio2_Release(xa2);
+ return hr;
+ }
+
+ IXAudio27_Release(xa27);
+
+ *ppxa2 = xa2;
+
+ return S_OK;
+}
+#endif /* XAUDIO2_VER >= 8 */
+
/* returns TRUE if there is more data available in the buffer, FALSE if the
* buffer's data has all been queued */
static BOOL xa2buffer_queue_period(XA2SourceImpl *src, XA2Buffer *buf, ALuint al_buf)
diff --git a/dlls/xaudio2_8/Makefile.in b/dlls/xaudio2_8/Makefile.in
index 3ec8adc..c712dfd 100644
--- a/dlls/xaudio2_8/Makefile.in
+++ b/dlls/xaudio2_8/Makefile.in
@@ -1,6 +1,13 @@
+EXTRADEFS = -DXAUDIO2_VER=8
MODULE = xaudio2_8.dll
-IMPORTLIB = xaudio2_8
-IMPORTS = ole32
+IMPORTS = advapi32 kernel32 ole32 user32 uuid
+EXTRALIBS = $(OPENAL_LIBS)
+PARENTSRC = ../xaudio2
C_SRCS = \
+ compat.c \
+ x3daudio.c \
+ xapofx.c \
xaudio_dll.c
+
+IDL_SRCS = xaudio_classes.idl
diff --git a/dlls/xaudio2_8/xaudio_dll.c b/dlls/xaudio2_8/xaudio_dll.c
deleted file mode 100644
index 8d7b06f..0000000
--- a/dlls/xaudio2_8/xaudio_dll.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2015 Andrew Eikum for CodeWeavers
- *
- * 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
- */
-
-#include <stdarg.h>
-
-#define COBJMACROS
-
-#include "windef.h"
-#include "winbase.h"
-#include "winuser.h"
-#include "wine/debug.h"
-
-#include "initguid.h"
-#include "xaudio2.h"
-#include "xaudio2fx.h"
-#include "xapo.h"
-#include "xapofx.h"
-#include "x3daudio.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(xaudio2);
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- switch (fdwReason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls( hinstDLL );
- break;
- }
- return TRUE;
-}
-
-HRESULT WINAPI XAudio2Create(IXAudio2 **ppxa2, UINT32 flags, XAUDIO2_PROCESSOR proc)
-{
- HRESULT hr;
- IXAudio2 *xa2;
- IXAudio27 *xa27;
-
- /* create XAudio2 2.8 instance */
- hr = CoCreateInstance(&CLSID_XAudio27, NULL, CLSCTX_INPROC_SERVER,
- &IID_IXAudio2, (void**)&xa2);
- if(FAILED(hr))
- return hr;
-
- hr = IXAudio2_QueryInterface(xa2, &IID_IXAudio27, (void**)&xa27);
- if(FAILED(hr)){
- IXAudio2_Release(xa2);
- return hr;
- }
-
- hr = IXAudio27_Initialize(xa27, flags, proc);
- if(FAILED(hr)){
- IXAudio27_Release(xa27);
- IXAudio2_Release(xa2);
- return hr;
- }
-
- IXAudio27_Release(xa27);
-
- *ppxa2 = xa2;
-
- return S_OK;
-}
-
-HRESULT WINAPI CreateAudioVolumeMeter(IUnknown **out)
-{
- return CoCreateInstance(&CLSID_AudioVolumeMeter27, NULL, CLSCTX_INPROC_SERVER,
- &IID_IUnknown, (void**)out);
-}
-
-HRESULT WINAPI CreateAudioReverb(IUnknown **out)
-{
- return CoCreateInstance(&CLSID_AudioReverb27, NULL, CLSCTX_INPROC_SERVER,
- &IID_IUnknown, (void**)out);
-}
-
-HRESULT CDECL CreateFX(REFCLSID clsid, IUnknown **out, void *initdata, UINT32 initdata_bytes)
-{
- HRESULT hr;
- IUnknown *obj;
- const GUID *class;
-
- *out = NULL;
- class = clsid;
-
- if(IsEqualGUID(clsid, &CLSID_FXReverb27) ||
- IsEqualGUID(clsid, &CLSID_FXReverb))
- class = &CLSID_WINE_FXReverb28;
- else if(IsEqualGUID(clsid, &CLSID_FXEQ27) ||
- IsEqualGUID(clsid, &CLSID_FXEQ))
- class = &CLSID_WINE_FXEQ28;
-
- hr = CoCreateInstance(class, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&obj);
- if(FAILED(hr)){
- WARN("CoCreateInstance failed: %08x\n", hr);
- return hr;
- }
-
- if(initdata && initdata_bytes > 0){
- IXAPO *xapo;
-
- hr = IUnknown_QueryInterface(obj, &IID_IXAPO, (void**)&xapo);
- if(SUCCEEDED(hr)){
- hr = IXAPO_Initialize(xapo, initdata, initdata_bytes);
-
- IXAPO_Release(xapo);
-
- if(FAILED(hr)){
- WARN("Initialize failed: %08x\n", hr);
- IUnknown_Release(obj);
- return hr;
- }
- }
- }
-
- *out = obj;
-
- return S_OK;
-}
-
-HRESULT CDECL X3DAudioInitialize(UINT32 chanmask, float speedofsound,
- X3DAUDIO_HANDLE handle)
-{
- FIXME("0x%x, %f, %p: Stub!\n", chanmask, speedofsound, handle);
- return S_OK;
-}
-
-void CDECL X3DAudioCalculate(const X3DAUDIO_HANDLE handle,
- const X3DAUDIO_LISTENER *listener, const X3DAUDIO_EMITTER *emitter,
- UINT32 flags, X3DAUDIO_DSP_SETTINGS *out)
-{
- static int once = 0;
- if(!once){
- FIXME("%p %p %p 0x%x %p: Stub!\n", handle, listener, emitter, flags, out);
- ++once;
- }
-
- out->LPFDirectCoefficient = 0;
- out->LPFReverbCoefficient = 0;
- out->ReverbLevel = 0;
- out->DopplerFactor = 1;
- out->EmitterToListenerAngle = 0;
- out->EmitterToListenerDistance = 0;
- out->EmitterVelocityComponent = 0;
- out->ListenerVelocityComponent = 0;
-}
diff --git a/include/xapofx.h b/include/xapofx.h
index 86d909d..5010375 100644
--- a/include/xapofx.h
+++ b/include/xapofx.h
@@ -32,7 +32,6 @@ DEFINE_GUID(CLSID_WINE_FXEQ12, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xF
DEFINE_GUID(CLSID_WINE_FXEQ13, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x00, 0x00, 0x01, 0x03);
DEFINE_GUID(CLSID_WINE_FXEQ14, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x00, 0x00, 0x01, 0x04);
DEFINE_GUID(CLSID_WINE_FXEQ15, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x00, 0x00, 0x01, 0x05);
-DEFINE_GUID(CLSID_WINE_FXEQ28, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x00, 0x00, 0x02, 0x08);
/* xapofx 1.0 through 1.5 */
DEFINE_GUID(CLSID_FXMasteringLimiter27, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0x55, 0x00, 0x00, 0x00, 0x01);
@@ -45,7 +44,6 @@ DEFINE_GUID(CLSID_WINE_FXMasteringLimiter12, 0xa90bc001, 0xe897, 0xe897, 0x74, 0
DEFINE_GUID(CLSID_WINE_FXMasteringLimiter13, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x01, 0x00, 0x01, 0x03);
DEFINE_GUID(CLSID_WINE_FXMasteringLimiter14, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x01, 0x00, 0x01, 0x04);
DEFINE_GUID(CLSID_WINE_FXMasteringLimiter15, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x01, 0x00, 0x01, 0x05);
-DEFINE_GUID(CLSID_WINE_FXMasteringLimiter28, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x01, 0x00, 0x02, 0x08);
/* xapofx 1.0 through 1.5 */
DEFINE_GUID(CLSID_FXReverb27, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0x55, 0x00, 0x00, 0x00, 0x02);
@@ -58,7 +56,6 @@ DEFINE_GUID(CLSID_WINE_FXReverb12, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43,
DEFINE_GUID(CLSID_WINE_FXReverb13, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x02, 0x00, 0x01, 0x03);
DEFINE_GUID(CLSID_WINE_FXReverb14, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x02, 0x00, 0x01, 0x04);
DEFINE_GUID(CLSID_WINE_FXReverb15, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x02, 0x00, 0x01, 0x05);
-DEFINE_GUID(CLSID_WINE_FXReverb28, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x02, 0x00, 0x02, 0x08);
/* xapofx 1.0 through 1.5 */
DEFINE_GUID(CLSID_FXEcho27, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0x55, 0x00, 0x00, 0x00, 0x03);
@@ -71,6 +68,5 @@ DEFINE_GUID(CLSID_WINE_FXEcho12, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0
DEFINE_GUID(CLSID_WINE_FXEcho13, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x03, 0x00, 0x01, 0x03);
DEFINE_GUID(CLSID_WINE_FXEcho14, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x03, 0x00, 0x01, 0x04);
DEFINE_GUID(CLSID_WINE_FXEcho15, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x03, 0x00, 0x01, 0x05);
-DEFINE_GUID(CLSID_WINE_FXEcho28, 0xa90bc001, 0xe897, 0xe897, 0x74, 0x39, 0x43, 0xFF, 0x03, 0x00, 0x02, 0x08);
#endif
--
2.7.0
More information about the wine-patches
mailing list