diff --git a/dlls/xaudio2_7/xaudio_classes.idl b/dlls/xaudio2_7/xaudio_classes.idl index a39d082da9a..a1ed611e7fe 100644 --- a/dlls/xaudio2_7/xaudio_classes.idl +++ b/dlls/xaudio2_7/xaudio_classes.idl @@ -33,3 +33,10 @@ coclass XAudio2 { interface IXAudio2; } uuid(cac1105f-619b-4d04-831a-44e1cbf12d57) ] coclass AudioVolumeMeter { interface IUnknown; } + +[ + helpstring("XAudio2 Reverb Class"), + threading(both), + uuid(6a93130e-1d53-41d1-a9cf-e758800bb179) +] +coclass AudioReverb { interface IUnknown; } diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c index 7a5f45b2e0b..739c9190a70 100644 --- a/dlls/xaudio2_7/xaudio_dll.c +++ b/dlls/xaudio2_7/xaudio_dll.c @@ -2435,6 +2435,206 @@ static const IXAPOParametersVtbl VUMXAPOParameters_Vtbl = { VUMXAPOParams_GetParameters }; +typedef struct _ReverbImpl { + IXAPO IXAPO_iface; + IXAPOParameters IXAPOParameters_iface; + + LONG ref; +} ReverbImpl; + +static ReverbImpl *ReverbImpl_from_IXAPO(IXAPO *iface) +{ + return CONTAINING_RECORD(iface, ReverbImpl, IXAPO_iface); +} + +static ReverbImpl *ReverbImpl_from_IXAPOParameters(IXAPOParameters *iface) +{ + return CONTAINING_RECORD(iface, ReverbImpl, IXAPOParameters_iface); +} + +static HRESULT WINAPI RVBXAPO_QueryInterface(IXAPO *iface, REFIID riid, void **ppvObject) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + + TRACE("%p, %s, %p\n", This, wine_dbgstr_guid(riid), ppvObject); + + if(IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IXAPO) || + IsEqualGUID(riid, &IID_IXAPO27)) + *ppvObject = &This->IXAPO_iface; + else if(IsEqualGUID(riid, &IID_IXAPOParameters)) + *ppvObject = &This->IXAPOParameters_iface; + else + *ppvObject = NULL; + + if(*ppvObject){ + IUnknown_AddRef((IUnknown*)*ppvObject); + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI RVBXAPO_AddRef(IXAPO *iface) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(): Refcount now %u\n", This, ref); + return ref; +} + +static ULONG WINAPI RVBXAPO_Release(IXAPO *iface) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(): Refcount now %u\n", This, ref); + + if(!ref) + HeapFree(GetProcessHeap(), 0, This); + + return ref; +} + +static HRESULT WINAPI RVBXAPO_GetRegistrationProperties(IXAPO *iface, + XAPO_REGISTRATION_PROPERTIES **props) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p, %p\n", This, props); + return E_NOTIMPL; +} + +static HRESULT WINAPI RVBXAPO_IsInputFormatSupported(IXAPO *iface, + const WAVEFORMATEX *output_fmt, const WAVEFORMATEX *input_fmt, + WAVEFORMATEX **supported_fmt) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p, %p, %p, %p\n", This, output_fmt, input_fmt, supported_fmt); + return E_NOTIMPL; +} + +static HRESULT WINAPI RVBXAPO_IsOutputFormatSupported(IXAPO *iface, + const WAVEFORMATEX *input_fmt, const WAVEFORMATEX *output_fmt, + WAVEFORMATEX **supported_fmt) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p, %p, %p, %p\n", This, input_fmt, output_fmt, supported_fmt); + return E_NOTIMPL; +} + +static HRESULT WINAPI RVBXAPO_Initialize(IXAPO *iface, const void *data, + UINT32 data_len) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p, %p, %u\n", This, data, data_len); + return E_NOTIMPL; +} + +static HRESULT WINAPI RVBXAPO_Reset(IXAPO *iface) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI RVBXAPO_LockForProcess(IXAPO *iface, UINT32 in_params_count, + const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS *in_params, + UINT32 out_params_count, + const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS *out_params) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p, %u, %p, %u, %p\n", This, in_params_count, in_params, + out_params_count, out_params); + return E_NOTIMPL; +} + +static void WINAPI RVBXAPO_UnlockForProcess(IXAPO *iface) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p\n", This); +} + +static void WINAPI RVBXAPO_Process(IXAPO *iface, UINT32 in_params_count, + const XAPO_PROCESS_BUFFER_PARAMETERS *in_params, + UINT32 out_params_count, + const XAPO_PROCESS_BUFFER_PARAMETERS *out_params, BOOL enabled) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p, %u, %p, %u, %p, %u\n", This, in_params_count, in_params, + out_params_count, out_params, enabled); +} + +static UINT32 WINAPI RVBXAPO_CalcInputFrames(IXAPO *iface, UINT32 output_frames) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p, %u\n", This, output_frames); + return 0; +} + +static UINT32 WINAPI RVBXAPO_CalcOutputFrames(IXAPO *iface, UINT32 input_frames) +{ + ReverbImpl *This = ReverbImpl_from_IXAPO(iface); + TRACE("%p, %u\n", This, input_frames); + return 0; +} + +static const IXAPOVtbl RVBXAPO_Vtbl = { + RVBXAPO_QueryInterface, + RVBXAPO_AddRef, + RVBXAPO_Release, + RVBXAPO_GetRegistrationProperties, + RVBXAPO_IsInputFormatSupported, + RVBXAPO_IsOutputFormatSupported, + RVBXAPO_Initialize, + RVBXAPO_Reset, + RVBXAPO_LockForProcess, + RVBXAPO_UnlockForProcess, + RVBXAPO_Process, + RVBXAPO_CalcInputFrames, + RVBXAPO_CalcOutputFrames +}; + +static HRESULT WINAPI RVBXAPOParams_QueryInterface(IXAPOParameters *iface, + REFIID riid, void **ppvObject) +{ + ReverbImpl *This = ReverbImpl_from_IXAPOParameters(iface); + return RVBXAPO_QueryInterface(&This->IXAPO_iface, riid, ppvObject); +} + +static ULONG WINAPI RVBXAPOParams_AddRef(IXAPOParameters *iface) +{ + ReverbImpl *This = ReverbImpl_from_IXAPOParameters(iface); + return RVBXAPO_AddRef(&This->IXAPO_iface); +} + +static ULONG WINAPI RVBXAPOParams_Release(IXAPOParameters *iface) +{ + ReverbImpl *This = ReverbImpl_from_IXAPOParameters(iface); + return RVBXAPO_Release(&This->IXAPO_iface); +} + +static void WINAPI RVBXAPOParams_SetParameters(IXAPOParameters *iface, + const void *params, UINT32 params_len) +{ + ReverbImpl *This = ReverbImpl_from_IXAPOParameters(iface); + TRACE("%p, %p, %u\n", This, params, params_len); +} + +static void WINAPI RVBXAPOParams_GetParameters(IXAPOParameters *iface, void *params, + UINT32 params_len) +{ + ReverbImpl *This = ReverbImpl_from_IXAPOParameters(iface); + TRACE("%p, %p, %u\n", This, params, params_len); +} + +static const IXAPOParametersVtbl RVBXAPOParameters_Vtbl = { + RVBXAPOParams_QueryInterface, + RVBXAPOParams_AddRef, + RVBXAPOParams_Release, + RVBXAPOParams_SetParameters, + RVBXAPOParams_GetParameters +}; + static HRESULT WINAPI XAudio2CF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj) { if(IsEqualGUID(riid, &IID_IUnknown) @@ -2615,6 +2815,35 @@ static HRESULT WINAPI VUMeterCF_CreateInstance(IClassFactory *iface, IUnknown *p return S_OK; } +static HRESULT WINAPI ReverbCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, + REFIID riid, void **ppobj) +{ + HRESULT hr; + ReverbImpl *object; + + TRACE("(static)->(%p,%s,%p)\n", pOuter, debugstr_guid(riid), ppobj); + + *ppobj = NULL; + + if(pOuter) + return CLASS_E_NOAGGREGATION; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if(!object) + return E_OUTOFMEMORY; + + object->IXAPO_iface.lpVtbl = &RVBXAPO_Vtbl; + object->IXAPOParameters_iface.lpVtbl = &RVBXAPOParameters_Vtbl; + + hr = IXAPO_QueryInterface(&object->IXAPO_iface, riid, ppobj); + if(FAILED(hr)){ + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + return S_OK; +} + static HRESULT WINAPI XAudio2CF_LockServer(IClassFactory *iface, BOOL dolock) { FIXME("(static)->(%d): stub!\n", dolock); @@ -2639,8 +2868,18 @@ static const IClassFactoryVtbl VUMeterCF_Vtbl = XAudio2CF_LockServer }; +static const IClassFactoryVtbl ReverbCF_Vtbl = +{ + XAudio2CF_QueryInterface, + XAudio2CF_AddRef, + XAudio2CF_Release, + ReverbCF_CreateInstance, + XAudio2CF_LockServer +}; + static IClassFactory xaudio2_cf = { &XAudio2CF_Vtbl }; static IClassFactory vumeter_cf = { &VUMeterCF_Vtbl }; +static IClassFactory reverb_cf = { &ReverbCF_Vtbl }; HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) { @@ -2652,6 +2891,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) factory = &xaudio2_cf; }else if(IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter)) { factory = &vumeter_cf; + }else if(IsEqualGUID(rclsid, &CLSID_AudioReverb)) { + factory = &reverb_cf; } if(!factory) return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/xaudio2_8/xaudio_dll.c b/dlls/xaudio2_8/xaudio_dll.c index 521cc29cd70..4a7378336cc 100644 --- a/dlls/xaudio2_8/xaudio_dll.c +++ b/dlls/xaudio2_8/xaudio_dll.c @@ -79,3 +79,9 @@ HRESULT WINAPI CreateAudioVolumeMeter(IUnknown **out) return CoCreateInstance(&CLSID_AudioVolumeMeter, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)out); } + +HRESULT WINAPI CreateAudioReverb(IUnknown **out) +{ + return CoCreateInstance(&CLSID_AudioReverb, NULL, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)out); +} diff --git a/include/xaudio2fx.idl b/include/xaudio2fx.idl index 8d74264c9a7..a83b2f69b19 100644 --- a/include/xaudio2fx.idl +++ b/include/xaudio2fx.idl @@ -24,3 +24,10 @@ import "unknwn.idl"; coclass AudioVolumeMeter { interface IUnknown; } + +[ + uuid(6a93130e-1d53-41d1-a9cf-e758800bb179) +] +coclass AudioReverb { + interface IUnknown; +}