ReactOS 0.4.17-dev-966-gf06eace
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 "soundfont.h"
23
25
27{
28 struct list entry;
31 IDirectMusicInstrument *instrument;
32};
33
34struct pool
35{
38};
39
40#ifdef __REACTOS__
41C_ASSERT(sizeof(struct pool) == offsetof(struct pool, cues));
42#else
43C_ASSERT(sizeof(struct pool) == offsetof(struct pool, cues[0]));
44#endif
45
47{
48 struct list entry;
49 IDirectMusicObject *wave;
51};
52
54{
55 IDirectMusicCollection IDirectMusicCollection_iface;
59
61 struct pool *pool;
63 struct list waves;
64};
65
67{
69 TRACE( "collection %p, internal ref %lu.\n", collection, ref );
70}
71
73{
75 TRACE( "collection %p, internal ref %lu.\n", collection, ref );
76
77 if (!ref)
79}
80
82{
83 struct wave_entry *wave_entry;
85
86 if (index >= collection->pool->table.cCues) return E_INVALIDARG;
87 offset = collection->pool->cues[index].ulOffset;
88
90 {
91 if (offset == wave_entry->offset)
92 {
94 IUnknown_AddRef(wave_entry->wave);
95 return S_OK;
96 }
97 }
98
99 return E_FAIL;
100}
101
102static inline struct collection *impl_from_IDirectMusicCollection(IDirectMusicCollection *iface)
103{
105}
106
108{
109 return CONTAINING_RECORD(iface, struct collection, dmobj.IPersistStream_iface);
110}
111
112static HRESULT WINAPI collection_QueryInterface(IDirectMusicCollection *iface,
113 REFIID riid, void **ret_iface)
114{
116
117 TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
118
119 *ret_iface = NULL;
120
121 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicCollection))
122 *ret_iface = iface;
123 else if (IsEqualIID(riid, &IID_IDirectMusicObject))
124 *ret_iface = &This->dmobj.IDirectMusicObject_iface;
126 *ret_iface = &This->dmobj.IPersistStream_iface;
127 else
128 {
129 WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
130 return E_NOINTERFACE;
131 }
132
133 IUnknown_AddRef((IUnknown*)*ret_iface);
134 return S_OK;
135}
136
137static ULONG WINAPI collection_AddRef(IDirectMusicCollection *iface)
138{
141
142 TRACE("(%p): new ref = %lu\n", iface, ref);
143
144 return ref;
145}
146
147static ULONG WINAPI collection_Release(IDirectMusicCollection *iface)
148{
151
152 TRACE("(%p): new ref = %lu\n", iface, ref);
153
154 if (!ref)
155 {
157 struct wave_entry *wave_entry;
158 void *next;
159
161 {
165 }
166
168 {
172 }
173
175 }
176
177 return ref;
178}
179
180static HRESULT WINAPI collection_GetInstrument(IDirectMusicCollection *iface,
181 DWORD patch, IDirectMusicInstrument **instrument)
182{
184 struct instrument_entry *entry;
185
186 TRACE("(%p, %lu, %p)\n", iface, patch, instrument);
187
188 LIST_FOR_EACH_ENTRY(entry, &This->instruments, struct instrument_entry, entry)
189 {
190 if (patch == entry->patch)
191 {
192 *instrument = entry->instrument;
194 TRACE(": returning instrument %p\n", entry->instrument);
195 return S_OK;
196 }
197 }
198
199 TRACE(": instrument not found\n");
200 return DMUS_E_INVALIDPATCH;
201}
202
203static HRESULT WINAPI collection_EnumInstrument(IDirectMusicCollection *iface,
204 DWORD index, DWORD *patch, LPWSTR name, DWORD name_length)
205{
207 struct instrument_entry *entry;
208
209 TRACE("(%p, %ld, %p, %p, %ld)\n", iface, index, patch, name, name_length);
210
211 LIST_FOR_EACH_ENTRY(entry, &This->instruments, struct instrument_entry, entry)
212 {
213 if (index--) continue;
214 *patch = entry->patch;
215 if (name) lstrcpynW(name, entry->desc.wszName, name_length);
216 return S_OK;
217 }
218
219 return S_FALSE;
220}
221
222static const IDirectMusicCollectionVtbl collection_vtbl =
223{
229};
230
232{
233 struct chunk_entry chunk = {.parent = parent};
234 struct instrument_entry *entry;
235 HRESULT hr;
236
237 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
238 {
239 switch (MAKE_IDTYPE(chunk.id, chunk.type))
240 {
242 if (!(entry = malloc(sizeof(*entry)))) return E_OUTOFMEMORY;
243 hr = instrument_create_from_chunk(stream, &chunk, This, &entry->desc, &entry->instrument);
244 if (SUCCEEDED(hr)) hr = IDirectMusicInstrument_GetPatch(entry->instrument, &entry->patch);
245 if (SUCCEEDED(hr)) list_add_tail(&This->instruments, &entry->entry);
246 else free(entry);
247 break;
248
249 default:
250 FIXME("Ignoring chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
251 break;
252 }
253
254 if (FAILED(hr)) break;
255 }
256
257 return hr;
258}
259
261{
262 struct chunk_entry chunk = {.parent = parent};
263 struct wave_entry *entry;
264 HRESULT hr;
265
266 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
267 {
268 switch (MAKE_IDTYPE(chunk.id, chunk.type))
269 {
271 if (!(entry = malloc(sizeof(*entry)))) return E_OUTOFMEMORY;
273 else
274 {
275 entry->offset = chunk.offset.QuadPart - parent->offset.QuadPart - 12;
276 list_add_tail(&This->waves, &entry->entry);
277 }
278 break;
279
280 default:
281 FIXME("Skipping unknown chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
282 break;
283 }
284
285 if (FAILED(hr)) break;
286 }
287
288 return hr;
289}
290
292{
293 struct pool *pool;
295 HRESULT hr;
296 UINT size;
297
298 if (chunk->size < sizeof(table)) return E_INVALIDARG;
299 if (FAILED(hr = stream_read(stream, &table, sizeof(table)))) return hr;
300 if (chunk->size != table.cbSize + sizeof(POOLCUE) * table.cCues) return E_INVALIDARG;
301 if (table.cbSize != sizeof(table)) return E_INVALIDARG;
302
303 size = offsetof(struct pool, cues[table.cCues]);
304 if (!(pool = malloc(size))) return E_OUTOFMEMORY;
305 pool->table = table;
306
307 size = sizeof(POOLCUE) * table.cCues;
309 else This->pool = pool;
310
311 return hr;
312}
313
315{
316 struct chunk_entry chunk = {.parent = parent};
317 HRESULT hr;
318
319 if (FAILED(hr = dmobj_parsedescriptor(stream, parent, &This->dmobj.desc,
322 return hr;
323
324 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
325 {
326 switch (MAKE_IDTYPE(chunk.id, chunk.type))
327 {
328 case FOURCC_DLID:
329 case FOURCC_VERS:
331 /* already parsed by dmobj_parsedescriptor */
332 break;
333
334 case FOURCC_COLH:
335 hr = stream_chunk_get_data(stream, &chunk, &This->header, sizeof(This->header));
336 break;
337
338 case FOURCC_PTBL:
340 break;
341
344 break;
345
348 break;
349
350 default:
351 FIXME("Ignoring chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
352 break;
353 }
354
355 if (FAILED(hr)) break;
356 }
357
358 return hr;
359}
360
362 struct soundfont *soundfont)
363{
364 struct chunk_entry chunk = {.parent = parent};
365 HRESULT hr;
366
367 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
368 {
369 switch (MAKE_IDTYPE(chunk.id, chunk.type))
370 {
371 case mmioFOURCC('s','m','p','l'):
372 if (soundfont->sdta) return E_INVALIDARG;
373 if (!(soundfont->sdta = malloc(chunk.size))) return E_OUTOFMEMORY;
375 break;
376
377 default:
378 FIXME("Skipping unknown chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
379 break;
380 }
381
382 if (FAILED(hr)) break;
383 }
384
385 return hr;
386}
387
389 struct soundfont *soundfont)
390{
391 struct chunk_entry chunk = {.parent = parent};
392 HRESULT hr;
393
394 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
395 {
396 switch (MAKE_IDTYPE(chunk.id, chunk.type))
397 {
398 case mmioFOURCC('p','h','d','r'):
399 if (soundfont->phdr) return E_INVALIDARG;
400 if (!(soundfont->phdr = malloc(chunk.size))) return E_OUTOFMEMORY;
402 soundfont->preset_count = chunk.size / sizeof(*soundfont->phdr) - 1;
403 break;
404
405 case mmioFOURCC('p','b','a','g'):
406 if (soundfont->pbag) return E_INVALIDARG;
407 if (!(soundfont->pbag = malloc(chunk.size))) return E_OUTOFMEMORY;
409 break;
410
411 case mmioFOURCC('p','m','o','d'):
412 if (soundfont->pmod) return E_INVALIDARG;
413 if (!(soundfont->pmod = malloc(chunk.size))) return E_OUTOFMEMORY;
415 break;
416
417 case mmioFOURCC('p','g','e','n'):
418 if (soundfont->pgen) return E_INVALIDARG;
419 if (!(soundfont->pgen = malloc(chunk.size))) return E_OUTOFMEMORY;
421 break;
422
423 case mmioFOURCC('i','n','s','t'):
424 if (soundfont->inst) return E_INVALIDARG;
425 if (!(soundfont->inst = malloc(chunk.size))) return E_OUTOFMEMORY;
428 break;
429
430 case mmioFOURCC('i','b','a','g'):
431 if (soundfont->ibag) return E_INVALIDARG;
432 if (!(soundfont->ibag = malloc(chunk.size))) return E_OUTOFMEMORY;
434 break;
435
436 case mmioFOURCC('i','m','o','d'):
437 if (soundfont->imod) return E_INVALIDARG;
438 if (!(soundfont->imod = malloc(chunk.size))) return E_OUTOFMEMORY;
440 break;
441
442 case mmioFOURCC('i','g','e','n'):
443 if (soundfont->igen) return E_INVALIDARG;
444 if (!(soundfont->igen = malloc(chunk.size))) return E_OUTOFMEMORY;
446 break;
447
448 case mmioFOURCC('s','h','d','r'):
449 if (soundfont->shdr) return E_INVALIDARG;
450 if (!(soundfont->shdr = malloc(chunk.size))) return E_OUTOFMEMORY;
452 soundfont->sample_count = chunk.size / sizeof(*soundfont->shdr) - 1;
453 break;
454
455 default:
456 FIXME("Skipping unknown chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
457 break;
458 }
459
460 if (FAILED(hr)) break;
461 }
462
463 return hr;
464}
465
467{
468 struct chunk_entry chunk = {.parent = parent};
469 struct soundfont soundfont = {0};
470 UINT i, j, k;
471 HRESULT hr;
472
473 if (FAILED(hr = dmobj_parsedescriptor(stream, parent, &This->dmobj.desc,
476 return hr;
477
478 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
479 {
480 switch (MAKE_IDTYPE(chunk.id, chunk.type))
481 {
483 /* already parsed by dmobj_parsedescriptor */
484 break;
485
486 case MAKE_IDTYPE(FOURCC_LIST, mmioFOURCC('s','d','t','a')):
488 break;
489
490 case MAKE_IDTYPE(FOURCC_LIST, mmioFOURCC('p','d','t','a')):
492 break;
493
494 default:
495 FIXME("Ignoring chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
496 break;
497 }
498
499 if (FAILED(hr)) break;
500 }
501
502 if (SUCCEEDED(hr))
503 {
504 TRACE("presets:\n");
505 for (i = 0; i < soundfont.preset_count; i++)
506 {
507 struct sf_preset *preset = soundfont.phdr + i;
508
509 TRACE("preset[%u]:\n", i);
510 TRACE(" - name: %s\n", debugstr_a(preset->name));
511 TRACE(" - preset: %u\n", preset->preset);
512 TRACE(" - bank: %u\n", preset->bank);
513 TRACE(" - preset_bag_ndx: %u\n", preset->bag_ndx);
514 TRACE(" - library: %lu\n", preset->library);
515 TRACE(" - genre: %lu\n", preset->genre);
516 TRACE(" - morphology: %#lx\n", preset->morphology);
517
518 for (j = preset->bag_ndx; j < (preset + 1)->bag_ndx; j++)
519 {
520 struct sf_bag *bag = soundfont.pbag + j;
521 TRACE(" - bag[%u]:\n", j);
522 TRACE(" - gen_ndx: %u\n", bag->gen_ndx);
523 TRACE(" - mod_ndx: %u\n", bag->mod_ndx);
524
525 for (k = bag->gen_ndx; k < (bag + 1)->gen_ndx; k++)
526 {
527 struct sf_gen *gen = soundfont.pgen + k;
528 TRACE(" - gen[%u]: %s\n", k, debugstr_sf_gen(gen));
529 }
530
531 for (k = bag->mod_ndx; k < (bag + 1)->mod_ndx; k++)
532 {
533 struct sf_mod *mod = soundfont.pmod + k;
534 TRACE(" - mod[%u]: %s\n", k, debugstr_sf_mod(mod));
535 }
536 }
537 }
538
539 TRACE("instruments:\n");
540 for (i = 0; i < soundfont.instrument_count; i++)
541 {
543 TRACE("instrument[%u]:\n", i);
544 TRACE(" - name: %s\n", debugstr_a(instrument->name));
545 TRACE(" - bag_ndx: %u\n", instrument->bag_ndx);
546
547 for (j = instrument->bag_ndx; j < (instrument + 1)->bag_ndx; j++)
548 {
549 struct sf_bag *bag = soundfont.ibag + j;
550 TRACE(" - bag[%u]:\n", j);
551 TRACE(" - wGenNdx: %u\n", bag->gen_ndx);
552 TRACE(" - wModNdx: %u\n", bag->mod_ndx);
553
554 for (k = bag->gen_ndx; k < (bag + 1)->gen_ndx; k++)
555 {
556 struct sf_gen *gen = soundfont.igen + k;
557 TRACE(" - gen[%u]: %s\n", k, debugstr_sf_gen(gen));
558 }
559
560 for (k = bag->mod_ndx; k < (bag + 1)->mod_ndx; k++)
561 {
562 struct sf_mod *mod = soundfont.imod + k;
563 TRACE(" - mod[%u]: %s\n", k, debugstr_sf_mod(mod));
564 }
565 }
566 }
567
568 TRACE("samples:\n");
569 for (i = 0; i < soundfont.sample_count; i++)
570 {
571 struct sf_sample *sample = soundfont.shdr + i;
572
573 TRACE("sample[%u]:\n", i);
574 TRACE(" - name: %s\n", debugstr_a(sample->name));
575 TRACE(" - start: %lu\n", sample->start);
576 TRACE(" - end: %lu\n", sample->end);
577 TRACE(" - start_loop: %lu\n", sample->start_loop);
578 TRACE(" - end_loop: %lu\n", sample->end_loop);
579 TRACE(" - sample_rate: %lu\n", sample->sample_rate);
580 TRACE(" - original_key: %u\n", sample->original_key);
581 TRACE(" - correction: %d\n", sample->correction);
582 TRACE(" - sample_link: %#x\n", sample->sample_link);
583 TRACE(" - sample_type: %#x\n", sample->sample_type);
584 }
585 }
586
587 for (i = 0; SUCCEEDED(hr) && i < soundfont.preset_count; i++)
588 {
589 struct instrument_entry *entry;
590
591 if (!(entry = malloc(sizeof(*entry)))) return E_OUTOFMEMORY;
592 hr = instrument_create_from_soundfont(&soundfont, i, This, &entry->desc, &entry->instrument);
593 if (SUCCEEDED(hr)) hr = IDirectMusicInstrument_GetPatch(entry->instrument, &entry->patch);
594 if (SUCCEEDED(hr)) list_add_tail(&This->instruments, &entry->entry);
595 else free(entry);
596 }
597
598 if (SUCCEEDED(hr))
599 {
600 UINT size = offsetof(struct pool, cues[soundfont.sample_count]);
601 if (!(This->pool = calloc(1, size))) return E_OUTOFMEMORY;
602 This->pool->table.cbSize = sizeof(This->pool->table);
603 }
604
605 for (i = 0; SUCCEEDED(hr) && i < soundfont.sample_count; i++)
606 {
607 struct wave_entry *entry;
608
609 if (!(entry = malloc(sizeof(*entry)))) return E_OUTOFMEMORY;
611 if (FAILED(hr)) free(entry);
612 else
613 {
614 entry->offset = i;
615 This->pool->table.cCues++;
616 This->pool->cues[i].ulOffset = i;
617 list_add_tail(&This->waves, &entry->entry);
618 }
619 }
620
631
632 return hr;
633}
634
635static HRESULT WINAPI collection_object_ParseDescriptor(IDirectMusicObject *iface,
637{
638 struct chunk_entry riff = {0};
639 HRESULT hr;
640
641 TRACE("(%p, %p, %p)\n", iface, stream, desc);
642
643 if (!stream || !desc)
644 return E_POINTER;
645
646 if ((hr = stream_get_chunk(stream, &riff)) != S_OK)
647 return hr;
648 if (riff.id != FOURCC_RIFF || (riff.type != FOURCC_DLS && riff.type != mmioFOURCC('s','f','b','k'))) {
649 TRACE("loading failed: unexpected %s\n", debugstr_chunk(&riff));
651 return DMUS_E_NOTADLSCOL;
652 }
653
655 if (FAILED(hr))
656 return hr;
657
658 desc->guidClass = CLSID_DirectMusicCollection;
659 desc->dwValidData |= DMUS_OBJ_CLASS;
660
661 TRACE("returning descriptor:\n");
663 return S_OK;
664}
665
666static const IDirectMusicObjectVtbl collection_object_vtbl =
667{
674};
675
677{
679 struct chunk_entry chunk = {0};
680 HRESULT hr;
681
682 TRACE("(%p, %p)\n", This, stream);
683
684 if ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
685 {
686 switch (MAKE_IDTYPE(chunk.id, chunk.type))
687 {
690 break;
691
692 case MAKE_IDTYPE(FOURCC_RIFF, mmioFOURCC('s','f','b','k')):
694 break;
695
696 default:
697 WARN("Invalid collection chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
699 break;
700 }
701 }
702
703 if (FAILED(hr)) return hr;
704
705 if (TRACE_ON(dmusic))
706 {
707 struct instrument_entry *entry;
708 struct wave_entry *wave_entry;
709 int i = 0;
710
711 TRACE("*** IDirectMusicCollection (%p) ***\n", &This->IDirectMusicCollection_iface);
712 dump_DMUS_OBJECTDESC(&This->dmobj.desc);
713
714 TRACE(" - Collection header:\n");
715 TRACE(" - cInstruments: %ld\n", This->header.cInstruments);
716 TRACE(" - Instruments:\n");
717
718 LIST_FOR_EACH_ENTRY(entry, &This->instruments, struct instrument_entry, entry)
719 {
720 TRACE(" - Instrument[%i]: %p\n", i, entry->instrument);
721 i++;
722 }
723
724 TRACE(" - cues:\n");
725 for (i = 0; This->pool && i < This->pool->table.cCues; i++)
726 TRACE(" - index: %u, offset: %lu\n", i, This->pool->cues[i].ulOffset);
727
728 TRACE(" - waves:\n");
730 TRACE(" - offset: %lu, wave %p\n", wave_entry->offset, wave_entry->wave);
731 }
732
734 return S_OK;
735}
736
737static const IPersistStreamVtbl collection_stream_vtbl =
738{
747};
748
750{
751 struct collection *collection;
752
753 *ret_iface = NULL;
754 if (!(collection = calloc(1, sizeof(*collection)))) return E_OUTOFMEMORY;
757 collection->ref = 1;
758 dmobject_init(&collection->dmobj, &CLSID_DirectMusicCollection,
760 collection->dmobj.IDirectMusicObject_iface.lpVtbl = &collection_object_vtbl;
761 collection->dmobj.IPersistStream_iface.lpVtbl = &collection_stream_vtbl;
764
765 TRACE("Created DirectMusicCollection %p\n", collection);
767 return S_OK;
768}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:68
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
Definition: list.h:39
static HRESULT parse_sdta_list(struct collection *This, IStream *stream, struct chunk_entry *parent, struct soundfont *soundfont)
Definition: collection.c:361
HRESULT collection_get_wave(struct collection *collection, DWORD index, IDirectMusicObject **out)
Definition: collection.c:81
static ULONG WINAPI collection_Release(IDirectMusicCollection *iface)
Definition: collection.c:147
static HRESULT WINAPI collection_GetInstrument(IDirectMusicCollection *iface, DWORD patch, IDirectMusicInstrument **instrument)
Definition: collection.c:180
static const IDirectMusicCollectionVtbl collection_vtbl
Definition: collection.c:222
void collection_internal_addref(struct collection *collection)
Definition: collection.c:66
static HRESULT parse_ptbl_chunk(struct collection *This, IStream *stream, struct chunk_entry *chunk)
Definition: collection.c:291
static struct collection * impl_from_IPersistStream(IPersistStream *iface)
Definition: collection.c:107
HRESULT collection_create(IUnknown **ret_iface)
Definition: collection.c:749
static HRESULT parse_wvpl_list(struct collection *This, IStream *stream, struct chunk_entry *parent)
Definition: collection.c:260
static HRESULT WINAPI collection_QueryInterface(IDirectMusicCollection *iface, REFIID riid, void **ret_iface)
Definition: collection.c:112
static HRESULT WINAPI collection_object_ParseDescriptor(IDirectMusicObject *iface, IStream *stream, DMUS_OBJECTDESC *desc)
Definition: collection.c:635
static struct collection * impl_from_IDirectMusicCollection(IDirectMusicCollection *iface)
Definition: collection.c:102
static const IPersistStreamVtbl collection_stream_vtbl
Definition: collection.c:737
static ULONG WINAPI collection_AddRef(IDirectMusicCollection *iface)
Definition: collection.c:137
static HRESULT parse_dls_chunk(struct collection *This, IStream *stream, struct chunk_entry *parent)
Definition: collection.c:314
static HRESULT WINAPI collection_EnumInstrument(IDirectMusicCollection *iface, DWORD index, DWORD *patch, LPWSTR name, DWORD name_length)
Definition: collection.c:203
static HRESULT parse_sfbk_chunk(struct collection *This, IStream *stream, struct chunk_entry *parent)
Definition: collection.c:466
static HRESULT parse_lins_list(struct collection *This, IStream *stream, struct chunk_entry *parent)
Definition: collection.c:231
static HRESULT parse_pdta_list(struct collection *This, IStream *stream, struct chunk_entry *parent, struct soundfont *soundfont)
Definition: collection.c:388
void collection_internal_release(struct collection *collection)
Definition: collection.c:72
static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, IStream *stream)
Definition: collection.c:676
static const IDirectMusicObjectVtbl collection_object_vtbl
Definition: collection.c:666
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRACE_ON(x)
Definition: compat.h:75
#define lstrcpynW
Definition: compat.h:738
struct _POOLCUE POOLCUE
#define FOURCC_INS
Definition: dls1.h:41
#define FOURCC_DLID
Definition: dls1.h:34
#define FOURCC_wave
Definition: dls1.h:39
#define FOURCC_COLH
Definition: dls1.h:35
#define FOURCC_LINS
Definition: dls1.h:40
#define FOURCC_PTBL
Definition: dls1.h:37
#define FOURCC_WVPL
Definition: dls1.h:36
#define FOURCC_VERS
Definition: dls1.h:50
#define FOURCC_DLS
Definition: dls1.h:33
#define DMUS_E_UNSUPPORTED_STREAM
Definition: dmerror.h:100
#define DMUS_E_NOTADLSCOL
Definition: dmerror.h:59
#define DMUS_E_INVALIDPATCH
Definition: dmerror.h:63
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
Definition: dmobject.c:503
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk)
Definition: dmobject.c:749
HRESULT stream_chunk_get_data(IStream *stream, const struct chunk_entry *chunk, void *data, ULONG size)
Definition: dmobject.c:417
HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk)
Definition: dmobject.c:360
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface)
Definition: dmobject.c:702
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface)
Definition: dmobject.c:497
HRESULT dmobj_parsedescriptor(IStream *stream, const struct chunk_entry *riff, DMUS_OBJECTDESC *desc, DWORD supported)
Definition: dmobject.c:591
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, void **ret_iface)
Definition: dmobject.c:484
HRESULT WINAPI unimpl_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class)
Definition: dmobject.c:723
HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *size)
Definition: dmobject.c:742
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
Definition: dmobject.c:518
void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc)
Definition: dmobject.c:222
const char * debugstr_chunk(const struct chunk_entry *chunk)
Definition: dmobject.c:279
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface)
Definition: dmobject.c:696
const char * debugstr_dmguid(const GUID *id)
Definition: dmobject.c:36
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid, void **ret_iface)
Definition: dmobject.c:689
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface)
Definition: dmobject.c:491
HRESULT stream_skip_chunk(IStream *stream, const struct chunk_entry *chunk)
Definition: dmobject.c:351
HRESULT stream_get_chunk(IStream *stream, struct chunk_entry *chunk)
Definition: dmobject.c:307
HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface)
Definition: dmobject.c:729
HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream, BOOL clear_dirty)
Definition: dmobject.c:735
static HRESULT stream_reset_chunk_data(IStream *stream, const struct chunk_entry *chunk)
Definition: dmobject.h:50
#define DMUS_OBJ_NAME_INFO
Definition: dmobject.h:97
#define MAKE_IDTYPE(id, type)
Definition: dmobject.h:33
#define DMUS_OBJ_GUID_DLID
Definition: dmobject.h:98
HRESULT instrument_create_from_chunk(IStream *stream, struct chunk_entry *parent, struct collection *collection, DMUS_OBJECTDESC *desc, IDirectMusicInstrument **ret_iface)
Definition: instrument.c:417
HRESULT instrument_create_from_soundfont(struct soundfont *soundfont, UINT index, struct collection *collection, DMUS_OBJECTDESC *desc, IDirectMusicInstrument **ret_iface)
Definition: instrument.c:620
HRESULT wave_create_from_soundfont(struct soundfont *soundfont, UINT index, IDirectMusicObject **out)
Definition: wave.c:342
HRESULT wave_create_from_chunk(IStream *stream, struct chunk_entry *parent, IDirectMusicObject **out)
Definition: wave.c:292
#define IDirectMusicInstrument_GetPatch(p, a)
Definition: dmusicc.h:529
#define IDirectMusicInstrument_AddRef(p)
Definition: dmusicc.h:526
#define IDirectMusicInstrument_Release(p)
Definition: dmusicc.h:527
#define DMUS_FOURCC_INFO_LIST
Definition: dmusicf.h:43
#define DMUS_OBJ_CLASS
Definition: dmusici.h:266
#define DMUS_OBJ_VERSION
Definition: dmusici.h:272
#define DMUS_OBJ_OBJECT
Definition: dmusici.h:265
r parent
Definition: btrfs.c:3010
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLuint index
Definition: glext.h:6031
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
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 GLint GLint j
Definition: glfuncs.h:250
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define C_ASSERT(e)
Definition: intsafe.h:73
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_a
Definition: kernel32.h:31
if(dx< 0)
Definition: linetemp.h:194
#define FOURCC_RIFF
Definition: mmsystem.h:564
#define FOURCC_LIST
Definition: mmsystem.h:565
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
static int stream_read
Definition: htmldoc.c:205
int k
Definition: mpi.c:3369
long LONG
Definition: pedump.c:60
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
static unsigned __int64 next
Definition: rand_nt.c:6
#define calloc
Definition: rosglue.h:14
#define offsetof(TYPE, MEMBER)
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
#define TRACE(s)
Definition: solgame.cpp:4
static const char * debugstr_sf_gen(struct sf_gen *gen)
Definition: soundfont.h:266
static const char * debugstr_sf_mod(struct sf_mod *mod)
Definition: soundfont.h:252
Definition: dls1.h:107
Definition: dmobject.h:26
FOURCC id
Definition: dmobject.h:27
FOURCC type
Definition: dmobject.h:29
uint16_t size
Definition: btrfs_drv.h:563
uint64_t offset
Definition: btrfs_drv.h:564
struct list instruments
Definition: collection.c:62
IDirectMusicCollection IDirectMusicCollection_iface
Definition: collection.c:55
LONG internal_ref
Definition: collection.c:57
struct dmobject dmobj
Definition: collection.c:56
struct list waves
Definition: collection.c:63
LONG ref
Definition: collection.c:58
DLSHEADER header
Definition: collection.c:60
struct pool * pool
Definition: collection.c:61
Definition: band.c:43
DMUS_OBJECTDESC desc
Definition: collection.c:30
DWORD patch
Definition: collection.c:29
IDirectMusicInstrument * instrument
Definition: collection.c:31
DMUS_IO_INSTRUMENT instrument
Definition: band.c:45
struct list entry
Definition: band.c:44
Definition: name.c:39
POOLCUE cues[]
Definition: collection.c:37
POOLTABLE table
Definition: collection.c:36
Definition: send.c:48
Definition: wave.c:25
WORD gen_ndx
Definition: soundfont.h:235
WORD mod_ndx
Definition: soundfont.h:236
WORD preset
Definition: soundfont.h:223
struct sf_gen * igen
Definition: soundfont.h:318
struct sf_mod * imod
Definition: soundfont.h:317
struct sf_gen * pgen
Definition: soundfont.h:312
UINT preset_count
Definition: soundfont.h:308
UINT sample_count
Definition: soundfont.h:320
struct sf_instrument * inst
Definition: soundfont.h:315
BYTE * sdta
Definition: soundfont.h:322
struct sf_bag * ibag
Definition: soundfont.h:316
struct sf_preset * phdr
Definition: soundfont.h:309
struct sf_bag * pbag
Definition: soundfont.h:310
UINT instrument_count
Definition: soundfont.h:314
struct sf_sample * shdr
Definition: soundfont.h:321
struct sf_mod * pmod
Definition: soundfont.h:311
Definition: parse.h:23
Definition: collection.c:47
IDirectMusicObject * wave
Definition: collection.c:49
struct list entry
Definition: collection.c:48
DWORD offset
Definition: collection.c:50
uint16_t * LPWSTR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480