xaudio2_8: Use shared source.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2016-01-11 13:52:11 -06:00 committed by Alexandre Julliard
parent 4ad4c61100
commit 5f15d5b37c
10 changed files with 191 additions and 190 deletions

3
configure vendored
View File

@ -13720,6 +13720,7 @@ if test "x$ac_cv_have_openalsoft" != xyes
then
as_fn_append wine_notices "|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
if test "$ac_cv_header_kstat_h" = "yes"
@ -18034,7 +18035,7 @@ wine_fn_config_dll xaudio2_5 enable_xaudio2_5 clean
wine_fn_config_dll xaudio2_6 enable_xaudio2_6 clean
wine_fn_config_dll xaudio2_7 enable_xaudio2_7 clean
wine_fn_config_test dlls/xaudio2_7/tests xaudio2_7_test
wine_fn_config_dll xaudio2_8 enable_xaudio2_8 implib
wine_fn_config_dll xaudio2_8 enable_xaudio2_8 clean,implib
wine_fn_config_dll xinput1_1 enable_xinput1_1
wine_fn_config_dll xinput1_2 enable_xinput1_2
wine_fn_config_dll xinput1_3 enable_xinput1_3 implib xinput

View File

@ -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 ****
@ -3378,7 +3379,7 @@ WINE_CONFIG_DLL(xaudio2_5,,[clean])
WINE_CONFIG_DLL(xaudio2_6,,[clean])
WINE_CONFIG_DLL(xaudio2_7,,[clean])
WINE_CONFIG_TEST(dlls/xaudio2_7/tests)
WINE_CONFIG_DLL(xaudio2_8,,[implib])
WINE_CONFIG_DLL(xaudio2_8,,[clean,implib])
WINE_CONFIG_DLL(xinput1_1)
WINE_CONFIG_DLL(xinput1_2)
WINE_CONFIG_DLL(xinput1_3,,[implib],[xinput])

View File

@ -1,9 +1,11 @@
EXTRADEFS = -DXAUDIO2_VER=7
MODULE = xaudio2_7.dll
IMPORTS = advapi32 kernel32 ole32 user32 uuid
EXTRALIBS = $(OPENAL_LIBS)
C_SRCS = \
compat.c \
x3daudio.c \
xapofx.c \
xaudio_dll.c

55
dlls/xaudio2_7/x3daudio.c Normal file
View File

@ -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 */

View File

@ -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 */

View File

@ -20,6 +20,7 @@
#pragma makedep register
#if XAUDIO2_VER == 7
[
helpstring("XAudio2 Class"),
threading(both),
@ -83,13 +84,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),
@ -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 */

View File

@ -2074,10 +2074,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)){
@ -2090,8 +2086,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;
@ -2099,6 +2093,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)

View File

@ -1,6 +1,14 @@
EXTRADEFS = -DXAUDIO2_VER=8
MODULE = xaudio2_8.dll
IMPORTLIB = xaudio2_8
IMPORTS = ole32
IMPORTS = advapi32 kernel32 ole32 user32 uuid
EXTRALIBS = $(OPENAL_LIBS)
PARENTSRC = ../xaudio2_7
C_SRCS = \
compat.c \
x3daudio.c \
xapofx.c \
xaudio_dll.c
IDL_SRCS = xaudio_classes.idl

View File

@ -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;
}

View File

@ -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