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 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
, void *initdata
, UINT32 initdata_bytes
)
44 const GUID
*class = NULL
;
49 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
50 IsEqualGUID(clsid
, &CLSID_FXReverb
))
51 class = &CLSID_FXReverb
;
52 else if(IsEqualGUID(clsid
, &CLSID_FXEQ27
) ||
53 IsEqualGUID(clsid
, &CLSID_FXEQ
))
55 else if(IsEqualGUID(clsid
, &CLSID_FXEcho27
) ||
56 IsEqualGUID(clsid
, &CLSID_FXEcho
))
57 class = &CLSID_FXEcho
;
58 else if(IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter27
) ||
59 IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter
))
60 class = &CLSID_FXMasteringLimiter
;
63 hr
= make_xapo_factory(class, &IID_IClassFactory
, (void**)&cf
);
67 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)&obj
);
68 IClassFactory_Release(cf
);
72 hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
74 WARN("CoCreateInstance failed: %08x\n", hr
);
79 if(initdata
&& initdata_bytes
> 0){
82 hr
= IUnknown_QueryInterface(obj
, &IID_IXAPO
, (void**)&xapo
);
84 hr
= IXAPO_Initialize(xapo
, initdata
, initdata_bytes
);
89 WARN("Initialize failed: %08x\n", hr
);
90 IUnknown_Release(obj
);
100 #endif /* XAUDIO2_VER >= 8 */
103 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
)
107 const GUID
*class = NULL
;
110 TRACE("%s %p\n", debugstr_guid(clsid
), out
);
114 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
115 IsEqualGUID(clsid
, &CLSID_FXReverb
))
116 class = &CLSID_FXReverb
;
117 else if(IsEqualGUID(clsid
, &CLSID_FXEQ27
) ||
118 IsEqualGUID(clsid
, &CLSID_FXEQ
))
120 else if(IsEqualGUID(clsid
, &CLSID_FXEcho27
) ||
121 IsEqualGUID(clsid
, &CLSID_FXEcho
))
122 class = &CLSID_FXEcho
;
123 else if(IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter27
) ||
124 IsEqualGUID(clsid
, &CLSID_FXMasteringLimiter
))
125 class = &CLSID_FXMasteringLimiter
;
128 hr
= make_xapo_factory(class, &IID_IClassFactory
, (void**)&cf
);
132 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)&obj
);
133 IClassFactory_Release(cf
);
137 hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
139 WARN("CoCreateInstance failed: %08x\n", hr
);
148 #endif /* XAPOFX1_VER */