2 * Copyright (c) 2015 Andrew Eikum for CodeWeavers
3 * Copyright (c) 2018 Ethan Lee for CodeWeavers
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSUNION
29 #endif /* XAPOFX1_VER */
30 #include "xaudio_private.h"
33 #include "wine/debug.h"
35 #if XAUDIO2_VER >= 8 || defined XAPOFX1_VER
36 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2
);
40 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD reason
, void *pReserved
)
42 TRACE("(%p, %d, %p)\n", hinstDLL
, reason
, pReserved
);
46 case DLL_PROCESS_ATTACH
:
47 DisableThreadLibraryCalls( hinstDLL
);
52 #endif /* XAPOFX1_VER */
55 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
, void *initdata
, UINT32 initdata_bytes
)
59 const GUID
*class = NULL
;
64 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
65 IsEqualGUID(clsid
, &CLSID_FXReverb
))
66 class = &CLSID_FXReverb
;
67 else if(IsEqualGUID(clsid
, &CLSID_FXEQ27
) ||
68 IsEqualGUID(clsid
, &CLSID_FXEQ
))
70 else if(IsEqualGUID(clsid
, &CLSID_FXEcho27
) ||
71 IsEqualGUID(clsid
, &CLSID_FXEcho
))
72 class = &CLSID_FXEcho
;
73 else if(IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter27
) ||
74 IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter
))
75 class = &CLSID_FXMasteringLimiter
;
78 hr
= make_xapo_factory(class, &IID_IClassFactory
, (void**)&cf
);
82 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)&obj
);
83 IClassFactory_Release(cf
);
87 hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
89 WARN("CoCreateInstance failed: %08x\n", hr
);
94 if(initdata
&& initdata_bytes
> 0){
97 hr
= IUnknown_QueryInterface(obj
, &IID_IXAPO
, (void**)&xapo
);
99 hr
= IXAPO_Initialize(xapo
, initdata
, initdata_bytes
);
104 WARN("Initialize failed: %08x\n", hr
);
105 IUnknown_Release(obj
);
115 #endif /* XAUDIO2_VER >= 8 */
118 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
)
122 const GUID
*class = NULL
;
125 TRACE("%s %p\n", debugstr_guid(clsid
), out
);
129 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
130 IsEqualGUID(clsid
, &CLSID_FXReverb
))
131 class = &CLSID_FXReverb
;
132 else if(IsEqualGUID(clsid
, &CLSID_FXEQ27
) ||
133 IsEqualGUID(clsid
, &CLSID_FXEQ
))
135 else if(IsEqualGUID(clsid
, &CLSID_FXEcho27
) ||
136 IsEqualGUID(clsid
, &CLSID_FXEcho
))
137 class = &CLSID_FXEcho
;
138 else if(IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter27
) ||
139 IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter
))
140 class = &CLSID_FXMasteringLimiter
;
143 hr
= make_xapo_factory(class, &IID_IClassFactory
, (void**)&cf
);
147 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)&obj
);
148 IClassFactory_Release(cf
);
152 hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
154 WARN("CoCreateInstance failed: %08x\n", hr
);
163 #endif /* XAPOFX1_VER */