include: Add mferror.h header.
[wine.git] / dlls / dpvoice / client.c
blob0fab0c56d6f75c17907363a5f9d60cff446b2744
1 /*
2 * DirectPlay Voice Client Interface
4 * Copyright (C) 2014 Alistair Leslie-Hughes
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
22 #include <stdarg.h>
24 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "objbase.h"
31 #include "wine/unicode.h"
32 #include "wine/debug.h"
34 #include "dvoice.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
38 typedef struct IDirectPlayVoiceClientImpl
40 IDirectPlayVoiceClient IDirectPlayVoiceClient_iface;
41 LONG ref;
42 } IDirectPlayVoiceClientImpl;
44 typedef struct IDirectPlayVoiceTestImpl
46 IDirectPlayVoiceTest IDirectPlayVoiceTest_iface;
47 LONG ref;
48 } IDirectPlayVoiceTestImpl;
50 static inline IDirectPlayVoiceClientImpl *impl_from_IDirectPlayVoiceClient(IDirectPlayVoiceClient *iface)
52 return CONTAINING_RECORD(iface, IDirectPlayVoiceClientImpl, IDirectPlayVoiceClient_iface);
55 static inline IDirectPlayVoiceTestImpl *impl_from_IDirectPlayVoiceTest(IDirectPlayVoiceTest *iface)
57 return CONTAINING_RECORD(iface, IDirectPlayVoiceTestImpl, IDirectPlayVoiceTest_iface);
60 static HRESULT WINAPI dpvclient_QueryInterface(IDirectPlayVoiceClient *iface, REFIID riid, void **ppv)
62 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceClient))
64 IUnknown_AddRef(iface);
65 *ppv = iface;
66 return S_OK;
69 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
70 return E_NOINTERFACE;
73 static ULONG WINAPI dpvclient_AddRef(IDirectPlayVoiceClient *iface)
75 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
76 ULONG ref = InterlockedIncrement(&This->ref);
78 TRACE("(%p) ref=%u\n", This, ref);
80 return ref;
83 static ULONG WINAPI dpvclient_Release(IDirectPlayVoiceClient *iface)
85 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
86 ULONG ref = InterlockedIncrement(&This->ref);
88 TRACE("(%p) ref=%u\n", This, ref);
90 if (!ref)
92 HeapFree(GetProcessHeap(), 0, This);
94 return ref;
97 static HRESULT WINAPI dpvclient_Initialize(IDirectPlayVoiceClient *iface,LPUNKNOWN pVoid, PDVMESSAGEHANDLER pMessageHandler,
98 void *pUserContext, DWORD *pdwMessageMask, DWORD dwMessageMaskElements)
100 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
101 FIXME("%p %p %p %p %p %d\n", This, pVoid, pMessageHandler, pUserContext,pdwMessageMask, dwMessageMaskElements);
102 return E_NOTIMPL;
105 static HRESULT WINAPI dpvclient_Connect(IDirectPlayVoiceClient *iface, PDVSOUNDDEVICECONFIG pSoundDeviceConfig,
106 PDVCLIENTCONFIG pdvClientConfig, DWORD dwFlags)
108 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
109 FIXME("%p %p %p %d\n", This, pSoundDeviceConfig, pdvClientConfig, dwFlags);
110 return E_NOTIMPL;
113 static HRESULT WINAPI dpvclient_Disconnect(IDirectPlayVoiceClient *iface, DWORD dwFlags)
115 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
116 FIXME("%p %d\n", This, dwFlags);
117 return E_NOTIMPL;
120 static HRESULT WINAPI dpvclient_GetSessionDesc(IDirectPlayVoiceClient *iface, PDVSESSIONDESC pvSessionDesc)
122 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
123 FIXME("%p %p\n", This, pvSessionDesc);
124 return E_NOTIMPL;
127 static HRESULT WINAPI dpvclient_GetClientConfig(IDirectPlayVoiceClient *iface, PDVCLIENTCONFIG pClientConfig)
129 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
130 FIXME("%p %p\n", This, pClientConfig);
131 return E_NOTIMPL;
134 static HRESULT WINAPI dpvclient_SetClientConfig(IDirectPlayVoiceClient *iface, PDVCLIENTCONFIG pClientConfig)
136 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
137 FIXME("%p %p\n", This, pClientConfig);
138 return E_NOTIMPL;
141 static HRESULT WINAPI dpvclient_GetCaps(IDirectPlayVoiceClient *iface, PDVCAPS pCaps)
143 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
144 FIXME("%p %p\n", This, pCaps);
145 return E_NOTIMPL;
148 static HRESULT WINAPI dpvclient_GetCompressionTypes(IDirectPlayVoiceClient *iface, void *pData,
149 DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags)
151 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
152 FIXME("%p %p %p %p %d\n", This, pData, pdwDataSize, pdwNumElements, dwFlags);
153 return E_NOTIMPL;
156 static HRESULT WINAPI dpvclient_SetTransmitTargets(IDirectPlayVoiceClient *iface, PDVID pdvIDTargets,
157 DWORD dwNumTargets, DWORD dwFlags)
159 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
160 FIXME("%p %p %d %d\n", This, pdvIDTargets, dwNumTargets, dwFlags);
161 return E_NOTIMPL;
164 static HRESULT WINAPI dpvclient_GetTransmitTargets(IDirectPlayVoiceClient *iface, PDVID pdvIDTargets,
165 DWORD *pdwNumTargets, DWORD dwFlags)
167 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
168 FIXME("%p %p %d\n", This, pdwNumTargets, dwFlags);
169 return E_NOTIMPL;
172 static HRESULT WINAPI dpvclient_Create3DSoundBuffer(IDirectPlayVoiceClient *iface, DVID dvID,
173 LPDIRECTSOUNDBUFFER lpdsSourceBuffer, DWORD dwPriority, DWORD dwFlags,
174 LPDIRECTSOUND3DBUFFER *lpUserBuffer)
176 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
177 FIXME("%p %d %p %d %d %p\n", This, dvID, lpdsSourceBuffer, dwPriority, dwFlags, lpUserBuffer);
178 return E_NOTIMPL;
181 static HRESULT WINAPI dpvclient_Delete3DSoundBuffer(IDirectPlayVoiceClient *iface, DVID dvID, LPDIRECTSOUND3DBUFFER *lpUserBuffer)
183 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
184 FIXME("%p %d %p\n", This, dvID, lpUserBuffer);
185 return E_NOTIMPL;
188 static HRESULT WINAPI dpvclient_SetNotifyMask(IDirectPlayVoiceClient *iface, DWORD *pdwMessageMask, DWORD dwMessageMaskElements)
190 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
191 FIXME("%p %p %d\n", This, pdwMessageMask, dwMessageMaskElements);
192 return E_NOTIMPL;
195 static HRESULT WINAPI dpvclient_GetSoundDeviceConfig(IDirectPlayVoiceClient *iface, PDVSOUNDDEVICECONFIG pSoundDeviceConfig,
196 DWORD *pdwSize)
198 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
199 FIXME("%p %p %p\n", This, pSoundDeviceConfig, pdwSize);
200 return E_NOTIMPL;
204 static const IDirectPlayVoiceClientVtbl DirectPlayVoiceClient_Vtbl =
206 dpvclient_QueryInterface,
207 dpvclient_AddRef,
208 dpvclient_Release,
209 dpvclient_Initialize,
210 dpvclient_Connect,
211 dpvclient_Disconnect,
212 dpvclient_GetSessionDesc,
213 dpvclient_GetClientConfig,
214 dpvclient_SetClientConfig,
215 dpvclient_GetCaps,
216 dpvclient_GetCompressionTypes,
217 dpvclient_SetTransmitTargets,
218 dpvclient_GetTransmitTargets,
219 dpvclient_Create3DSoundBuffer,
220 dpvclient_Delete3DSoundBuffer,
221 dpvclient_SetNotifyMask,
222 dpvclient_GetSoundDeviceConfig
225 HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj)
227 IDirectPlayVoiceClientImpl* client;
228 HRESULT ret;
230 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
232 *ppobj = NULL;
234 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceClientImpl));
235 if (!client)
236 return E_OUTOFMEMORY;
238 client->IDirectPlayVoiceClient_iface.lpVtbl = &DirectPlayVoiceClient_Vtbl;
239 client->ref = 1;
241 ret = IDirectPlayVoiceClient_QueryInterface(&client->IDirectPlayVoiceClient_iface, riid, ppobj);
242 IDirectPlayVoiceClient_Release(&client->IDirectPlayVoiceClient_iface);
244 return ret;
247 static HRESULT WINAPI dpvtest_QueryInterface(IDirectPlayVoiceTest *iface, REFIID riid, void **ppv)
249 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceTest))
251 IUnknown_AddRef(iface);
252 *ppv = iface;
253 return S_OK;
256 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
257 return E_NOINTERFACE;
260 static ULONG WINAPI dpvtest_AddRef(IDirectPlayVoiceTest *iface)
262 IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
263 ULONG ref = InterlockedIncrement(&This->ref);
265 TRACE("(%p) ref=%u\n", This, ref);
267 return ref;
270 static ULONG WINAPI dpvtest_Release(IDirectPlayVoiceTest *iface)
272 IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
273 ULONG ref = InterlockedIncrement(&This->ref);
275 TRACE("(%p) ref=%u\n", This, ref);
277 if (!ref)
279 HeapFree(GetProcessHeap(), 0, This);
281 return ref;
284 static HRESULT WINAPI dpvtest_CheckAudioSetup(IDirectPlayVoiceTest *iface, const GUID *pguidPlaybackDevice, const GUID *pguidCaptureDevice,
285 HWND hwndParent, DWORD dwFlags)
287 IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
288 FIXME("%p %p %p %p %d\n", This, pguidPlaybackDevice, pguidCaptureDevice, hwndParent, dwFlags);
289 return E_NOTIMPL;
292 static const IDirectPlayVoiceTestVtbl DirectPlayVoiceTest_Vtbl =
294 dpvtest_QueryInterface,
295 dpvtest_AddRef,
296 dpvtest_Release,
297 dpvtest_CheckAudioSetup
300 HRESULT DPVOICE_CreateDirectPlayVoiceTest(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj)
302 IDirectPlayVoiceTestImpl* test;
303 HRESULT ret;
305 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
307 *ppobj = NULL;
309 test = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceTestImpl));
310 if (!test)
311 return E_OUTOFMEMORY;
313 test->IDirectPlayVoiceTest_iface.lpVtbl = &DirectPlayVoiceTest_Vtbl;
314 test->ref = 1;
316 ret = IDirectPlayVoiceTest_QueryInterface(&test->IDirectPlayVoiceTest_iface, riid, ppobj);
317 IDirectPlayVoiceTest_Release(&test->IDirectPlayVoiceTest_iface);
319 return ret;