2 * Copyright (c) 2015 Andrew Eikum for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/debug.h"
30 #include "xaudio2fx.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2
);
37 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
41 case DLL_WINE_PREATTACH
:
42 return FALSE
; /* prefer native version */
43 case DLL_PROCESS_ATTACH
:
44 DisableThreadLibraryCalls( hinstDLL
);
50 HRESULT WINAPI
XAudio2Create(IXAudio2
**ppxa2
, UINT32 flags
, XAUDIO2_PROCESSOR proc
)
56 /* create XAudio2 2.8 instance */
57 hr
= CoCreateInstance(&CLSID_XAudio2
, NULL
, CLSCTX_INPROC_SERVER
,
58 &IID_IXAudio2
, (void**)&xa2
);
62 hr
= IXAudio2_QueryInterface(xa2
, &IID_IXAudio27
, (void**)&xa27
);
64 IXAudio2_Release(xa2
);
68 hr
= IXAudio27_Initialize(xa27
, flags
, proc
);
70 IXAudio27_Release(xa27
);
71 IXAudio2_Release(xa2
);
75 IXAudio27_Release(xa27
);
82 HRESULT WINAPI
CreateAudioVolumeMeter(IUnknown
**out
)
84 return CoCreateInstance(&CLSID_AudioVolumeMeter
, NULL
, CLSCTX_INPROC_SERVER
,
85 &IID_IUnknown
, (void**)out
);
88 HRESULT WINAPI
CreateAudioReverb(IUnknown
**out
)
90 return CoCreateInstance(&CLSID_AudioReverb
, NULL
, CLSCTX_INPROC_SERVER
,
91 &IID_IUnknown
, (void**)out
);
94 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
, void *initdata
, UINT32 initdata_bytes
)
103 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
104 IsEqualGUID(clsid
, &CLSID_FXReverb
))
105 class = &CLSID_WINE_FXReverb28
;
107 hr
= CoCreateInstance(class, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
109 WARN("CoCreateInstance failed: %08x\n", hr
);
113 if(initdata
&& initdata_bytes
> 0){
116 hr
= IUnknown_QueryInterface(obj
, &IID_IXAPO
, (void**)&xapo
);
118 hr
= IXAPO_Initialize(xapo
, initdata
, initdata_bytes
);
123 WARN("Initialize failed: %08x\n", hr
);
124 IUnknown_Release(obj
);
135 HRESULT CDECL
X3DAudioInitialize(UINT32 chanmask
, float speedofsound
,
136 X3DAUDIO_HANDLE handle
)
138 FIXME("0x%x, %f, %p: Stub!\n", chanmask
, speedofsound
, handle
);
142 void CDECL
X3DAudioCalculate(const X3DAUDIO_HANDLE handle
,
143 const X3DAUDIO_LISTENER
*listener
, const X3DAUDIO_EMITTER
*emitter
,
144 UINT32 flags
, X3DAUDIO_DSP_SETTINGS
*out
)
148 FIXME("%p %p %p 0x%x %p: Stub!\n", handle
, listener
, emitter
, flags
, out
);
152 out
->LPFDirectCoefficient
= 0;
153 out
->LPFReverbCoefficient
= 0;
154 out
->ReverbLevel
= 0;
155 out
->DopplerFactor
= 1;
156 out
->EmitterToListenerAngle
= 0;
157 out
->EmitterToListenerDistance
= 0;
158 out
->EmitterVelocityComponent
= 0;
159 out
->ListenerVelocityComponent
= 0;