Fixed header dependencies to be fully compatible with the Windows
[wine/multimedia.git] / dlls / dmcompos / chordmap.c
blob66c0d6dc791c11623e480502ecb9fa4aaca0b011
1 /* IDirectMusicChordMap Implementation
3 * Copyright (C) 2003 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winuser.h"
25 #include "wingdi.h"
26 #include "wine/debug.h"
28 #include "dmcompos_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos);
32 /* IDirectMusicChordMap IUnknown parts follow: */
33 HRESULT WINAPI IDirectMusicChordMapImpl_QueryInterface (LPDIRECTMUSICCHORDMAP iface, REFIID riid, LPVOID *ppobj)
35 ICOM_THIS(IDirectMusicChordMapImpl,iface);
37 if (IsEqualIID (riid, &IID_IUnknown) ||
38 IsEqualIID (riid, &IID_IDirectMusicChordMap)) {
39 IDirectMusicChordMapImpl_AddRef(iface);
40 *ppobj = This;
41 return S_OK;
44 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
45 return E_NOINTERFACE;
48 ULONG WINAPI IDirectMusicChordMapImpl_AddRef (LPDIRECTMUSICCHORDMAP iface)
50 ICOM_THIS(IDirectMusicChordMapImpl,iface);
51 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
52 return ++(This->ref);
55 ULONG WINAPI IDirectMusicChordMapImpl_Release (LPDIRECTMUSICCHORDMAP iface)
57 ICOM_THIS(IDirectMusicChordMapImpl,iface);
58 ULONG ref = --This->ref;
59 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
60 if (ref == 0) {
61 HeapFree(GetProcessHeap(), 0, This);
63 return ref;
66 /* IDirectMusicChordMap Interface follow: */
67 HRESULT WINAPI IDirectMusicChordMapImpl_GetScale (LPDIRECTMUSICCHORDMAP iface, DWORD* pdwScale)
69 ICOM_THIS(IDirectMusicChordMapImpl,iface);
71 TRACE("(%p, %p)\n", This, pdwScale);
72 *pdwScale = This->dwScale;
74 return S_OK;
77 ICOM_VTABLE(IDirectMusicChordMap) DirectMusicChordMap_Vtbl =
79 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
80 IDirectMusicChordMapImpl_QueryInterface,
81 IDirectMusicChordMapImpl_AddRef,
82 IDirectMusicChordMapImpl_Release,
83 IDirectMusicChordMapImpl_GetScale
86 /* for ClassFactory */
87 HRESULT WINAPI DMUSIC_CreateDirectMusicChordMap (LPCGUID lpcGUID, LPDIRECTMUSICCHORDMAP* ppDMCM, LPUNKNOWN pUnkOuter)
89 IDirectMusicChordMapImpl* dmchordmap;
91 if (IsEqualIID (lpcGUID, &IID_IDirectMusicChordMap)) {
92 dmchordmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapImpl));
93 if (NULL == dmchordmap) {
94 *ppDMCM = (LPDIRECTMUSICCHORDMAP) NULL;
95 return E_OUTOFMEMORY;
97 dmchordmap->lpVtbl = &DirectMusicChordMap_Vtbl;
98 dmchordmap->ref = 1;
99 *ppDMCM = (LPDIRECTMUSICCHORDMAP) dmchordmap;
100 return S_OK;
102 WARN("No interface found\n");
104 return E_NOINTERFACE;
107 /*****************************************************************************
108 * IDirectMusicChordMapObject implementation
110 /* IDirectMusicChordMapObject IUnknown part: */
111 HRESULT WINAPI IDirectMusicChordMapObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj)
113 ICOM_THIS(IDirectMusicChordMapObject,iface);
115 if (IsEqualIID (riid, &IID_IUnknown)
116 || IsEqualIID (riid, &IID_IDirectMusicObject)) {
117 IDirectMusicChordMapObject_AddRef(iface);
118 *ppobj = This;
119 return S_OK;
120 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
121 IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream);
122 *ppobj = (LPPERSISTSTREAM)This->pStream;
123 return S_OK;
124 } else if (IsEqualIID (riid, &IID_IDirectMusicChordMap)) {
125 IDirectMusicChordMap_AddRef ((LPDIRECTMUSICCHORDMAP)This->pChordMap);
126 *ppobj = (LPDIRECTMUSICCHORDMAP)This->pChordMap;
127 return S_OK;
129 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
130 return E_NOINTERFACE;
133 ULONG WINAPI IDirectMusicChordMapObject_AddRef (LPDIRECTMUSICOBJECT iface)
135 ICOM_THIS(IDirectMusicChordMapObject,iface);
136 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
137 return ++(This->ref);
140 ULONG WINAPI IDirectMusicChordMapObject_Release (LPDIRECTMUSICOBJECT iface)
142 ICOM_THIS(IDirectMusicChordMapObject,iface);
143 ULONG ref = --This->ref;
144 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
145 if (ref == 0) {
146 HeapFree(GetProcessHeap(), 0, This);
148 return ref;
151 /* IDirectMusicChordMapObject IDirectMusicObject part: */
152 HRESULT WINAPI IDirectMusicChordMapObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
154 ICOM_THIS(IDirectMusicChordMapObject,iface);
156 TRACE("(%p, %p)\n", This, pDesc);
157 pDesc = This->pDesc;
159 return S_OK;
162 HRESULT WINAPI IDirectMusicChordMapObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
164 ICOM_THIS(IDirectMusicChordMapObject,iface);
166 TRACE("(%p, %p)\n", This, pDesc);
167 This->pDesc = pDesc;
169 return S_OK;
172 HRESULT WINAPI IDirectMusicChordMapObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc)
174 ICOM_THIS(IDirectMusicChordMapObject,iface);
176 FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc);
178 return S_OK;
181 ICOM_VTABLE(IDirectMusicObject) DirectMusicChordMapObject_Vtbl =
183 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
184 IDirectMusicChordMapObject_QueryInterface,
185 IDirectMusicChordMapObject_AddRef,
186 IDirectMusicChordMapObject_Release,
187 IDirectMusicChordMapObject_GetDescriptor,
188 IDirectMusicChordMapObject_SetDescriptor,
189 IDirectMusicChordMapObject_ParseDescriptor
192 /* for ClassFactory */
193 HRESULT WINAPI DMUSIC_CreateDirectMusicChordMapObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter)
195 IDirectMusicChordMapObject *obj;
197 TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter);
198 if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) {
199 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapObject));
200 if (NULL == obj) {
201 *ppObject = (LPDIRECTMUSICOBJECT) NULL;
202 return E_OUTOFMEMORY;
204 obj->lpVtbl = &DirectMusicChordMapObject_Vtbl;
205 obj->ref = 1;
206 /* prepare IPersistStream */
207 obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapObjectStream));
208 obj->pStream->lpVtbl = &DirectMusicChordMapObjectStream_Vtbl;
209 obj->pStream->ref = 1;
210 obj->pStream->pParentObject = obj;
211 /* prepare IDirectMusiChordMap */
212 DMUSIC_CreateDirectMusicChordMap (&IID_IDirectMusicChordMap, (LPDIRECTMUSICCHORDMAP*)&obj->pChordMap, NULL);
213 obj->pChordMap->pObject = obj;
214 *ppObject = (LPDIRECTMUSICOBJECT) obj;
215 return S_OK;
217 WARN("No interface found\n");
219 return E_NOINTERFACE;
222 /*****************************************************************************
223 * IDirectMusicChordMapObjectStream implementation
225 /* IDirectMusicChordMapObjectStream IUnknown part: */
226 HRESULT WINAPI IDirectMusicChordMapObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj)
228 ICOM_THIS(IDirectMusicChordMapObjectStream,iface);
230 if (IsEqualIID (riid, &IID_IUnknown)
231 || IsEqualIID (riid, &IID_IPersistStream)) {
232 IDirectMusicChordMapObjectStream_AddRef(iface);
233 *ppobj = This;
234 return S_OK;
236 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
237 return E_NOINTERFACE;
240 ULONG WINAPI IDirectMusicChordMapObjectStream_AddRef (LPPERSISTSTREAM iface)
242 ICOM_THIS(IDirectMusicChordMapObjectStream,iface);
243 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
244 return ++(This->ref);
247 ULONG WINAPI IDirectMusicChordMapObjectStream_Release (LPPERSISTSTREAM iface)
249 ICOM_THIS(IDirectMusicChordMapObjectStream,iface);
250 ULONG ref = --This->ref;
251 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
252 if (ref == 0) {
253 HeapFree(GetProcessHeap(), 0, This);
255 return ref;
258 /* IDirectMusicChordMapObjectStream IPersist part: */
259 HRESULT WINAPI IDirectMusicChordMapObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID)
261 return E_NOTIMPL;
264 /* IDirectMusicChordMapObjectStream IPersistStream part: */
265 HRESULT WINAPI IDirectMusicChordMapObjectStream_IsDirty (LPPERSISTSTREAM iface)
267 return E_NOTIMPL;
270 HRESULT WINAPI IDirectMusicChordMapObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm)
272 FIXME(": Loading not implemented yet\n");
273 return S_OK;
276 HRESULT WINAPI IDirectMusicChordMapObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty)
278 return E_NOTIMPL;
281 HRESULT WINAPI IDirectMusicChordMapObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize)
283 return E_NOTIMPL;
286 ICOM_VTABLE(IPersistStream) DirectMusicChordMapObjectStream_Vtbl =
288 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
289 IDirectMusicChordMapObjectStream_QueryInterface,
290 IDirectMusicChordMapObjectStream_AddRef,
291 IDirectMusicChordMapObjectStream_Release,
292 IDirectMusicChordMapObjectStream_GetClassID,
293 IDirectMusicChordMapObjectStream_IsDirty,
294 IDirectMusicChordMapObjectStream_Load,
295 IDirectMusicChordMapObjectStream_Save,
296 IDirectMusicChordMapObjectStream_GetSizeMax