dpvoice: Add IDirectPlayVoiceClient Support.

This commit is contained in:
Alistair Leslie-Hughes 2014-04-14 14:53:58 +10:00 committed by Alexandre Julliard
parent d62f0f5e63
commit 300f53a4f8
4 changed files with 347 additions and 4 deletions

View file

@ -1,6 +1,8 @@
MODULE = dpvoice.dll
IMPORTS = dxguid uuid
C_SRCS = \
client.c \
main.c
RC_SRCS = version.rc

234
dlls/dpvoice/client.c Normal file
View file

@ -0,0 +1,234 @@
/*
* DirectPlay Voice Client Interface
*
* Copyright (C) 2014 Alistair Leslie-Hughes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "dvoice.h"
WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
typedef struct IDirectPlayVoiceClientImpl
{
IDirectPlayVoiceClient IDirectPlayVoiceClient_iface;
LONG ref;
} IDirectPlayVoiceClientImpl;
static inline IDirectPlayVoiceClientImpl *impl_from_IDirectPlayVoiceClient(IDirectPlayVoiceClient *iface)
{
return CONTAINING_RECORD(iface, IDirectPlayVoiceClientImpl, IDirectPlayVoiceClient_iface);
}
static HRESULT WINAPI dpvclient_QueryInterface(IDirectPlayVoiceClient *iface, REFIID riid, void **ppv)
{
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceClient))
{
IUnknown_AddRef(iface);
*ppv = iface;
return S_OK;
}
WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
static ULONG WINAPI dpvclient_AddRef(IDirectPlayVoiceClient *iface)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%u\n", This, ref);
return ref;
}
static ULONG WINAPI dpvclient_Release(IDirectPlayVoiceClient *iface)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%u\n", This, ref);
if (!ref)
{
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI dpvclient_Initialize(IDirectPlayVoiceClient *iface,LPUNKNOWN pVoid, PDVMESSAGEHANDLER pMessageHandler,
void *pUserContext, DWORD *pdwMessageMask, DWORD dwMessageMaskElements)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p %p %p %p %d\n", This, pVoid, pMessageHandler, pUserContext,pdwMessageMask, dwMessageMaskElements);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_Connect(IDirectPlayVoiceClient *iface, PDVSOUNDDEVICECONFIG pSoundDeviceConfig,
PDVCLIENTCONFIG pdvClientConfig, DWORD dwFlags)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p %p %d\n", This, pSoundDeviceConfig, pdvClientConfig, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_Disconnect(IDirectPlayVoiceClient *iface, DWORD dwFlags)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %d\n", This, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_GetSessionDesc(IDirectPlayVoiceClient *iface, PDVSESSIONDESC pvSessionDesc)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p\n", This, pvSessionDesc);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_GetClientConfig(IDirectPlayVoiceClient *iface, PDVCLIENTCONFIG pClientConfig)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p\n", This, pClientConfig);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_SetClientConfig(IDirectPlayVoiceClient *iface, PDVCLIENTCONFIG pClientConfig)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p\n", This, pClientConfig);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_GetCaps(IDirectPlayVoiceClient *iface, PDVCAPS pCaps)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p\n", This, pCaps);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_GetCompressionTypes(IDirectPlayVoiceClient *iface, void *pData,
DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p %p %p %d\n", This, pData, pdwDataSize, pdwNumElements, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_SetTransmitTargets(IDirectPlayVoiceClient *iface, PDVID pdvIDTargets,
DWORD dwNumTargets, DWORD dwFlags)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p %d %d\n", This, pdvIDTargets, dwNumTargets, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_GetTransmitTargets(IDirectPlayVoiceClient *iface, PDVID pdvIDTargets,
DWORD *pdwNumTargets, DWORD dwFlags)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p %d\n", This, pdwNumTargets, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_Create3DSoundBuffer(IDirectPlayVoiceClient *iface, DVID dvID,
LPDIRECTSOUNDBUFFER lpdsSourceBuffer, DWORD dwPriority, DWORD dwFlags,
LPDIRECTSOUND3DBUFFER *lpUserBuffer)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %d %p %d %d %p\n", This, dvID, lpdsSourceBuffer, dwPriority, dwFlags, lpUserBuffer);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_Delete3DSoundBuffer(IDirectPlayVoiceClient *iface, DVID dvID, LPDIRECTSOUND3DBUFFER *lpUserBuffer)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %d %p\n", This, dvID, lpUserBuffer);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_SetNotifyMask(IDirectPlayVoiceClient *iface, DWORD *pdwMessageMask, DWORD dwMessageMaskElements)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p %d\n", This, pdwMessageMask, dwMessageMaskElements);
return E_NOTIMPL;
}
static HRESULT WINAPI dpvclient_GetSoundDeviceConfig(IDirectPlayVoiceClient *iface, PDVSOUNDDEVICECONFIG pSoundDeviceConfig,
DWORD *pdwSize)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
FIXME("%p %p %p\n", This, pSoundDeviceConfig, pdwSize);
return E_NOTIMPL;
}
static const IDirectPlayVoiceClientVtbl DirectPlayVoiceClient_Vtbl =
{
dpvclient_QueryInterface,
dpvclient_AddRef,
dpvclient_Release,
dpvclient_Initialize,
dpvclient_Connect,
dpvclient_Disconnect,
dpvclient_GetSessionDesc,
dpvclient_GetClientConfig,
dpvclient_SetClientConfig,
dpvclient_GetCaps,
dpvclient_GetCompressionTypes,
dpvclient_SetTransmitTargets,
dpvclient_GetTransmitTargets,
dpvclient_Create3DSoundBuffer,
dpvclient_Delete3DSoundBuffer,
dpvclient_SetNotifyMask,
dpvclient_GetSoundDeviceConfig
};
HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj)
{
IDirectPlayVoiceClientImpl* client;
HRESULT ret;
TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
*ppobj = NULL;
client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceClientImpl));
if (!client)
return E_OUTOFMEMORY;
client->IDirectPlayVoiceClient_iface.lpVtbl = &DirectPlayVoiceClient_Vtbl;
client->ref = 1;
ret = IDirectPlayVoiceClient_QueryInterface(&client->IDirectPlayVoiceClient_iface, riid, ppobj);
IDirectPlayVoiceClient_Release(&client->IDirectPlayVoiceClient_iface);
return ret;
}

View file

@ -0,0 +1,25 @@
/*
* DirectPlay Voice
*
* Copyright (C) 2014 Alistair Leslie-Hughes
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __DVOICE_PRIVATE_H__
#define __DVOICE_PRIVATE_H__
extern HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
#endif

View file

@ -27,11 +27,78 @@
#include "rpcproxy.h"
#include "wine/debug.h"
#include "initguid.h"
#include "dvoice.h"
#include "dvoice_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
static HINSTANCE DPVOICE_hInstance;
HRESULT WINAPI DirectPlayVoiceCreate(LPCGUID pIID, PVOID *ppvInterface)
typedef struct
{
IClassFactory IClassFactory_iface;
LONG ref;
REFCLSID rclsid;
HRESULT (*pfnCreateInstanceFactory)(IClassFactory *iface, IUnknown *punkOuter, REFIID riid, void **ppobj);
} IClassFactoryImpl;
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,void **ppobj)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
}
static HRESULT WINAPI DICF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
return This->pfnCreateInstanceFactory(iface, pOuter, riid, ppobj);
}
static HRESULT WINAPI DICF_LockServer(IClassFactory *iface,BOOL dolock)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static const IClassFactoryVtbl DICF_Vtbl = {
DICF_QueryInterface,
DICF_AddRef,
DICF_Release,
DICF_CreateInstance,
DICF_LockServer
};
static IClassFactoryImpl DPVOICE_CFS[] =
{
{ { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceClient, DPVOICE_CreateDirectPlayVoiceClient },
{ { NULL }, 0, NULL, NULL }
};
HRESULT WINAPI DirectPlayVoiceCreate(LPCGUID pIID, void **ppvInterface)
{
FIXME("(%p, %p) stub\n", pIID, ppvInterface);
return E_NOTIMPL;
@ -57,10 +124,25 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
{
FIXME(":stub\n");
return E_FAIL;
int i = 0;
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
while (NULL != DPVOICE_CFS[i].rclsid)
{
if (IsEqualGUID(rclsid, DPVOICE_CFS[i].rclsid))
{
DICF_AddRef(&DPVOICE_CFS[i].IClassFactory_iface);
*ppv = &DPVOICE_CFS[i];
return S_OK;
}
++i;
}
FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return CLASS_E_CLASSNOTAVAILABLE;
}
HRESULT WINAPI DllCanUnloadNow(void)