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"
35 #include "dvoice_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice
);
39 typedef struct IDirectPlayVoiceClientImpl
41 IDirectPlayVoiceClient IDirectPlayVoiceClient_iface
;
43 } IDirectPlayVoiceClientImpl
;
45 typedef struct IDirectPlayVoiceTestImpl
47 IDirectPlayVoiceTest IDirectPlayVoiceTest_iface
;
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
);
70 WARN("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ppv
);
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
);
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
);
93 HeapFree(GetProcessHeap(), 0, This
);
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
);
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
);
114 static HRESULT WINAPI
dpvclient_Disconnect(IDirectPlayVoiceClient
*iface
, DWORD dwFlags
)
116 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
117 FIXME("%p %d\n", This
, dwFlags
);
121 static HRESULT WINAPI
dpvclient_GetSessionDesc(IDirectPlayVoiceClient
*iface
, PDVSESSIONDESC pvSessionDesc
)
123 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
124 FIXME("%p %p\n", This
, pvSessionDesc
);
128 static HRESULT WINAPI
dpvclient_GetClientConfig(IDirectPlayVoiceClient
*iface
, PDVCLIENTCONFIG pClientConfig
)
130 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
131 FIXME("%p %p\n", This
, pClientConfig
);
135 static HRESULT WINAPI
dpvclient_SetClientConfig(IDirectPlayVoiceClient
*iface
, PDVCLIENTCONFIG pClientConfig
)
137 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
138 FIXME("%p %p\n", This
, pClientConfig
);
142 static HRESULT WINAPI
dpvclient_GetCaps(IDirectPlayVoiceClient
*iface
, PDVCAPS pCaps
)
144 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
145 FIXME("%p %p\n", This
, pCaps
);
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
);
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
);
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
);
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
);
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
);
196 static HRESULT WINAPI
dpvclient_GetSoundDeviceConfig(IDirectPlayVoiceClient
*iface
, PDVSOUNDDEVICECONFIG pSoundDeviceConfig
,
199 IDirectPlayVoiceClientImpl
*This
= impl_from_IDirectPlayVoiceClient(iface
);
200 FIXME("%p %p %p\n", This
, pSoundDeviceConfig
, pdwSize
);
205 static const IDirectPlayVoiceClientVtbl DirectPlayVoiceClient_Vtbl
=
207 dpvclient_QueryInterface
,
210 dpvclient_Initialize
,
212 dpvclient_Disconnect
,
213 dpvclient_GetSessionDesc
,
214 dpvclient_GetClientConfig
,
215 dpvclient_SetClientConfig
,
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
;
231 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppobj
);
235 client
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlayVoiceClientImpl
));
237 return E_OUTOFMEMORY
;
239 client
->IDirectPlayVoiceClient_iface
.lpVtbl
= &DirectPlayVoiceClient_Vtbl
;
242 ret
= IDirectPlayVoiceClient_QueryInterface(&client
->IDirectPlayVoiceClient_iface
, riid
, ppobj
);
243 IDirectPlayVoiceClient_Release(&client
->IDirectPlayVoiceClient_iface
);
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
);
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
);
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
);
280 HeapFree(GetProcessHeap(), 0, This
);
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
);
293 static const IDirectPlayVoiceTestVtbl DirectPlayVoiceTest_Vtbl
=
295 dpvtest_QueryInterface
,
298 dpvtest_CheckAudioSetup
301 HRESULT
DPVOICE_CreateDirectPlayVoiceTest(IClassFactory
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, void **ppobj
)
303 IDirectPlayVoiceTestImpl
* test
;
306 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppobj
);
310 test
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlayVoiceTestImpl
));
312 return E_OUTOFMEMORY
;
314 test
->IDirectPlayVoiceTest_iface
.lpVtbl
= &DirectPlayVoiceTest_Vtbl
;
317 ret
= IDirectPlayVoiceTest_QueryInterface(&test
->IDirectPlayVoiceTest_iface
, riid
, ppobj
);
318 IDirectPlayVoiceTest_Release(&test
->IDirectPlayVoiceTest_iface
);