1 /* IDirectMusicStyle8 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.
24 #include "wine/debug.h"
26 #include "dmstyle_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
30 /* IDirectMusicStyle8 IUnknown part: */
31 HRESULT WINAPI IDirectMusicStyle8Impl_QueryInterface (LPDIRECTMUSICSTYLE8 iface, REFIID riid, LPVOID *ppobj)
33 ICOM_THIS(IDirectMusicStyle8Impl,iface);
35 if (IsEqualIID (riid, &IID_IUnknown) ||
36 IsEqualIID (riid, &IID_IDirectMusicStyle) ||
37 IsEqualIID (riid, &IID_IDirectMusicStyle8)) {
38 IDirectMusicStyle8Impl_AddRef(iface);
43 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
47 ULONG WINAPI IDirectMusicStyle8Impl_AddRef (LPDIRECTMUSICSTYLE8 iface)
49 ICOM_THIS(IDirectMusicStyle8Impl,iface);
50 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
54 ULONG WINAPI IDirectMusicStyle8Impl_Release (LPDIRECTMUSICSTYLE8 iface)
56 ICOM_THIS(IDirectMusicStyle8Impl,iface);
57 ULONG ref = --This->ref;
58 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
60 HeapFree(GetProcessHeap(), 0, This);
65 /* IDirectMusicStyle8 IDirectMusicStyle part: */
66 HRESULT WINAPI IDirectMusicStyle8Impl_GetBand (LPDIRECTMUSICSTYLE8 iface, WCHAR* pwszName, IDirectMusicBand** ppBand)
68 ICOM_THIS(IDirectMusicStyle8Impl,iface);
70 FIXME("(%p, %p, %p): stub\n", This, pwszName, ppBand);
75 HRESULT WINAPI IDirectMusicStyle8Impl_EnumBand (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, WCHAR* pwszName)
77 ICOM_THIS(IDirectMusicStyle8Impl,iface);
79 FIXME("(%p, %ld, %p): stub\n", This, dwIndex, pwszName);
84 HRESULT WINAPI IDirectMusicStyle8Impl_GetDefaultBand (LPDIRECTMUSICSTYLE8 iface, IDirectMusicBand** ppBand)
86 ICOM_THIS(IDirectMusicStyle8Impl,iface);
88 FIXME("(%p, %p): stub\n", This, ppBand);
93 HRESULT WINAPI IDirectMusicStyle8Impl_EnumMotif (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, WCHAR* pwszName)
95 ICOM_THIS(IDirectMusicStyle8Impl,iface);
97 FIXME("(%p, %ld, %p): stub\n", This, dwIndex, pwszName);
102 HRESULT WINAPI IDirectMusicStyle8Impl_GetMotif (LPDIRECTMUSICSTYLE8 iface, WCHAR* pwszName, IDirectMusicSegment** ppSegment)
104 ICOM_THIS(IDirectMusicStyle8Impl,iface);
106 FIXME("(%p, %p, %p): stub\n", This, pwszName, ppSegment);
111 HRESULT WINAPI IDirectMusicStyle8Impl_GetDefaultChordMap (LPDIRECTMUSICSTYLE8 iface, IDirectMusicChordMap** ppChordMap)
113 ICOM_THIS(IDirectMusicStyle8Impl,iface);
115 FIXME("(%p, %p): stub\n", This, ppChordMap);
120 HRESULT WINAPI IDirectMusicStyle8Impl_EnumChordMap (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, WCHAR* pwszName)
122 ICOM_THIS(IDirectMusicStyle8Impl,iface);
124 FIXME("(%p, %ld, %p): stub\n", This, dwIndex, pwszName);
129 HRESULT WINAPI IDirectMusicStyle8Impl_GetChordMap (LPDIRECTMUSICSTYLE8 iface, WCHAR* pwszName, IDirectMusicChordMap** ppChordMap)
131 ICOM_THIS(IDirectMusicStyle8Impl,iface);
133 FIXME("(%p, %p, %p): stub\n", This, pwszName, ppChordMap);
138 HRESULT WINAPI IDirectMusicStyle8Impl_GetTimeSignature (LPDIRECTMUSICSTYLE8 iface, DMUS_TIMESIGNATURE* pTimeSig)
140 ICOM_THIS(IDirectMusicStyle8Impl,iface);
142 FIXME("(%p, %p): stub\n", This, pTimeSig);
147 HRESULT WINAPI IDirectMusicStyle8Impl_GetEmbellishmentLength (LPDIRECTMUSICSTYLE8 iface, DWORD dwType, DWORD dwLevel, DWORD* pdwMin, DWORD* pdwMax)
149 ICOM_THIS(IDirectMusicStyle8Impl,iface);
151 FIXME("(%p, %ld, %ld, %p, %p): stub\n", This, dwType, dwLevel, pdwMin, pdwMax);
156 HRESULT WINAPI IDirectMusicStyle8Impl_GetTempo (LPDIRECTMUSICSTYLE8 iface, double* pTempo)
158 ICOM_THIS(IDirectMusicStyle8Impl,iface);
160 FIXME("(%p, %p): stub\n", This, pTempo);
165 /* IDirectMusicStyle8 IDirectMusicStyle8 part: */
166 HRESULT WINAPI IDirectMusicStyle8ImplEnumPattern (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, DWORD dwPatternType, WCHAR* pwszName)
168 ICOM_THIS(IDirectMusicStyle8Impl,iface);
170 FIXME("(%p, %ld, %ld, %p): stub\n", This, dwIndex, dwPatternType, pwszName);
175 ICOM_VTABLE(IDirectMusicStyle8) DirectMusicStyle8_Vtbl =
177 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
178 IDirectMusicStyle8Impl_QueryInterface,
179 IDirectMusicStyle8Impl_AddRef,
180 IDirectMusicStyle8Impl_Release,
181 IDirectMusicStyle8Impl_GetBand,
182 IDirectMusicStyle8Impl_EnumBand,
183 IDirectMusicStyle8Impl_GetDefaultBand,
184 IDirectMusicStyle8Impl_EnumMotif,
185 IDirectMusicStyle8Impl_GetMotif,
186 IDirectMusicStyle8Impl_GetDefaultChordMap,
187 IDirectMusicStyle8Impl_EnumChordMap,
188 IDirectMusicStyle8Impl_GetChordMap,
189 IDirectMusicStyle8Impl_GetTimeSignature,
190 IDirectMusicStyle8Impl_GetEmbellishmentLength,
191 IDirectMusicStyle8Impl_GetTempo,
192 IDirectMusicStyle8ImplEnumPattern
195 /* for ClassFactory */
196 HRESULT WINAPI DMUSIC_CreateDirectMusicStyle (LPCGUID lpcGUID, LPDIRECTMUSICSTYLE8* ppDMStyle, LPUNKNOWN pUnkOuter)
198 IDirectMusicStyle8Impl* dmstlye;
200 if (IsEqualIID (lpcGUID, &IID_IDirectMusicStyle)
201 || IsEqualIID (lpcGUID, &IID_IDirectMusicStyle8)) {
202 dmstlye = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyle8Impl));
203 if (NULL == dmstlye) {
204 *ppDMStyle = (LPDIRECTMUSICSTYLE8) NULL;
205 return E_OUTOFMEMORY;
207 dmstlye->lpVtbl = &DirectMusicStyle8_Vtbl;
209 *ppDMStyle = (LPDIRECTMUSICSTYLE8) dmstlye;
213 WARN("No interface found\n");
214 return E_NOINTERFACE;
218 /*****************************************************************************
219 * IDirectMusicStyleObject implementation
221 /* IDirectMusicStyleObject IUnknown part: */
222 HRESULT WINAPI IDirectMusicStyleObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj)
224 ICOM_THIS(IDirectMusicStyleObject,iface);
226 if (IsEqualIID (riid, &IID_IUnknown)
227 || IsEqualIID (riid, &IID_IDirectMusicObject)) {
228 IDirectMusicStyleObject_AddRef(iface);
231 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
232 IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream);
233 *ppobj = (LPPERSISTSTREAM)This->pStream;
235 } else if (IsEqualIID (riid, &IID_IDirectMusicStyle)
236 || IsEqualIID (riid, &IID_IDirectMusicStyle8)) {
237 IDirectMusicStyle8_AddRef ((LPDIRECTMUSICSTYLE8)This->pStyle);
238 *ppobj = (LPDIRECTMUSICSTYLE8)This->pStyle;
242 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
243 return E_NOINTERFACE;
246 ULONG WINAPI IDirectMusicStyleObject_AddRef (LPDIRECTMUSICOBJECT iface)
248 ICOM_THIS(IDirectMusicStyleObject,iface);
249 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
250 return ++(This->ref);
253 ULONG WINAPI IDirectMusicStyleObject_Release (LPDIRECTMUSICOBJECT iface)
255 ICOM_THIS(IDirectMusicStyleObject,iface);
256 ULONG ref = --This->ref;
257 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
259 HeapFree(GetProcessHeap(), 0, This);
264 /* IDirectMusicStyleObject IDirectMusicObject part: */
265 HRESULT WINAPI IDirectMusicStyleObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
267 ICOM_THIS(IDirectMusicStyleObject,iface);
269 TRACE("(%p, %p)\n", This, pDesc);
275 HRESULT WINAPI IDirectMusicStyleObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
277 ICOM_THIS(IDirectMusicStyleObject,iface);
279 TRACE("(%p, %p)\n", This, pDesc);
285 HRESULT WINAPI IDirectMusicStyleObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc)
287 ICOM_THIS(IDirectMusicStyleObject,iface);
289 FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc);
294 ICOM_VTABLE(IDirectMusicObject) DirectMusicStyleObject_Vtbl =
296 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
297 IDirectMusicStyleObject_QueryInterface,
298 IDirectMusicStyleObject_AddRef,
299 IDirectMusicStyleObject_Release,
300 IDirectMusicStyleObject_GetDescriptor,
301 IDirectMusicStyleObject_SetDescriptor,
302 IDirectMusicStyleObject_ParseDescriptor
305 /* for ClassFactory */
306 HRESULT WINAPI DMUSIC_CreateDirectMusicStyleObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter)
308 IDirectMusicStyleObject *obj;
310 TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter);
311 if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) {
312 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleObject));
314 *ppObject = (LPDIRECTMUSICOBJECT) NULL;
315 return E_OUTOFMEMORY;
317 obj->lpVtbl = &DirectMusicStyleObject_Vtbl;
319 /* prepare IPersistStream */
320 obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleObjectStream));
321 obj->pStream->lpVtbl = &DirectMusicStyleObjectStream_Vtbl;
322 obj->pStream->ref = 1;
323 obj->pStream->pParentObject = obj;
324 /* prepare IDirectMusicStyle */
325 DMUSIC_CreateDirectMusicStyle (&IID_IDirectMusicStyle8, (LPDIRECTMUSICSTYLE8*)&obj->pStyle, NULL);
326 obj->pStyle->pObject = obj;
327 *ppObject = (LPDIRECTMUSICOBJECT) obj;
330 WARN("No interface found\n");
332 return E_NOINTERFACE;
335 /*****************************************************************************
336 * IDirectMusicStyleObjectStream implementation
338 /* IDirectMusicStyleObjectStream IUnknown part: */
339 HRESULT WINAPI IDirectMusicStyleObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj)
341 ICOM_THIS(IDirectMusicStyleObjectStream,iface);
343 if (IsEqualIID (riid, &IID_IUnknown)
344 || IsEqualIID (riid, &IID_IPersistStream)) {
345 IDirectMusicStyleObjectStream_AddRef(iface);
350 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
351 return E_NOINTERFACE;
354 ULONG WINAPI IDirectMusicStyleObjectStream_AddRef (LPPERSISTSTREAM iface)
356 ICOM_THIS(IDirectMusicStyleObjectStream,iface);
357 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
358 return ++(This->ref);
361 ULONG WINAPI IDirectMusicStyleObjectStream_Release (LPPERSISTSTREAM iface)
363 ICOM_THIS(IDirectMusicStyleObjectStream,iface);
364 ULONG ref = --This->ref;
365 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
367 HeapFree(GetProcessHeap(), 0, This);
372 /* IDirectMusicStyleObjectStream IPersist part: */
373 HRESULT WINAPI IDirectMusicStyleObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID)
378 /* IDirectMusicStyleObjectStream IPersistStream part: */
379 HRESULT WINAPI IDirectMusicStyleObjectStream_IsDirty (LPPERSISTSTREAM iface)
384 HRESULT WINAPI IDirectMusicStyleObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm)
386 FIXME(": Loading not implemented yet\n");
390 HRESULT WINAPI IDirectMusicStyleObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty)
395 HRESULT WINAPI IDirectMusicStyleObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize)
400 ICOM_VTABLE(IPersistStream) DirectMusicStyleObjectStream_Vtbl =
402 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
403 IDirectMusicStyleObjectStream_QueryInterface,
404 IDirectMusicStyleObjectStream_AddRef,
405 IDirectMusicStyleObjectStream_Release,
406 IDirectMusicStyleObjectStream_GetClassID,
407 IDirectMusicStyleObjectStream_IsDirty,
408 IDirectMusicStyleObjectStream_Load,
409 IDirectMusicStyleObjectStream_Save,
410 IDirectMusicStyleObjectStream_GetSizeMax