ntoskrnl.exe: Add KeEnterCriticalRegion/KeLeaveCriticalRegion stubs.
[wine.git] / dlls / xaudio2_8 / xaudio_dll.c
blob4a7378336cc74701abcbe2cc0594a233b8e09952
1 /*
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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
27 #include "initguid.h"
28 #include "xaudio2.h"
29 #include "xaudio2fx.h"
30 #include "xapo.h"
32 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
34 switch (fdwReason)
36 case DLL_WINE_PREATTACH:
37 return FALSE; /* prefer native version */
38 case DLL_PROCESS_ATTACH:
39 DisableThreadLibraryCalls( hinstDLL );
40 break;
42 return TRUE;
45 HRESULT WINAPI XAudio2Create(IXAudio2 **ppxa2, UINT32 flags, XAUDIO2_PROCESSOR proc)
47 HRESULT hr;
48 IXAudio2 *xa2;
49 IXAudio27 *xa27;
51 /* create XAudio2 2.8 instance */
52 hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER,
53 &IID_IXAudio2, (void**)&xa2);
54 if(FAILED(hr))
55 return hr;
57 hr = IXAudio2_QueryInterface(xa2, &IID_IXAudio27, (void**)&xa27);
58 if(FAILED(hr)){
59 IXAudio2_Release(xa2);
60 return hr;
63 hr = IXAudio27_Initialize(xa27, flags, proc);
64 if(FAILED(hr)){
65 IXAudio27_Release(xa27);
66 IXAudio2_Release(xa2);
67 return hr;
70 IXAudio27_Release(xa27);
72 *ppxa2 = xa2;
74 return S_OK;
77 HRESULT WINAPI CreateAudioVolumeMeter(IUnknown **out)
79 return CoCreateInstance(&CLSID_AudioVolumeMeter, NULL, CLSCTX_INPROC_SERVER,
80 &IID_IUnknown, (void**)out);
83 HRESULT WINAPI CreateAudioReverb(IUnknown **out)
85 return CoCreateInstance(&CLSID_AudioReverb, NULL, CLSCTX_INPROC_SERVER,
86 &IID_IUnknown, (void**)out);