wined3d: Call wglGetPixelFormat() through the gl_ops table.
[wine.git] / dlls / dpvoice / client.c
blobbdae160b20c58f901b88c540386e98d6045e620c
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"
35 #include "dvoice_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
39 typedef struct IDirectPlayVoiceClientImpl
41 IDirectPlayVoiceClient IDirectPlayVoiceClient_iface;
42 LONG ref;
43 } IDirectPlayVoiceClientImpl;
45 typedef struct IDirectPlayVoiceTestImpl
47 IDirectPlayVoiceTest IDirectPlayVoiceTest_iface;
48 LONG ref;
49 } IDirectPlayVoiceTestImpl;
51 static inline IDirectPlayVoiceClientImpl *impl_from_IDirectPlayVoiceClient(IDirectPlayVoiceClient *iface)
53 return CONTAINING_RECORD(iface, IDirectPlayVoiceClientImpl, IDirectPlayVoiceClient_iface);
56 static inline IDirectPlayVoiceTestImpl *impl_from_IDirectPlayVoiceTest(IDirectPlayVoiceTest *iface)
58 return CONTAINING_RECORD(iface, IDirectPlayVoiceTestImpl, IDirectPlayVoiceTest_iface);
61 static HRESULT WINAPI dpvclient_QueryInterface(IDirectPlayVoiceClient *iface, REFIID riid, void **ppv)
63 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceClient))
65 IUnknown_AddRef(iface);
66 *ppv = iface;
67 return S_OK;
70 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
71 return E_NOINTERFACE;
74 static ULONG WINAPI dpvclient_AddRef(IDirectPlayVoiceClient *iface)
76 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
77 ULONG ref = InterlockedIncrement(&This->ref);
79 TRACE("(%p) ref=%u\n", This, ref);
81 return ref;
84 static ULONG WINAPI dpvclient_Release(IDirectPlayVoiceClient *iface)
86 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
87 ULONG ref = InterlockedDecrement(&This->ref);
89 TRACE("(%p) ref=%u\n", This, ref);
91 if (!ref)
93 HeapFree(GetProcessHeap(), 0, This);
95 return ref;
98 static HRESULT WINAPI dpvclient_Initialize(IDirectPlayVoiceClient *iface,LPUNKNOWN pVoid, PDVMESSAGEHANDLER pMessageHandler,
99 void *pUserContext, DWORD *pdwMessageMask, DWORD dwMessageMaskElements)
101 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
102 FIXME("%p %p %p %p %p %d\n", This, pVoid, pMessageHandler, pUserContext,pdwMessageMask, dwMessageMaskElements);
103 return E_NOTIMPL;
106 static HRESULT WINAPI dpvclient_Connect(IDirectPlayVoiceClient *iface, PDVSOUNDDEVICECONFIG pSoundDeviceConfig,
107 PDVCLIENTCONFIG pdvClientConfig, DWORD dwFlags)
109 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
110 FIXME("%p %p %p %d\n", This, pSoundDeviceConfig, pdvClientConfig, dwFlags);
111 return E_NOTIMPL;
114 static HRESULT WINAPI dpvclient_Disconnect(IDirectPlayVoiceClient *iface, DWORD dwFlags)
116 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
117 FIXME("%p %d\n", This, dwFlags);
118 return E_NOTIMPL;
121 static HRESULT WINAPI dpvclient_GetSessionDesc(IDirectPlayVoiceClient *iface, PDVSESSIONDESC pvSessionDesc)
123 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
124 FIXME("%p %p\n", This, pvSessionDesc);
125 return E_NOTIMPL;
128 static HRESULT WINAPI dpvclient_GetClientConfig(IDirectPlayVoiceClient *iface, PDVCLIENTCONFIG pClientConfig)
130 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
131 FIXME("%p %p\n", This, pClientConfig);
132 return E_NOTIMPL;
135 static HRESULT WINAPI dpvclient_SetClientConfig(IDirectPlayVoiceClient *iface, PDVCLIENTCONFIG pClientConfig)
137 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
138 FIXME("%p %p\n", This, pClientConfig);
139 return E_NOTIMPL;
142 static HRESULT WINAPI dpvclient_GetCaps(IDirectPlayVoiceClient *iface, PDVCAPS pCaps)
144 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
145 FIXME("%p %p\n", This, pCaps);
146 return E_NOTIMPL;
149 static HRESULT WINAPI dpvclient_GetCompressionTypes(IDirectPlayVoiceClient *iface, void *pData,
150 DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags)
152 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
153 FIXME("%p %p %p %p %d semi-stub\n", This, pData, pdwDataSize, pdwNumElements, dwFlags);
154 return DPVOICE_GetCompressionTypes(pData, pdwDataSize, pdwNumElements, dwFlags);
157 static HRESULT WINAPI dpvclient_SetTransmitTargets(IDirectPlayVoiceClient *iface, PDVID pdvIDTargets,
158 DWORD dwNumTargets, DWORD dwFlags)
160 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
161 FIXME("%p %p %d %d\n", This, pdvIDTargets, dwNumTargets, dwFlags);
162 return E_NOTIMPL;
165 static HRESULT WINAPI dpvclient_GetTransmitTargets(IDirectPlayVoiceClient *iface, PDVID pdvIDTargets,
166 DWORD *pdwNumTargets, DWORD dwFlags)
168 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
169 FIXME("%p %p %d\n", This, pdwNumTargets, dwFlags);
170 return E_NOTIMPL;
173 static HRESULT WINAPI dpvclient_Create3DSoundBuffer(IDirectPlayVoiceClient *iface, DVID dvID,
174 LPDIRECTSOUNDBUFFER lpdsSourceBuffer, DWORD dwPriority, DWORD dwFlags,
175 LPDIRECTSOUND3DBUFFER *lpUserBuffer)
177 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
178 FIXME("%p %d %p %d %d %p\n", This, dvID, lpdsSourceBuffer, dwPriority, dwFlags, lpUserBuffer);
179 return E_NOTIMPL;
182 static HRESULT WINAPI dpvclient_Delete3DSoundBuffer(IDirectPlayVoiceClient *iface, DVID dvID, LPDIRECTSOUND3DBUFFER *lpUserBuffer)
184 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
185 FIXME("%p %d %p\n", This, dvID, lpUserBuffer);
186 return E_NOTIMPL;
189 static HRESULT WINAPI dpvclient_SetNotifyMask(IDirectPlayVoiceClient *iface, DWORD *pdwMessageMask, DWORD dwMessageMaskElements)
191 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
192 FIXME("%p %p %d\n", This, pdwMessageMask, dwMessageMaskElements);
193 return E_NOTIMPL;
196 static HRESULT WINAPI dpvclient_GetSoundDeviceConfig(IDirectPlayVoiceClient *iface, PDVSOUNDDEVICECONFIG pSoundDeviceConfig,
197 DWORD *pdwSize)
199 IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
200 FIXME("%p %p %p\n", This, pSoundDeviceConfig, pdwSize);
201 return E_NOTIMPL;
205 static const IDirectPlayVoiceClientVtbl DirectPlayVoiceClient_Vtbl =
207 dpvclient_QueryInterface,
208 dpvclient_AddRef,
209 dpvclient_Release,
210 dpvclient_Initialize,
211 dpvclient_Connect,
212 dpvclient_Disconnect,
213 dpvclient_GetSessionDesc,
214 dpvclient_GetClientConfig,
215 dpvclient_SetClientConfig,
216 dpvclient_GetCaps,
217 dpvclient_GetCompressionTypes,
218 dpvclient_SetTransmitTargets,
219 dpvclient_GetTransmitTargets,
220 dpvclient_Create3DSoundBuffer,
221 dpvclient_Delete3DSoundBuffer,
222 dpvclient_SetNotifyMask,
223 dpvclient_GetSoundDeviceConfig
226 HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj)
228 IDirectPlayVoiceClientImpl* client;
229 HRESULT ret;
231 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
233 *ppobj = NULL;
235 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceClientImpl));
236 if (!client)
237 return E_OUTOFMEMORY;
239 client->IDirectPlayVoiceClient_iface.lpVtbl = &DirectPlayVoiceClient_Vtbl;
240 client->ref = 1;
242 ret = IDirectPlayVoiceClient_QueryInterface(&client->IDirectPlayVoiceClient_iface, riid, ppobj);
243 IDirectPlayVoiceClient_Release(&client->IDirectPlayVoiceClient_iface);
245 return ret;
248 static HRESULT WINAPI dpvtest_QueryInterface(IDirectPlayVoiceTest *iface, REFIID riid, void **ppv)
250 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceTest))
252 IUnknown_AddRef(iface);
253 *ppv = iface;
254 return S_OK;
257 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
258 return E_NOINTERFACE;
261 static ULONG WINAPI dpvtest_AddRef(IDirectPlayVoiceTest *iface)
263 IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
264 ULONG ref = InterlockedIncrement(&This->ref);
266 TRACE("(%p) ref=%u\n", This, ref);
268 return ref;
271 static ULONG WINAPI dpvtest_Release(IDirectPlayVoiceTest *iface)
273 IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
274 ULONG ref = InterlockedDecrement(&This->ref);
276 TRACE("(%p) ref=%u\n", This, ref);
278 if (!ref)
280 HeapFree(GetProcessHeap(), 0, This);
282 return ref;
285 static HRESULT WINAPI dpvtest_CheckAudioSetup(IDirectPlayVoiceTest *iface, const GUID *pguidPlaybackDevice, const GUID *pguidCaptureDevice,
286 HWND hwndParent, DWORD dwFlags)
288 IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
289 FIXME("%p %p %p %p %d\n", This, pguidPlaybackDevice, pguidCaptureDevice, hwndParent, dwFlags);
290 return E_NOTIMPL;
293 static const IDirectPlayVoiceTestVtbl DirectPlayVoiceTest_Vtbl =
295 dpvtest_QueryInterface,
296 dpvtest_AddRef,
297 dpvtest_Release,
298 dpvtest_CheckAudioSetup
301 HRESULT DPVOICE_CreateDirectPlayVoiceTest(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj)
303 IDirectPlayVoiceTestImpl* test;
304 HRESULT ret;
306 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
308 *ppobj = NULL;
310 test = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceTestImpl));
311 if (!test)
312 return E_OUTOFMEMORY;
314 test->IDirectPlayVoiceTest_iface.lpVtbl = &DirectPlayVoiceTest_Vtbl;
315 test->ref = 1;
317 ret = IDirectPlayVoiceTest_QueryInterface(&test->IDirectPlayVoiceTest_iface, riid, ppobj);
318 IDirectPlayVoiceTest_Release(&test->IDirectPlayVoiceTest_iface);
320 return ret;