Limit usage of vertex arrays to correct states.
[wine/multimedia.git] / dlls / dmstyle / style.c
blob7b64912c70103e514caef4fd3f87e13fc9ad471e
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.
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 "dmstyle_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
32 /* IDirectMusicStyle8 IUnknown part: */
33 HRESULT WINAPI IDirectMusicStyle8Impl_QueryInterface (LPDIRECTMUSICSTYLE8 iface, REFIID riid, LPVOID *ppobj)
35 ICOM_THIS(IDirectMusicStyle8Impl,iface);
37 if (IsEqualIID (riid, &IID_IUnknown) ||
38 IsEqualIID (riid, &IID_IDirectMusicStyle) ||
39 IsEqualIID (riid, &IID_IDirectMusicStyle8)) {
40 IDirectMusicStyle8Impl_AddRef(iface);
41 *ppobj = This;
42 return S_OK;
45 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
46 return E_NOINTERFACE;
49 ULONG WINAPI IDirectMusicStyle8Impl_AddRef (LPDIRECTMUSICSTYLE8 iface)
51 ICOM_THIS(IDirectMusicStyle8Impl,iface);
52 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
53 return ++(This->ref);
56 ULONG WINAPI IDirectMusicStyle8Impl_Release (LPDIRECTMUSICSTYLE8 iface)
58 ICOM_THIS(IDirectMusicStyle8Impl,iface);
59 ULONG ref = --This->ref;
60 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
61 if (ref == 0) {
62 HeapFree(GetProcessHeap(), 0, This);
64 return ref;
67 /* IDirectMusicStyle8 IDirectMusicStyle part: */
68 HRESULT WINAPI IDirectMusicStyle8Impl_GetBand (LPDIRECTMUSICSTYLE8 iface, WCHAR* pwszName, IDirectMusicBand** ppBand)
70 ICOM_THIS(IDirectMusicStyle8Impl,iface);
72 FIXME("(%p, %p, %p): stub\n", This, pwszName, ppBand);
74 return S_OK;
77 HRESULT WINAPI IDirectMusicStyle8Impl_EnumBand (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, WCHAR* pwszName)
79 ICOM_THIS(IDirectMusicStyle8Impl,iface);
81 FIXME("(%p, %ld, %p): stub\n", This, dwIndex, pwszName);
83 return S_OK;
86 HRESULT WINAPI IDirectMusicStyle8Impl_GetDefaultBand (LPDIRECTMUSICSTYLE8 iface, IDirectMusicBand** ppBand)
88 ICOM_THIS(IDirectMusicStyle8Impl,iface);
90 FIXME("(%p, %p): stub\n", This, ppBand);
92 return S_OK;
95 HRESULT WINAPI IDirectMusicStyle8Impl_EnumMotif (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, WCHAR* pwszName)
97 ICOM_THIS(IDirectMusicStyle8Impl,iface);
99 FIXME("(%p, %ld, %p): stub\n", This, dwIndex, pwszName);
101 return S_OK;
104 HRESULT WINAPI IDirectMusicStyle8Impl_GetMotif (LPDIRECTMUSICSTYLE8 iface, WCHAR* pwszName, IDirectMusicSegment** ppSegment)
106 ICOM_THIS(IDirectMusicStyle8Impl,iface);
108 FIXME("(%p, %p, %p): stub\n", This, pwszName, ppSegment);
110 return S_OK;
113 HRESULT WINAPI IDirectMusicStyle8Impl_GetDefaultChordMap (LPDIRECTMUSICSTYLE8 iface, IDirectMusicChordMap** ppChordMap)
115 ICOM_THIS(IDirectMusicStyle8Impl,iface);
117 FIXME("(%p, %p): stub\n", This, ppChordMap);
119 return S_OK;
122 HRESULT WINAPI IDirectMusicStyle8Impl_EnumChordMap (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, WCHAR* pwszName)
124 ICOM_THIS(IDirectMusicStyle8Impl,iface);
126 FIXME("(%p, %ld, %p): stub\n", This, dwIndex, pwszName);
128 return S_OK;
131 HRESULT WINAPI IDirectMusicStyle8Impl_GetChordMap (LPDIRECTMUSICSTYLE8 iface, WCHAR* pwszName, IDirectMusicChordMap** ppChordMap)
133 ICOM_THIS(IDirectMusicStyle8Impl,iface);
135 FIXME("(%p, %p, %p): stub\n", This, pwszName, ppChordMap);
137 return S_OK;
140 HRESULT WINAPI IDirectMusicStyle8Impl_GetTimeSignature (LPDIRECTMUSICSTYLE8 iface, DMUS_TIMESIGNATURE* pTimeSig)
142 ICOM_THIS(IDirectMusicStyle8Impl,iface);
144 FIXME("(%p, %p): stub\n", This, pTimeSig);
146 return S_OK;
149 HRESULT WINAPI IDirectMusicStyle8Impl_GetEmbellishmentLength (LPDIRECTMUSICSTYLE8 iface, DWORD dwType, DWORD dwLevel, DWORD* pdwMin, DWORD* pdwMax)
151 ICOM_THIS(IDirectMusicStyle8Impl,iface);
153 FIXME("(%p, %ld, %ld, %p, %p): stub\n", This, dwType, dwLevel, pdwMin, pdwMax);
155 return S_OK;
158 HRESULT WINAPI IDirectMusicStyle8Impl_GetTempo (LPDIRECTMUSICSTYLE8 iface, double* pTempo)
160 ICOM_THIS(IDirectMusicStyle8Impl,iface);
162 FIXME("(%p, %p): stub\n", This, pTempo);
164 return S_OK;
167 /* IDirectMusicStyle8 IDirectMusicStyle8 part: */
168 HRESULT WINAPI IDirectMusicStyle8ImplEnumPattern (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, DWORD dwPatternType, WCHAR* pwszName)
170 ICOM_THIS(IDirectMusicStyle8Impl,iface);
172 FIXME("(%p, %ld, %ld, %p): stub\n", This, dwIndex, dwPatternType, pwszName);
174 return S_OK;
177 ICOM_VTABLE(IDirectMusicStyle8) DirectMusicStyle8_Vtbl =
179 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
180 IDirectMusicStyle8Impl_QueryInterface,
181 IDirectMusicStyle8Impl_AddRef,
182 IDirectMusicStyle8Impl_Release,
183 IDirectMusicStyle8Impl_GetBand,
184 IDirectMusicStyle8Impl_EnumBand,
185 IDirectMusicStyle8Impl_GetDefaultBand,
186 IDirectMusicStyle8Impl_EnumMotif,
187 IDirectMusicStyle8Impl_GetMotif,
188 IDirectMusicStyle8Impl_GetDefaultChordMap,
189 IDirectMusicStyle8Impl_EnumChordMap,
190 IDirectMusicStyle8Impl_GetChordMap,
191 IDirectMusicStyle8Impl_GetTimeSignature,
192 IDirectMusicStyle8Impl_GetEmbellishmentLength,
193 IDirectMusicStyle8Impl_GetTempo,
194 IDirectMusicStyle8ImplEnumPattern
197 /* for ClassFactory */
198 HRESULT WINAPI DMUSIC_CreateDirectMusicStyle (LPCGUID lpcGUID, LPDIRECTMUSICSTYLE8* ppDMStyle, LPUNKNOWN pUnkOuter)
200 IDirectMusicStyle8Impl* dmstlye;
202 if (IsEqualIID (lpcGUID, &IID_IDirectMusicStyle)
203 || IsEqualIID (lpcGUID, &IID_IDirectMusicStyle8)) {
204 dmstlye = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyle8Impl));
205 if (NULL == dmstlye) {
206 *ppDMStyle = (LPDIRECTMUSICSTYLE8) NULL;
207 return E_OUTOFMEMORY;
209 dmstlye->lpVtbl = &DirectMusicStyle8_Vtbl;
210 dmstlye->ref = 1;
211 *ppDMStyle = (LPDIRECTMUSICSTYLE8) dmstlye;
212 return S_OK;
215 WARN("No interface found\n");
216 return E_NOINTERFACE;
220 /*****************************************************************************
221 * IDirectMusicStyleObject implementation
223 /* IDirectMusicStyleObject IUnknown part: */
224 HRESULT WINAPI IDirectMusicStyleObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj)
226 ICOM_THIS(IDirectMusicStyleObject,iface);
228 if (IsEqualIID (riid, &IID_IUnknown)
229 || IsEqualIID (riid, &IID_IDirectMusicObject)) {
230 IDirectMusicStyleObject_AddRef(iface);
231 *ppobj = This;
232 return S_OK;
233 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
234 IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream);
235 *ppobj = (LPPERSISTSTREAM)This->pStream;
236 return S_OK;
237 } else if (IsEqualIID (riid, &IID_IDirectMusicStyle)
238 || IsEqualIID (riid, &IID_IDirectMusicStyle8)) {
239 IDirectMusicStyle8_AddRef ((LPDIRECTMUSICSTYLE8)This->pStyle);
240 *ppobj = (LPDIRECTMUSICSTYLE8)This->pStyle;
241 return S_OK;
244 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
245 return E_NOINTERFACE;
248 ULONG WINAPI IDirectMusicStyleObject_AddRef (LPDIRECTMUSICOBJECT iface)
250 ICOM_THIS(IDirectMusicStyleObject,iface);
251 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
252 return ++(This->ref);
255 ULONG WINAPI IDirectMusicStyleObject_Release (LPDIRECTMUSICOBJECT iface)
257 ICOM_THIS(IDirectMusicStyleObject,iface);
258 ULONG ref = --This->ref;
259 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
260 if (ref == 0) {
261 HeapFree(GetProcessHeap(), 0, This);
263 return ref;
266 /* IDirectMusicStyleObject IDirectMusicObject part: */
267 HRESULT WINAPI IDirectMusicStyleObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
269 ICOM_THIS(IDirectMusicStyleObject,iface);
271 TRACE("(%p, %p)\n", This, pDesc);
272 pDesc = This->pDesc;
274 return S_OK;
277 HRESULT WINAPI IDirectMusicStyleObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
279 ICOM_THIS(IDirectMusicStyleObject,iface);
281 TRACE("(%p, %p)\n", This, pDesc);
282 This->pDesc = pDesc;
284 return S_OK;
287 HRESULT WINAPI IDirectMusicStyleObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc)
289 ICOM_THIS(IDirectMusicStyleObject,iface);
291 FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc);
293 return S_OK;
296 ICOM_VTABLE(IDirectMusicObject) DirectMusicStyleObject_Vtbl =
298 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
299 IDirectMusicStyleObject_QueryInterface,
300 IDirectMusicStyleObject_AddRef,
301 IDirectMusicStyleObject_Release,
302 IDirectMusicStyleObject_GetDescriptor,
303 IDirectMusicStyleObject_SetDescriptor,
304 IDirectMusicStyleObject_ParseDescriptor
307 /* for ClassFactory */
308 HRESULT WINAPI DMUSIC_CreateDirectMusicStyleObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter)
310 IDirectMusicStyleObject *obj;
312 TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter);
313 if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) {
314 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleObject));
315 if (NULL == obj) {
316 *ppObject = (LPDIRECTMUSICOBJECT) NULL;
317 return E_OUTOFMEMORY;
319 obj->lpVtbl = &DirectMusicStyleObject_Vtbl;
320 obj->ref = 1;
321 /* prepare IPersistStream */
322 obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleObjectStream));
323 obj->pStream->lpVtbl = &DirectMusicStyleObjectStream_Vtbl;
324 obj->pStream->ref = 1;
325 obj->pStream->pParentObject = obj;
326 /* prepare IDirectMusicStyle */
327 DMUSIC_CreateDirectMusicStyle (&IID_IDirectMusicStyle8, (LPDIRECTMUSICSTYLE8*)&obj->pStyle, NULL);
328 obj->pStyle->pObject = obj;
329 *ppObject = (LPDIRECTMUSICOBJECT) obj;
330 return S_OK;
332 WARN("No interface found\n");
334 return E_NOINTERFACE;
337 /*****************************************************************************
338 * IDirectMusicStyleObjectStream implementation
340 /* IDirectMusicStyleObjectStream IUnknown part: */
341 HRESULT WINAPI IDirectMusicStyleObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj)
343 ICOM_THIS(IDirectMusicStyleObjectStream,iface);
345 if (IsEqualIID (riid, &IID_IUnknown)
346 || IsEqualIID (riid, &IID_IPersistStream)) {
347 IDirectMusicStyleObjectStream_AddRef(iface);
348 *ppobj = This;
349 return S_OK;
352 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
353 return E_NOINTERFACE;
356 ULONG WINAPI IDirectMusicStyleObjectStream_AddRef (LPPERSISTSTREAM iface)
358 ICOM_THIS(IDirectMusicStyleObjectStream,iface);
359 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
360 return ++(This->ref);
363 ULONG WINAPI IDirectMusicStyleObjectStream_Release (LPPERSISTSTREAM iface)
365 ICOM_THIS(IDirectMusicStyleObjectStream,iface);
366 ULONG ref = --This->ref;
367 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
368 if (ref == 0) {
369 HeapFree(GetProcessHeap(), 0, This);
371 return ref;
374 /* IDirectMusicStyleObjectStream IPersist part: */
375 HRESULT WINAPI IDirectMusicStyleObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID)
377 return E_NOTIMPL;
380 /* IDirectMusicStyleObjectStream IPersistStream part: */
381 HRESULT WINAPI IDirectMusicStyleObjectStream_IsDirty (LPPERSISTSTREAM iface)
383 return E_NOTIMPL;
386 HRESULT WINAPI IDirectMusicStyleObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm)
388 FIXME(": Loading not implemented yet\n");
389 return S_OK;
392 HRESULT WINAPI IDirectMusicStyleObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty)
394 return E_NOTIMPL;
397 HRESULT WINAPI IDirectMusicStyleObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize)
399 return E_NOTIMPL;
402 ICOM_VTABLE(IPersistStream) DirectMusicStyleObjectStream_Vtbl =
404 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
405 IDirectMusicStyleObjectStream_QueryInterface,
406 IDirectMusicStyleObjectStream_AddRef,
407 IDirectMusicStyleObjectStream_Release,
408 IDirectMusicStyleObjectStream_GetClassID,
409 IDirectMusicStyleObjectStream_IsDirty,
410 IDirectMusicStyleObjectStream_Load,
411 IDirectMusicStyleObjectStream_Save,
412 IDirectMusicStyleObjectStream_GetSizeMax