ReactOS  0.4.14-dev-384-g5b37caa
collection.c
Go to the documentation of this file.
1 /*
2  * IDirectMusicCollection Implementation
3  *
4  * Copyright (C) 2003-2004 Rok Mandeljc
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include "dmusic_private.h"
22 #include "dmobject.h"
23 
26 
27 /*****************************************************************************
28  * IDirectMusicCollectionImpl implementation
29  */
31  IDirectMusicCollection IDirectMusicCollection_iface;
32  struct dmobject dmobj;
34  /* IDirectMusicCollectionImpl fields */
35  IStream *pStm; /* stream from which we load collection and later instruments */
36  LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
37  LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
38  CHAR *szCopyright; /* FIXME: should probably be placed somewhere else */
40  /* pool table */
43  /* instruments */
44  struct list Instruments;
46 
47 static inline IDirectMusicCollectionImpl *impl_from_IDirectMusicCollection(IDirectMusicCollection *iface)
48 {
49  return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IDirectMusicCollection_iface);
50 }
51 
52 static inline struct dmobject *impl_from_IDirectMusicObject(IDirectMusicObject *iface)
53 {
55 }
56 
58 {
59  return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, dmobj.IPersistStream_iface);
60 }
61 
62 /* IDirectMusicCollectionImpl IUnknown part: */
63 static HRESULT WINAPI IDirectMusicCollectionImpl_QueryInterface(IDirectMusicCollection *iface,
64  REFIID riid, void **ret_iface)
65 {
67 
68  TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_dmguid(riid), ret_iface);
69 
70  *ret_iface = NULL;
71 
72  if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicCollection))
73  *ret_iface = iface;
74  else if (IsEqualIID(riid, &IID_IDirectMusicObject))
75  *ret_iface = &This->dmobj.IDirectMusicObject_iface;
77  *ret_iface = &This->dmobj.IPersistStream_iface;
78  else
79  {
80  WARN("(%p/%p)->(%s, %p): not found\n", iface, This, debugstr_dmguid(riid), ret_iface);
81  return E_NOINTERFACE;
82  }
83 
84  IUnknown_AddRef((IUnknown*)*ret_iface);
85  return S_OK;
86 }
87 
88 static ULONG WINAPI IDirectMusicCollectionImpl_AddRef(IDirectMusicCollection *iface)
89 {
92 
93  TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
94 
95  return ref;
96 }
97 
98 static ULONG WINAPI IDirectMusicCollectionImpl_Release(IDirectMusicCollection *iface)
99 {
102 
103  TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
104 
105  if (!ref) {
108  }
109 
110  return ref;
111 }
112 
113 /* IDirectMusicCollection Interface follows: */
114 static HRESULT WINAPI IDirectMusicCollectionImpl_GetInstrument(IDirectMusicCollection *iface,
115  DWORD patch, IDirectMusicInstrument **instrument)
116 {
118  DMUS_PRIVATE_INSTRUMENTENTRY *inst_entry;
119  struct list *list_entry;
120  DWORD inst_patch;
121 
122  TRACE("(%p/%p)->(%u, %p)\n", iface, This, patch, instrument);
123 
124  LIST_FOR_EACH(list_entry, &This->Instruments) {
126  IDirectMusicInstrument_GetPatch(inst_entry->pInstrument, &inst_patch);
127  if (patch == inst_patch) {
128  *instrument = inst_entry->pInstrument;
131  TRACE(": returning instrument %p\n", *instrument);
132  return S_OK;
133  }
134  }
135 
136  TRACE(": instrument not found\n");
137 
138  return DMUS_E_INVALIDPATCH;
139 }
140 
141 static HRESULT WINAPI IDirectMusicCollectionImpl_EnumInstrument(IDirectMusicCollection *iface,
142  DWORD index, DWORD *patch, LPWSTR name, DWORD name_length)
143 {
145  DWORD i = 0;
146  DMUS_PRIVATE_INSTRUMENTENTRY *inst_entry;
147  struct list *list_entry;
148  DWORD length;
149 
150  TRACE("(%p/%p)->(%d, %p, %p, %d)\n", iface, This, index, patch, name, name_length);
151 
152  LIST_FOR_EACH(list_entry, &This->Instruments) {
154  if (i == index) {
156  IDirectMusicInstrument_GetPatch(inst_entry->pInstrument, patch);
157  if (name) {
158  length = min(lstrlenW(instrument->wszName), name_length - 1);
159  memcpy(name, instrument->wszName, length * sizeof(WCHAR));
160  name[length] = '\0';
161  }
162  return S_OK;
163  }
164  i++;
165  }
166 
167  return S_FALSE;
168 }
169 
170 static const IDirectMusicCollectionVtbl DirectMusicCollection_Collection_Vtbl = {
176 };
177 
178 /* IDirectMusicCollectionImpl IDirectMusicObject part: */
179 static HRESULT WINAPI col_IDirectMusicObject_ParseDescriptor(IDirectMusicObject *iface,
181 {
182  struct chunk_entry riff = {0};
183  HRESULT hr;
184 
185  TRACE("(%p, %p, %p)\n", iface, stream, desc);
186 
187  if (!stream || !desc)
188  return E_POINTER;
189 
190  if ((hr = stream_get_chunk(stream, &riff)) != S_OK)
191  return hr;
192  if (riff.id != FOURCC_RIFF || riff.type != FOURCC_DLS) {
193  TRACE("loading failed: unexpected %s\n", debugstr_chunk(&riff));
194  stream_skip_chunk(stream, &riff);
195  return DMUS_E_NOTADLSCOL;
196  }
197 
199  if (FAILED(hr))
200  return hr;
201 
202  desc->guidClass = CLSID_DirectMusicCollection;
203  desc->dwValidData |= DMUS_OBJ_CLASS;
204 
205  TRACE("returning descriptor:\n");
207  return S_OK;
208 }
209 
210 static const IDirectMusicObjectVtbl dmobject_vtbl = {
217 };
218 
219 /* IDirectMusicCollectionImpl IPersistStream part: */
221  IStream *stream)
222 {
225  DWORD StreamSize, StreamCount, ListSize[2], ListCount[2];
226  LARGE_INTEGER liMove; /* used when skipping chunks */
227  ULARGE_INTEGER dlibCollectionPosition, dlibInstrumentPosition, dlibWavePoolPosition;
228 
229  IStream_AddRef(stream); /* add count for later references */
230  liMove.QuadPart = 0;
231  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, &dlibCollectionPosition); /* store offset, in case it'll be needed later */
232  This->liCollectionPosition.QuadPart = dlibCollectionPosition.QuadPart;
233  This->pStm = stream;
234 
235  IStream_Read(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD), NULL);
236  TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc(chunk.fccID), chunk.dwSize);
237 
238  if (chunk.fccID != FOURCC_RIFF) {
239  TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
240  liMove.QuadPart = chunk.dwSize;
241  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
242  return E_FAIL;
243  }
244 
245  IStream_Read(stream, &chunk.fccID, sizeof(FOURCC), NULL);
246  TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(chunk.fccID));
247  StreamSize = chunk.dwSize - sizeof(FOURCC);
248  StreamCount = 0;
249 
250  if (chunk.fccID != FOURCC_DLS) {
251  TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
252  liMove.QuadPart = StreamSize;
253  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
254  return E_FAIL;
255  }
256 
257  TRACE_(dmfile)(": collection form\n");
258  do {
259  IStream_Read(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD), NULL);
260  StreamCount += sizeof(FOURCC) + sizeof(DWORD) + chunk.dwSize;
261  TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc(chunk.fccID), chunk.dwSize);
262  switch (chunk.fccID) {
263  case FOURCC_COLH: {
264  TRACE_(dmfile)(": collection header chunk\n");
265  This->pHeader = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, chunk.dwSize);
266  IStream_Read(stream, This->pHeader, chunk.dwSize, NULL);
267  break;
268  }
269  case FOURCC_DLID: {
270  TRACE_(dmfile)(": DLID (GUID) chunk\n");
271  This->dmobj.desc.dwValidData |= DMUS_OBJ_OBJECT;
272  IStream_Read(stream, &This->dmobj.desc.guidObject, chunk.dwSize, NULL);
273  break;
274  }
275  case FOURCC_VERS: {
276  TRACE_(dmfile)(": version chunk\n");
277  This->dmobj.desc.dwValidData |= DMUS_OBJ_VERSION;
278  IStream_Read(stream, &This->dmobj.desc.vVersion, chunk.dwSize, NULL);
279  break;
280  }
281  case FOURCC_PTBL: {
282  TRACE_(dmfile)(": pool table chunk\n");
283  This->pPoolTable = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POOLTABLE));
284  IStream_Read(stream, This->pPoolTable, sizeof(POOLTABLE), NULL);
285  chunk.dwSize -= sizeof(POOLTABLE);
286  This->pPoolCues = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pPoolTable->cCues * sizeof(POOLCUE));
287  IStream_Read(stream, This->pPoolCues, chunk.dwSize, NULL);
288  break;
289  }
290  case FOURCC_LIST: {
291  IStream_Read(stream, &chunk.fccID, sizeof(FOURCC), NULL);
292  TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunk.fccID));
293  ListSize[0] = chunk.dwSize - sizeof(FOURCC);
294  ListCount[0] = 0;
295  switch (chunk.fccID) {
296  case DMUS_FOURCC_INFO_LIST: {
297  TRACE_(dmfile)(": INFO list\n");
298  do {
299  IStream_Read(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD), NULL);
300  ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunk.dwSize;
301  TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc(chunk.fccID), chunk.dwSize);
302  switch (chunk.fccID) {
303  case mmioFOURCC('I','N','A','M'): {
305  TRACE_(dmfile)(": name chunk\n");
306  This->dmobj.desc.dwValidData |= DMUS_OBJ_NAME;
307  IStream_Read(stream, szName, chunk.dwSize, NULL);
308  MultiByteToWideChar(CP_ACP, 0, szName, -1, This->dmobj.desc.wszName, DMUS_MAX_NAME);
309  if (even_or_odd(chunk.dwSize)) {
310  ListCount[0]++;
311  liMove.QuadPart = 1;
312  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
313  }
314  break;
315  }
316  case mmioFOURCC('I','A','R','T'): {
317  TRACE_(dmfile)(": artist chunk (ignored)\n");
318  if (even_or_odd(chunk.dwSize)) {
319  ListCount[0]++;
320  chunk.dwSize++;
321  }
322  liMove.QuadPart = chunk.dwSize;
323  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
324  break;
325  }
326  case mmioFOURCC('I','C','O','P'): {
327  TRACE_(dmfile)(": copyright chunk\n");
328  This->szCopyright = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, chunk.dwSize);
329  IStream_Read(stream, This->szCopyright, chunk.dwSize, NULL);
330  if (even_or_odd(chunk.dwSize)) {
331  ListCount[0]++;
332  liMove.QuadPart = 1;
333  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
334  }
335  break;
336  }
337  case mmioFOURCC('I','S','B','J'): {
338  TRACE_(dmfile)(": subject chunk (ignored)\n");
339  if (even_or_odd(chunk.dwSize)) {
340  ListCount[0]++;
341  chunk.dwSize++;
342  }
343  liMove.QuadPart = chunk.dwSize;
344  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
345  break;
346  }
347  case mmioFOURCC('I','C','M','T'): {
348  TRACE_(dmfile)(": comment chunk (ignored)\n");
349  if (even_or_odd(chunk.dwSize)) {
350  ListCount[0]++;
351  chunk.dwSize++;
352  }
353  liMove.QuadPart = chunk.dwSize;
354  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
355  break;
356  }
357  default: {
358  TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
359  if (even_or_odd(chunk.dwSize)) {
360  ListCount[0]++;
361  chunk.dwSize++;
362  }
363  liMove.QuadPart = chunk.dwSize;
364  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
365  break;
366  }
367  }
368  TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
369  } while (ListCount[0] < ListSize[0]);
370  break;
371  }
372  case FOURCC_WVPL: {
373  TRACE_(dmfile)(": wave pool list (mark & skip)\n");
374  liMove.QuadPart = 0;
375  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, &dlibWavePoolPosition); /* store position */
376  This->liWavePoolTablePosition.QuadPart = dlibWavePoolPosition.QuadPart;
377  liMove.QuadPart = chunk.dwSize - sizeof(FOURCC);
378  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
379  break;
380  }
381  case FOURCC_LINS: {
382  TRACE_(dmfile)(": instruments list\n");
383  do {
384  IStream_Read(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD), NULL);
385  ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunk.dwSize;
386  TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc(chunk.fccID), chunk.dwSize);
387  switch (chunk.fccID) {
388  case FOURCC_LIST: {
389  IStream_Read(stream, &chunk.fccID, sizeof(FOURCC), NULL);
390  TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunk.fccID));
391  ListSize[1] = chunk.dwSize - sizeof(FOURCC);
392  ListCount[1] = 0;
393  switch (chunk.fccID) {
394  case FOURCC_INS: {
396  TRACE_(dmfile)(": instrument list\n");
397  /* Only way to create this one... even M$ does it discretely */
398  DMUSIC_CreateDirectMusicInstrumentImpl(&IID_IDirectMusicInstrument, (void**)&new_instrument->pInstrument, NULL);
399  {
401  /* Store offset and length, they will be needed when loading the instrument */
402  liMove.QuadPart = 0;
403  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, &dlibInstrumentPosition);
404  instrument->liInstrumentPosition.QuadPart = dlibInstrumentPosition.QuadPart;
405  instrument->length = ListSize[1];
406  do {
407  IStream_Read(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD), NULL);
408  ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + chunk.dwSize;
409  TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc(chunk.fccID), chunk.dwSize);
410  switch (chunk.fccID) {
411  case FOURCC_INSH: {
412  TRACE_(dmfile)(": instrument header chunk\n");
413  IStream_Read(stream, &instrument->header, chunk.dwSize, NULL);
414  break;
415  }
416  case FOURCC_DLID: {
417  TRACE_(dmfile)(": DLID (GUID) chunk\n");
418  IStream_Read(stream, &instrument->id, chunk.dwSize, NULL);
419  break;
420  }
421  case FOURCC_LIST: {
422  IStream_Read(stream, &chunk.fccID, sizeof(FOURCC), NULL);
423  TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunk.fccID));
424  switch (chunk.fccID) {
425  default: {
426  TRACE_(dmfile)(": unknown (skipping)\n");
427  liMove.QuadPart = chunk.dwSize - sizeof(FOURCC);
428  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
429  break;
430  }
431  }
432  break;
433  }
434  default: {
435  TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
436  liMove.QuadPart = chunk.dwSize;
437  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
438  break;
439  }
440  }
441  TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
442  } while (ListCount[1] < ListSize[1]);
443  /* DEBUG: dumps whole instrument object tree: */
444  if (TRACE_ON(dmusic)) {
445  TRACE("*** IDirectMusicInstrument (%p) ***\n", instrument);
446  if (!IsEqualGUID(&instrument->id, &GUID_NULL))
447  TRACE(" - GUID = %s\n", debugstr_dmguid(&instrument->id));
448  TRACE(" - Instrument header:\n");
449  TRACE(" - cRegions: %d\n", instrument->header.cRegions);
450  TRACE(" - Locale:\n");
451  TRACE(" - ulBank: %d\n", instrument->header.Locale.ulBank);
452  TRACE(" - ulInstrument: %d\n", instrument->header.Locale.ulInstrument);
453  TRACE(" => dwPatch: %d\n", MIDILOCALE2Patch(&instrument->header.Locale));
454  }
455  list_add_tail(&This->Instruments, &new_instrument->entry);
456  }
457  break;
458  }
459  }
460  break;
461  }
462  default: {
463  TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
464  liMove.QuadPart = chunk.dwSize;
465  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
466  break;
467  }
468  }
469  TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
470  } while (ListCount[0] < ListSize[0]);
471  break;
472  }
473  default: {
474  TRACE_(dmfile)(": unknown (skipping)\n");
475  liMove.QuadPart = chunk.dwSize - sizeof(FOURCC);
476  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
477  break;
478  }
479  }
480  break;
481  }
482  default: {
483  TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
484  liMove.QuadPart = chunk.dwSize;
485  IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL);
486  break;
487  }
488  }
489  TRACE_(dmfile)(": StreamCount = %d < StreamSize = %d\n", StreamCount, StreamSize);
490  } while (StreamCount < StreamSize);
491 
492  TRACE_(dmfile)(": reading finished\n");
493 
494 
495  /* DEBUG: dumps whole collection object tree: */
496  if (TRACE_ON(dmusic)) {
497  int r = 0;
499  struct list *listEntry;
500 
501  TRACE("*** IDirectMusicCollection (%p) ***\n", &This->IDirectMusicCollection_iface);
502  dump_DMUS_OBJECTDESC(&This->dmobj.desc);
503 
504  TRACE(" - Collection header:\n");
505  TRACE(" - cInstruments: %d\n", This->pHeader->cInstruments);
506  TRACE(" - Instruments:\n");
507 
508  LIST_FOR_EACH(listEntry, &This->Instruments) {
509  tmpEntry = LIST_ENTRY( listEntry, DMUS_PRIVATE_INSTRUMENTENTRY, entry );
510  TRACE(" - Instrument[%i]: %p\n", r, tmpEntry->pInstrument);
511  r++;
512  }
513  }
514 
515  return S_OK;
516 }
517 
518 static const IPersistStreamVtbl persiststream_vtbl = {
527 };
528 
529 
531 {
533  HRESULT hr;
534 
535  *ppobj = NULL;
536  if (pUnkOuter)
537  return CLASS_E_NOAGGREGATION;
538 
540  if (!obj)
541  return E_OUTOFMEMORY;
542 
543  obj->IDirectMusicCollection_iface.lpVtbl = &DirectMusicCollection_Collection_Vtbl;
544  obj->ref = 1;
545  dmobject_init(&obj->dmobj, &CLSID_DirectMusicCollection,
546  (IUnknown*)&obj->IDirectMusicCollection_iface);
547  obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
548  obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
549 
550  list_init (&obj->Instruments);
551 
553  hr = IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj);
554  IDirectMusicCollection_Release(&obj->IDirectMusicCollection_iface);
555 
556  return hr;
557 }
Definition: dls1.h:106
HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface)
Definition: dmobject.c:387
LARGE_INTEGER liInstrumentPosition
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
Definition: dmobject.c:215
DWORD MIDILOCALE2Patch(const MIDILOCALE *pLocale)
Definition: dmusic_main.c:195
#define IDirectMusicInstrument_GetPatch(p, a)
Definition: dmusicc.h:528
static IDirectMusicInstrumentImpl * impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
HRESULT dmobj_parsedescriptor(IStream *stream, const struct chunk_entry *riff, DMUS_OBJECTDESC *desc, DWORD supported)
Definition: dmobject.c:296
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid, void **ret_iface)
Definition: dmobject.c:347
void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc)
Definition: dmusic_main.c:459
const char * debugstr_dmguid(const GUID *id)
Definition: dmusic_main.c:237
REFIID riid
Definition: precomp.h:44
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
Definition: collection.c:220
#define DMUS_OBJ_NAME
Definition: dmusici.h:267
#define FOURCC_LINS
Definition: dls1.h:40
static HRESULT WINAPI IDirectMusicCollectionImpl_GetInstrument(IDirectMusicCollection *iface, DWORD patch, IDirectMusicInstrument **instrument)
Definition: collection.c:114
WINE_DECLARE_DEBUG_CHANNEL(dmfile)
static HRESULT WINAPI IDirectMusicCollectionImpl_EnumInstrument(IDirectMusicCollection *iface, DWORD index, DWORD *patch, LPWSTR name, DWORD name_length)
Definition: collection.c:141
#define DMUS_E_INVALIDPATCH
Definition: dmerror.h:64
#define FOURCC_DLS
Definition: dls1.h:33
#define FOURCC_VERS
Definition: dls1.h:50
static const IDirectMusicCollectionVtbl DirectMusicCollection_Collection_Vtbl
Definition: collection.c:170
#define FOURCC_COLH
Definition: dls1.h:35
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
Definition: send.c:47
static ULONG WINAPI IDirectMusicCollectionImpl_AddRef(IDirectMusicCollection *iface)
Definition: collection.c:88
#define list_entry(ptr, type, member)
Definition: list.h:185
HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream, BOOL clear_dirty)
Definition: dmobject.c:393
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
static void DMUSIC_UnlockModule(void)
FOURCC id
Definition: dmobject.h:29
FOURCC type
Definition: dmobject.h:31
#define DMUS_E_NOTADLSCOL
Definition: dmerror.h:60
static IDirectMusicCollectionImpl * impl_from_IPersistStream(IPersistStream *iface)
Definition: collection.c:57
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDirectMusicCollection_QueryInterface(p, a, b)
Definition: dmusicc.h:575
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
long LONG
Definition: pedump.c:60
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface)
Definition: dmobject.c:194
IDirectMusicCollection IDirectMusicCollection_iface
Definition: collection.c:31
static LPUNKNOWN
Definition: ndr_ole.c:49
static const WCHAR desc[]
Definition: protectdata.c:36
static HRESULT WINAPI col_IDirectMusicObject_ParseDescriptor(IDirectMusicObject *iface, IStream *stream, DMUS_OBJECTDESC *desc)
Definition: collection.c:179
GLenum GLint ref
Definition: glext.h:6028
#define FOURCC_DLID
Definition: dls1.h:34
#define S_FALSE
Definition: winerror.h:2357
static const char * debugstr_fourcc(DWORD fourcc)
Definition: parsing.c:85
IDirectMusicInstrument * pInstrument
const char * debugstr_chunk(const struct chunk_entry *chunk)
Definition: dmobject.c:48
WINE_DEFAULT_DEBUG_CHANNEL(dmusic)
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
HRESULT DMUSIC_CreateDirectMusicInstrumentImpl(LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN
Definition: instrument.c:123
ULONG ulInstrument
Definition: dls1.h:97
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface)
Definition: dmobject.c:188
static void DMUSIC_LockModule(void)
#define FOURCC_WVPL
Definition: dls1.h:36
GLuint index
Definition: glext.h:6031
ULONG ulBank
Definition: dls1.h:96
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk)
Definition: dmobject.c:407
#define TRACE_(x)
Definition: compat.h:66
LARGE_INTEGER liWavePoolTablePosition
Definition: collection.c:37
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectMusicCollectionImpl * impl_from_IDirectMusicCollection(IDirectMusicCollection *iface)
Definition: collection.c:47
#define DMUS_OBJ_NAME_INFO
Definition: dmobject.h:94
#define GetProcessHeap()
Definition: compat.h:403
#define FOURCC_LIST
Definition: mmsystem.h:565
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:8
LARGE_INTEGER liCollectionPosition
Definition: collection.c:36
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: dmobject.h:28
#define DMUS_OBJ_OBJECT
Definition: dmusici.h:265
#define IDirectMusicCollection_Release(p)
Definition: dmusicc.h:577
const GUID IID_IPersistStream
Definition: proxy.cpp:13
struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl
MIDILOCALE Locale
Definition: dls1.h:103
struct _POOLTABLE POOLTABLE
#define IDirectMusicInstrument_AddRef(p)
Definition: dmusicc.h:525
#define FOURCC_RIFF
Definition: mmsystem.h:564
#define InterlockedDecrement
Definition: armddk.h:52
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
static ULONG WINAPI IDirectMusicCollectionImpl_Release(IDirectMusicCollection *iface)
Definition: collection.c:98
#define FOURCC_INS
Definition: dls1.h:41
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
IDirectMusicObject IDirectMusicObject_iface
Definition: dmobject.h:70
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GUID_NULL
Definition: ks.h:106
Definition: _list.h:228
int even_or_odd(DWORD number)
Definition: dmusic_main.c:214
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
DWORD FOURCC
Definition: dmdls.h:25
static const IPersistStreamVtbl persiststream_vtbl
Definition: collection.c:518
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
#define FOURCC_PTBL
Definition: dls1.h:37
HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter)
Definition: collection.c:530
#define DMUS_FOURCC_INFO_LIST
Definition: dmusicf.h:43
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface)
Definition: dmobject.c:360
HRESULT stream_skip_chunk(IStream *stream, struct chunk_entry *chunk)
Definition: dmobject.c:121
#define min(a, b)
Definition: monoChain.cc:55
Definition: list.h:27
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define MultiByteToWideChar
Definition: compat.h:100
static struct dmobject * impl_from_IDirectMusicObject(IDirectMusicObject *iface)
Definition: collection.c:52
Definition: name.c:36
HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *size)
Definition: dmobject.c:400
static const WCHAR szName[]
Definition: msipriv.h:1194
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
Definition: dmobject.c:200
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface)
Definition: dmobject.c:354
struct dmobject dmobj
Definition: collection.c:32
unsigned int ULONG
Definition: retypes.h:1
static HRESULT WINAPI IDirectMusicCollectionImpl_QueryInterface(IDirectMusicCollection *iface, REFIID riid, void **ret_iface)
Definition: collection.c:63
#define FOURCC(a, b, c, d)
Definition: memtrack.h:4
#define DMUS_OBJ_VERSION
Definition: dmusici.h:272
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LIST_ENTRY(type)
Definition: queue.h:175
HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream) DECLSPEC_HIDDEN
Definition: instrument.c:291
#define E_POINTER
Definition: winerror.h:2365
HRESULT WINAPI unimpl_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class)
Definition: dmobject.c:381
struct list entry
#define TRACE_ON(x)
Definition: compat.h:65
#define DMUS_OBJ_CLASS
Definition: dmusici.h:266
#define HeapFree(x, y, z)
Definition: compat.h:402
#define DMUS_MAX_NAME
Definition: dmusici.h:245
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
ULONG cRegions
Definition: dls1.h:102
static const IDirectMusicObjectVtbl dmobject_vtbl
Definition: collection.c:210
LONGLONG QuadPart
Definition: typedefs.h:112
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, void **ret_iface)
Definition: dmobject.c:181
WCHAR wszName[DMUS_MAX_NAME]
HRESULT stream_get_chunk(IStream *stream, struct chunk_entry *chunk)
Definition: dmobject.c:76
#define FOURCC_INSH
Definition: dls1.h:42