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
22 #define NONAMELESSUNION
27 #endif /* XAPOFX1_VER */
28 #include "xaudio_private.h"
31 #include "wine/debug.h"
33 #if XAUDIO2_VER >= 8 || defined XAPOFX1_VER
34 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2
);
38 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
, void *initdata
, UINT32 initdata_bytes
)
42 const GUID
*class = NULL
;
47 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
48 IsEqualGUID(clsid
, &CLSID_FXReverb
))
49 class = &CLSID_FXReverb
;
50 else if(IsEqualGUID(clsid
, &CLSID_FXEQ27
) ||
51 IsEqualGUID(clsid
, &CLSID_FXEQ
))
53 else if(IsEqualGUID(clsid
, &CLSID_FXEcho27
) ||
54 IsEqualGUID(clsid
, &CLSID_FXEcho
))
55 class = &CLSID_FXEcho
;
56 else if(IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter27
) ||
57 IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter
))
58 class = &CLSID_FXMasteringLimiter
;
61 hr
= make_xapo_factory(class, &IID_IClassFactory
, (void**)&cf
);
65 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)&obj
);
66 IClassFactory_Release(cf
);
70 hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
72 WARN("CoCreateInstance failed: %08lx\n", hr
);
77 if(initdata
&& initdata_bytes
> 0){
80 hr
= IUnknown_QueryInterface(obj
, &IID_IXAPO
, (void**)&xapo
);
82 hr
= IXAPO_Initialize(xapo
, initdata
, initdata_bytes
);
87 WARN("Initialize failed: %08lx\n", hr
);
88 IUnknown_Release(obj
);
98 #endif /* XAUDIO2_VER >= 8 */
101 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
)
105 const GUID
*class = NULL
;
108 TRACE("%s %p\n", debugstr_guid(clsid
), out
);
112 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
113 IsEqualGUID(clsid
, &CLSID_FXReverb
))
114 class = &CLSID_FXReverb
;
115 else if(IsEqualGUID(clsid
, &CLSID_FXEQ27
) ||
116 IsEqualGUID(clsid
, &CLSID_FXEQ
))
118 else if(IsEqualGUID(clsid
, &CLSID_FXEcho27
) ||
119 IsEqualGUID(clsid
, &CLSID_FXEcho
))
120 class = &CLSID_FXEcho
;
121 else if(IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter27
) ||
122 IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter
))
123 class = &CLSID_FXMasteringLimiter
;
126 hr
= make_xapo_factory(class, &IID_IClassFactory
, (void**)&cf
);
130 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)&obj
);
131 IClassFactory_Release(cf
);
135 hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
137 WARN("CoCreateInstance failed: %08lx\n", hr
);
146 #endif /* XAPOFX1_VER */