tool.c 4.8 KB
Newer Older
1 2
/* IDirectMusicTool8 Implementation
 *
3
 * Copyright (C) 2003-2004 Rok Mandeljc
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 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 Library General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18 19 20 21
 */

#include "dmime_private.h"

22
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
23

24
/* IDirectMusicTool8Impl IUnknown part: */
25
static HRESULT WINAPI IDirectMusicTool8Impl_QueryInterface (LPDIRECTMUSICTOOL8 iface, REFIID riid, LPVOID *ppobj) {
26
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
27
	TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
28 29 30
	if (IsEqualIID (riid, &IID_IUnknown) || 
	    IsEqualIID (riid, &IID_IDirectMusicTool) ||
	    IsEqualIID (riid, &IID_IDirectMusicTool8)) {
31
		IUnknown_AddRef(iface);
32 33 34
		*ppobj = This;
		return S_OK;
	}
35
	WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
36 37 38
	return E_NOINTERFACE;
}

39
static ULONG WINAPI IDirectMusicTool8Impl_AddRef (LPDIRECTMUSICTOOL8 iface) {
40
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
41 42
        ULONG ref = InterlockedIncrement(&This->ref);

43
	TRACE("(%p) : AddRef from %d\n", This, ref - 1);
44

45 46
	DMIME_LockModule();

47
	return ref;
48 49
}

Mike McCormack's avatar
Mike McCormack committed
50
static ULONG WINAPI IDirectMusicTool8Impl_Release (LPDIRECTMUSICTOOL8 iface) {
51
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
52
	ULONG ref = InterlockedDecrement(&This->ref);
53
	TRACE("(%p) : ReleaseRef to %d\n", This, ref);
54
	
55
	if (ref == 0) {
56 57
		HeapFree(GetProcessHeap(), 0, This);
	}
58 59 60

	DMIME_UnlockModule();
	
61 62 63
	return ref;
}

64
/* IDirectMusicTool8Impl IDirectMusicTool part: */
Mike McCormack's avatar
Mike McCormack committed
65
static HRESULT WINAPI IDirectMusicTool8Impl_Init (LPDIRECTMUSICTOOL8 iface, IDirectMusicGraph* pGraph) {
66
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
67 68 69 70
	FIXME("(%p, %p): stub\n", This, pGraph);
	return S_OK;
}

Mike McCormack's avatar
Mike McCormack committed
71
static HRESULT WINAPI IDirectMusicTool8Impl_GetMsgDeliveryType (LPDIRECTMUSICTOOL8 iface, DWORD* pdwDeliveryType) {
72
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
73 74 75 76
	FIXME("(%p, %p): stub\n", This, pdwDeliveryType);
	return S_OK;
}

Mike McCormack's avatar
Mike McCormack committed
77
static HRESULT WINAPI IDirectMusicTool8Impl_GetMediaTypeArraySize (LPDIRECTMUSICTOOL8 iface, DWORD* pdwNumElements) {
78
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
79 80 81 82
	FIXME("(%p, %p): stub\n", This, pdwNumElements);
	return S_OK;
}

Mike McCormack's avatar
Mike McCormack committed
83
static HRESULT WINAPI IDirectMusicTool8Impl_GetMediaTypes (LPDIRECTMUSICTOOL8 iface, DWORD** padwMediaTypes, DWORD dwNumElements) {
84
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
85
	FIXME("(%p, %p, %d): stub\n", This, padwMediaTypes, dwNumElements);
86 87 88
	return S_OK;
}

Mike McCormack's avatar
Mike McCormack committed
89
static HRESULT WINAPI IDirectMusicTool8Impl_ProcessPMsg (LPDIRECTMUSICTOOL8 iface, IDirectMusicPerformance* pPerf, DMUS_PMSG* pPMSG) {
90
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
91 92 93 94
	FIXME("(%p, %p, %p): stub\n", This, pPerf, pPMSG);
	return S_OK;
}

Mike McCormack's avatar
Mike McCormack committed
95
static HRESULT WINAPI IDirectMusicTool8Impl_Flush (LPDIRECTMUSICTOOL8 iface, IDirectMusicPerformance* pPerf, DMUS_PMSG* pPMSG, REFERENCE_TIME rtTime) {
96
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
97
	FIXME("(%p, %p, %p, 0x%s): stub\n", This, pPerf, pPMSG, wine_dbgstr_longlong(rtTime));
98 99 100
	return S_OK;
}

101
/* IDirectMusicTool8Impl IDirectMusicTool8 part: */
Mike McCormack's avatar
Mike McCormack committed
102
static HRESULT WINAPI IDirectMusicTool8Impl_Clone (LPDIRECTMUSICTOOL8 iface, IDirectMusicTool** ppTool) {
103
	IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
104 105 106 107
	FIXME("(%p, %p): stub\n", This, ppTool);
	return S_OK;
}

108
static const IDirectMusicTool8Vtbl DirectMusicTool8_Vtbl = {
109 110 111 112 113 114 115 116 117 118 119 120 121
	IDirectMusicTool8Impl_QueryInterface,
	IDirectMusicTool8Impl_AddRef,
	IDirectMusicTool8Impl_Release,
	IDirectMusicTool8Impl_Init,
	IDirectMusicTool8Impl_GetMsgDeliveryType,
	IDirectMusicTool8Impl_GetMediaTypeArraySize,
	IDirectMusicTool8Impl_GetMediaTypes,
	IDirectMusicTool8Impl_ProcessPMsg,
	IDirectMusicTool8Impl_Flush,
	IDirectMusicTool8Impl_Clone
};

/* for ClassFactory */
122 123 124 125 126
HRESULT WINAPI DMUSIC_CreateDirectMusicobjImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
	IDirectMusicTool8Impl* obj;
	
	obj = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTool8Impl));
	if (NULL == obj) {
127
		*ppobj = NULL;
128
		return E_OUTOFMEMORY;
129
	}
130 131
	obj->lpVtbl = &DirectMusicTool8_Vtbl;
	obj->ref = 0; /* will be inited by QueryInterface */
132
	
133
	return IDirectMusicTool8Impl_QueryInterface ((LPDIRECTMUSICTOOL8)obj, lpcGUID, ppobj);	
134
}