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
31 #include "wine/unicode.h"
32 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice
);
38 typedef struct IDirectPlayVoiceClientImpl
40 IDirectPlayVoiceClient IDirectPlayVoiceClient_iface
;
42 } IDirectPlayVoiceClientImpl
;
44 typedef struct IDirectPlayVoiceTestImpl
46 IDirectPlayVoiceTest IDirectPlayVoiceTest_iface
;
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
);
69 WARN("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ppv
);
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
);
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
);
92 HeapFree(GetProcessHeap(), 0, This
);
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
);
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
);
113 static HRESULT WINAPI
dpvclient_Disconnect(IDirectPlayVoiceClient
*iface
, DWORD dwFlags
)
115 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
116 FIXME("%p %d\n", This
, dwFlags
);
120 static HRESULT WINAPI
dpvclient_GetSessionDesc(IDirectPlayVoiceClient
*iface
, PDVSESSIONDESC pvSessionDesc
)
122 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
123 FIXME("%p %p\n", This
, pvSessionDesc
);
127 static HRESULT WINAPI
dpvclient_GetClientConfig(IDirectPlayVoiceClient
*iface
, PDVCLIENTCONFIG pClientConfig
)
129 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
130 FIXME("%p %p\n", This
, pClientConfig
);
134 static HRESULT WINAPI
dpvclient_SetClientConfig(IDirectPlayVoiceClient
*iface
, PDVCLIENTCONFIG pClientConfig
)
136 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
137 FIXME("%p %p\n", This
, pClientConfig
);
141 static HRESULT WINAPI
dpvclient_GetCaps(IDirectPlayVoiceClient
*iface
, PDVCAPS pCaps
)
143 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
144 FIXME("%p %p\n", This
, pCaps
);
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
);
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
);
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
);
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
);
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
);
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
);
195 static HRESULT WINAPI
dpvclient_GetSoundDeviceConfig(IDirectPlayVoiceClient
*iface
, PDVSOUNDDEVICECONFIG pSoundDeviceConfig
,
198 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
199 FIXME("%p %p %p\n", This
, pSoundDeviceConfig
, pdwSize
);
204 static const IDirectPlayVoiceClientVtbl DirectPlayVoiceClient_Vtbl
=
206 dpvclient_QueryInterface
,
209 dpvclient_Initialize
,
211 dpvclient_Disconnect
,
212 dpvclient_GetSessionDesc
,
213 dpvclient_GetClientConfig
,
214 dpvclient_SetClientConfig
,
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
;
230 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppobj
);
234 client
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlayVoiceClientImpl
));
236 return E_OUTOFMEMORY
;
238 client
->IDirectPlayVoiceClient_iface
.lpVtbl
= &DirectPlayVoiceClient_Vtbl
;
241 ret
= IDirectPlayVoiceClient_QueryInterface(&client
->IDirectPlayVoiceClient_iface
, riid
, ppobj
);
242 IDirectPlayVoiceClient_Release(&client
->IDirectPlayVoiceClient_iface
);
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
);
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
);
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
);
279 HeapFree(GetProcessHeap(), 0, This
);
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
);
292 static const IDirectPlayVoiceTestVtbl DirectPlayVoiceTest_Vtbl
=
294 dpvtest_QueryInterface
,
297 dpvtest_CheckAudioSetup
300 HRESULT
DPVOICE_CreateDirectPlayVoiceTest(IClassFactory
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, void **ppobj
)
302 IDirectPlayVoiceTestImpl
* test
;
305 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppobj
);
309 test
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlayVoiceTestImpl
));
311 return E_OUTOFMEMORY
;
313 test
->IDirectPlayVoiceTest_iface
.lpVtbl
= &DirectPlayVoiceTest_Vtbl
;
316 ret
= IDirectPlayVoiceTest_QueryInterface(&test
->IDirectPlayVoiceTest_iface
, riid
, ppobj
);
317 IDirectPlayVoiceTest_Release(&test
->IDirectPlayVoiceTest_iface
);