ReactOS 0.4.17-dev-934-g091855f
band.c File Reference
#include "dmusic_private.h"
Include dependency graph for band.c:

Go to the source code of this file.

Classes

struct  instrument_entry
 
struct  band
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dmband)
 
void dump_DMUS_IO_INSTRUMENT (DMUS_IO_INSTRUMENT *inst)
 
static HRESULT instrument_entry_unload (struct instrument_entry *entry)
 
static void instrument_entry_destroy (struct instrument_entry *entry)
 
static struct band * impl_from_IDirectMusicBand (IDirectMusicBand *iface)
 
static HRESULT WINAPI band_QueryInterface (IDirectMusicBand *iface, REFIID riid, void **ret_iface)
 
static ULONG WINAPI band_AddRef (IDirectMusicBand *iface)
 
static ULONG WINAPI band_Release (IDirectMusicBand *iface)
 
static HRESULT WINAPI band_CreateSegment (IDirectMusicBand *iface, IDirectMusicSegment **segment)
 
static HRESULT WINAPI band_Download (IDirectMusicBand *iface, IDirectMusicPerformance *performance)
 
static HRESULT WINAPI band_Unload (IDirectMusicBand *iface, IDirectMusicPerformance *performance)
 
static HRESULT parse_lbin_list (struct band *This, IStream *stream, struct chunk_entry *parent)
 
static HRESULT parse_lbil_list (struct band *This, IStream *stream, struct chunk_entry *parent)
 
static HRESULT parse_dmbd_chunk (struct band *This, IStream *stream, struct chunk_entry *parent)
 
static HRESULT WINAPI band_object_ParseDescriptor (IDirectMusicObject *iface, IStream *stream, DMUS_OBJECTDESC *desc)
 
static struct band * impl_from_IPersistStream (IPersistStream *iface)
 
static HRESULT WINAPI band_persist_stream_Load (IPersistStream *iface, IStream *stream)
 
HRESULT create_dmband (REFIID lpcGUID, void **ppobj)
 
HRESULT band_connect_to_collection (IDirectMusicBand *iface, IDirectMusicCollection *collection)
 
HRESULT band_send_messages (IDirectMusicBand *iface, IDirectMusicPerformance *performance, IDirectMusicGraph *graph, MUSIC_TIME time, DWORD track_id)
 
HRESULT band_add_instrument (IDirectMusicBand *iface, DMUS_IO_INSTRUMENT *instrument)
 

Variables

static const IDirectMusicBandVtbl band_vtbl
 
static const IDirectMusicObjectVtbl band_object_vtbl
 
static const IPersistStreamVtbl band_persist_stream_vtbl
 

Function Documentation

◆ band_add_instrument()

HRESULT band_add_instrument ( IDirectMusicBand *  iface,
DMUS_IO_INSTRUMENT *  instrument 
)

Definition at line 531 of file band.c.

532{
533 struct band *This = impl_from_IDirectMusicBand(iface);
534 struct instrument_entry *entry;
535
536 TRACE("%p, %p\n", iface, instrument);
537
538 if (!(entry = calloc(1, sizeof(*entry)))) return E_OUTOFMEMORY;
539 entry->instrument = *instrument;
540 list_add_tail(&This->instruments, &entry->entry);
541
542 return S_OK;
543}
static struct band * impl_from_IDirectMusicBand(IDirectMusicBand *iface)
Definition: band.c:84
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
uint32_t entry
Definition: isohybrid.c:63
#define calloc
Definition: rosglue.h:14
#define TRACE(s)
Definition: solgame.cpp:4
Definition: band.c:76
Definition: band.c:43
DMUS_IO_INSTRUMENT instrument
Definition: band.c:45

Referenced by midi_parser_handle_program_change().

◆ band_AddRef()

static ULONG WINAPI band_AddRef ( IDirectMusicBand *  iface)
static

Definition at line 113 of file band.c.

114{
115 struct band *This = impl_from_IDirectMusicBand(iface);
117
118 TRACE("(%p) ref=%ld\n", This, ref);
119
120 return ref;
121}
#define InterlockedIncrement
Definition: armddk.h:53
long LONG
Definition: pedump.c:60
LONG ref
Definition: band.c:79
Definition: send.c:48

◆ band_connect_to_collection()

HRESULT band_connect_to_collection ( IDirectMusicBand *  iface,
IDirectMusicCollection *  collection 
)

Definition at line 477 of file band.c.

478{
479 struct band *This = impl_from_IDirectMusicBand(iface);
480
481 TRACE("%p, %p\n", iface, collection);
482
483 if (This->collection) IDirectMusicCollection_Release(This->collection);
484 if ((This->collection = collection)) IDirectMusicCollection_AddRef(This->collection);
485
486 return S_OK;
487}
#define IDirectMusicCollection_AddRef(p)
Definition: dmusicc.h:577
#define IDirectMusicCollection_Release(p)
Definition: dmusicc.h:578

Referenced by band_track_SetParam().

◆ band_CreateSegment()

static HRESULT WINAPI band_CreateSegment ( IDirectMusicBand *  iface,
IDirectMusicSegment **  segment 
)
static

Definition at line 147 of file band.c.

149{
150 struct band *This = impl_from_IDirectMusicBand(iface);
151 HRESULT hr;
152 DMUS_BAND_PARAM bandparam;
153
154 FIXME("(%p, %p): semi-stub\n", This, segment);
155
156 hr = CoCreateInstance(&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC,
157 &IID_IDirectMusicSegment, (void**)segment);
158 if (FAILED(hr))
159 return hr;
160
161 bandparam.mtTimePhysical = 0;
162 bandparam.pBand = &This->IDirectMusicBand_iface;
164 hr = IDirectMusicSegment_SetParam(*segment, &GUID_BandParam, 0xffffffff, DMUS_SEG_ALLTRACKS,
165 0, &bandparam);
167
168 return hr;
169}
#define FIXME(fmt,...)
Definition: precomp.h:53
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define IDirectMusicBand_AddRef(p)
Definition: dmusici.h:814
#define DMUS_SEG_ALLTRACKS
Definition: dmusici.h:317
#define IDirectMusicSegment_SetParam(p, a, b, c, d, e)
Definition: dmusici.h:1026
#define IDirectMusicBand_Release(p)
Definition: dmusici.h:815
#define FAILED(hr)
Definition: intsafe.h:51
MUSIC_TIME mtTimePhysical
Definition: dmusici.h:783
struct IDirectMusicBand * pBand
Definition: dmusici.h:784

◆ band_Download()

static HRESULT WINAPI band_Download ( IDirectMusicBand *  iface,
IDirectMusicPerformance *  performance 
)
static

Definition at line 171 of file band.c.

173{
174 struct band *This = impl_from_IDirectMusicBand(iface);
175 struct instrument_entry *entry;
176 HRESULT hr = S_OK;
177
178 TRACE("(%p, %p)\n", This, performance);
179
180 LIST_FOR_EACH_ENTRY(entry, &This->instruments, struct instrument_entry, entry)
181 {
182 IDirectMusicCollection *collection;
183 IDirectMusicInstrument *instrument;
184
185 if (FAILED(hr = instrument_entry_unload(entry))) break;
186 if (!(collection = entry->collection) && !(collection = This->collection)) continue;
187
189 {
191 &entry->download, NULL, 0, &entry->download_port, NULL, NULL);
193 }
194
195 if (FAILED(hr)) break;
196 }
197
198 if (FAILED(hr)) WARN("Failed to download instruments, hr %#lx\n", hr);
199 return hr;
200}
static HRESULT instrument_entry_unload(struct instrument_entry *entry)
Definition: band.c:52
#define WARN(fmt,...)
Definition: precomp.h:61
#define IDirectMusicCollection_GetInstrument(p, a, b)
Definition: dmusicc.h:580
#define IDirectMusicInstrument_Release(p)
Definition: dmusicc.h:527
#define IDirectMusicPerformance_DownloadInstrument(p, a, b, c, d, e, f, g, h)
Definition: dmusici.h:1307
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
IDirectMusicCollection * collection
Definition: band.c:46

◆ band_object_ParseDescriptor()

static HRESULT WINAPI band_object_ParseDescriptor ( IDirectMusicObject *  iface,
IStream *  stream,
DMUS_OBJECTDESC *  desc 
)
static

Definition at line 335 of file band.c.

337{
338 struct chunk_entry riff = {0};
339 STATSTG stat;
340 HRESULT hr;
341
342 TRACE("(%p, %p, %p)\n", iface, stream, desc);
343
344 if (!stream || !desc)
345 return E_POINTER;
346
347 if ((hr = stream_get_chunk(stream, &riff)) != S_OK)
348 return hr;
349 if (riff.id != FOURCC_RIFF || riff.type != DMUS_FOURCC_BAND_FORM) {
350 TRACE("loading failed: unexpected %s\n", debugstr_chunk(&riff));
352 return DMUS_E_INVALID_BAND;
353 }
354
357 if (FAILED(hr))
358 return hr;
359
360 desc->guidClass = CLSID_DirectMusicBand;
361 desc->dwValidData |= DMUS_OBJ_CLASS;
362
363 if (desc->dwValidData & DMUS_OBJ_CATEGORY) {
364 IStream_Stat(stream, &stat, STATFLAG_NONAME);
365 desc->ftDate = stat.mtime;
366 desc->dwValidData |= DMUS_OBJ_DATE;
367 }
368
369 TRACE("returning descriptor:\n");
371 return S_OK;
372}
#define stat
Definition: acwin.h:100
#define DMUS_E_INVALID_BAND
Definition: dmerror.h:102
HRESULT dmobj_parsedescriptor(IStream *stream, const struct chunk_entry *riff, DMUS_OBJECTDESC *desc, DWORD supported)
Definition: dmobject.c:591
void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc)
Definition: dmobject.c:222
const char * debugstr_chunk(const struct chunk_entry *chunk)
Definition: dmobject.c:279
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
#define DMUS_OBJ_NAME_INAM
Definition: dmobject.h:96
#define DMUS_FOURCC_BAND_FORM
Definition: dmusicf.h:63
#define DMUS_OBJ_DATE
Definition: dmusici.h:273
#define DMUS_OBJ_NAME
Definition: dmusici.h:267
#define DMUS_OBJ_CLASS
Definition: dmusici.h:266
#define DMUS_OBJ_VERSION
Definition: dmusici.h:272
#define DMUS_OBJ_CATEGORY
Definition: dmusici.h:268
#define DMUS_OBJ_OBJECT
Definition: dmusici.h:265
#define FOURCC_RIFF
Definition: mmsystem.h:564
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
Definition: dmobject.h:26
FOURCC id
Definition: dmobject.h:27
FOURCC type
Definition: dmobject.h:29
Definition: stat.h:66
Definition: parse.h:23
#define E_POINTER
Definition: winerror.h:3480

◆ band_persist_stream_Load()

static HRESULT WINAPI band_persist_stream_Load ( IPersistStream *  iface,
IStream *  stream 
)
static

Definition at line 389 of file band.c.

390{
391 struct band *This = impl_from_IPersistStream(iface);
392 DMUS_OBJECTDESC default_desc =
393 {
394 .dwSize = sizeof(DMUS_OBJECTDESC),
395 .dwValidData = DMUS_OBJ_OBJECT | DMUS_OBJ_CLASS,
396 .guidClass = CLSID_DirectMusicCollection,
397 .guidObject = GUID_DefaultGMCollection,
398 };
399 struct chunk_entry chunk = {0};
400 HRESULT hr;
401
402 TRACE("%p, %p\n", iface, stream);
403
404 if (This->collection) IDirectMusicCollection_Release(This->collection);
405 if (FAILED(hr = stream_get_object(stream, &default_desc, &IID_IDirectMusicCollection,
406 (void **)&This->collection)))
407 WARN("Failed to load default collection from loader, hr %#lx\n", hr);
408
409 if ((hr = stream_get_chunk(stream, &chunk)) == S_OK)
410 {
411 switch (MAKE_IDTYPE(chunk.id, chunk.type))
412 {
415 break;
416
417 default:
418 WARN("Invalid band chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
420 break;
421 }
422 }
423
425 if (FAILED(hr)) return hr;
426
427 if (TRACE_ON(dmband))
428 {
429 struct instrument_entry *entry;
430
431 TRACE("Loaded IDirectMusicBand %p\n", This);
432 dump_DMUS_OBJECTDESC(&This->dmobj.desc);
433
434 TRACE(" - Instruments:\n");
435 LIST_FOR_EACH_ENTRY(entry, &This->instruments, struct instrument_entry, entry)
436 {
437 dump_DMUS_IO_INSTRUMENT(&entry->instrument);
438 TRACE(" - collection: %p\n", entry->collection);
439 }
440 }
441
442 return S_OK;
443}
static HRESULT parse_dmbd_chunk(struct band *This, IStream *stream, struct chunk_entry *parent)
Definition: band.c:300
static struct band * impl_from_IPersistStream(IPersistStream *iface)
Definition: band.c:384
void dump_DMUS_IO_INSTRUMENT(DMUS_IO_INSTRUMENT *inst)
Definition: band.c:24
#define TRACE_ON(x)
Definition: compat.h:75
#define DMUS_E_UNSUPPORTED_STREAM
Definition: dmerror.h:100
HRESULT stream_get_object(IStream *stream, DMUS_OBJECTDESC *desc, REFIID iid, void **ret_iface)
Definition: dmobject.c:462
#define MAKE_IDTYPE(id, type)
Definition: dmobject.h:33
struct _DMUS_OBJECTDESC DMUS_OBJECTDESC
Definition: dmusici.h:570
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397

◆ band_QueryInterface()

static HRESULT WINAPI band_QueryInterface ( IDirectMusicBand *  iface,
REFIID  riid,
void **  ret_iface 
)
static

Definition at line 89 of file band.c.

91{
92 struct band *This = impl_from_IDirectMusicBand(iface);
93
94 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface);
95
96 *ret_iface = NULL;
97
98 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicBand))
99 *ret_iface = iface;
100 else if (IsEqualIID(riid, &IID_IDirectMusicObject))
101 *ret_iface = &This->dmobj.IDirectMusicObject_iface;
103 *ret_iface = &This->dmobj.IPersistStream_iface;
104 else {
105 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
106 return E_NOINTERFACE;
107 }
108
109 IDirectMusicBand_AddRef((IUnknown*)*ret_iface);
110 return S_OK;
111}
const GUID IID_IUnknown
const char * debugstr_dmguid(const GUID *id)
Definition: dmobject.c:36
REFIID riid
Definition: atlbase.h:39
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ band_Release()

static ULONG WINAPI band_Release ( IDirectMusicBand *  iface)
static

Definition at line 123 of file band.c.

124{
125 struct band *This = impl_from_IDirectMusicBand(iface);
127
128 TRACE("(%p) ref=%ld\n", This, ref);
129
130 if (!ref)
131 {
132 struct instrument_entry *entry, *next;
133
135 {
136 list_remove(&entry->entry);
138 }
139
140 if (This->collection) IDirectMusicCollection_Release(This->collection);
141 free(This);
142 }
143
144 return ref;
145}
#define InterlockedDecrement
Definition: armddk.h:52
static void instrument_entry_destroy(struct instrument_entry *entry)
Definition: band.c:68
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define free
Definition: debug_ros.c:5
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242

◆ band_send_messages()

HRESULT band_send_messages ( IDirectMusicBand *  iface,
IDirectMusicPerformance *  performance,
IDirectMusicGraph *  graph,
MUSIC_TIME  time,
DWORD  track_id 
)

Definition at line 489 of file band.c.

491{
492 struct band *This = impl_from_IDirectMusicBand(iface);
493 struct instrument_entry *entry;
494 HRESULT hr = S_OK;
495
497 {
498 DWORD patch = entry->instrument.dwPatch;
500
502 (DMUS_PMSG **)&msg)))
503 break;
504
505 msg->mtTime = time;
506 msg->dwFlags = DMUS_PMSGF_MUSICTIME;
507 msg->dwPChannel = entry->instrument.dwPChannel;
508 msg->dwVirtualTrackID = track_id;
509 msg->dwType = DMUS_PMSGT_PATCH;
510 msg->dwGroupID = 1;
511 msg->byInstrument = entry->instrument.dwPatch;
512
513 msg->byInstrument = patch & 0x7F;
514 patch >>= 8;
515 msg->byLSB = patch & 0x7f;
516 patch >>= 8;
517 msg->byMSB = patch & 0x7f;
518 patch >>= 8;
519
522 {
524 break;
525 }
526 }
527
528 return hr;
529}
#define msg(x)
Definition: auth_time.c:54
@ DMUS_PMSGF_MUSICTIME
Definition: dmusici.h:446
#define IDirectMusicPerformance_SendPMsg(p, a)
Definition: dmusici.h:1289
#define IDirectMusicPerformance_FreePMsg(p, a)
Definition: dmusici.h:1295
#define IDirectMusicGraph_StampPMsg(p, a)
Definition: dmusici.h:1474
#define IDirectMusicPerformance_AllocPMsg(p, a, b)
Definition: dmusici.h:1294
@ DMUS_PMSGT_PATCH
Definition: dmusici.h:463
unsigned long DWORD
Definition: ntddk_ex.h:95
__u16 time
Definition: mkdosfs.c:8
#define LIST_FOR_EACH_ENTRY_REV(elem, list, type, field)
Definition: list.h:260
Definition: graph.c:32
DWORD patch
Definition: collection.c:29

Referenced by band_track_Play().

◆ band_Unload()

static HRESULT WINAPI band_Unload ( IDirectMusicBand *  iface,
IDirectMusicPerformance *  performance 
)
static

Definition at line 202 of file band.c.

203{
204 struct band *This = impl_from_IDirectMusicBand(iface);
205 struct instrument_entry *entry;
206 HRESULT hr = S_OK;
207
208 TRACE("(%p, %p)\n", This, performance);
209
210 if (performance) FIXME("performance parameter not implemented\n");
211
212 LIST_FOR_EACH_ENTRY(entry, &This->instruments, struct instrument_entry, entry)
213 if (FAILED(hr = instrument_entry_unload(entry))) break;
214
215 if (FAILED(hr)) WARN("Failed to unload instruments, hr %#lx\n", hr);
216 return hr;
217}

◆ create_dmband()

HRESULT create_dmband ( REFIID  lpcGUID,
void **  ppobj 
)

Definition at line 457 of file band.c.

458{
459 struct band* obj;
460 HRESULT hr;
461
462 *ppobj = NULL;
463 if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
464 obj->IDirectMusicBand_iface.lpVtbl = &band_vtbl;
465 obj->ref = 1;
466 dmobject_init(&obj->dmobj, &CLSID_DirectMusicBand, (IUnknown *)&obj->IDirectMusicBand_iface);
467 obj->dmobj.IDirectMusicObject_iface.lpVtbl = &band_object_vtbl;
468 obj->dmobj.IPersistStream_iface.lpVtbl = &band_persist_stream_vtbl;
469 list_init(&obj->instruments);
470
471 hr = IDirectMusicBand_QueryInterface(&obj->IDirectMusicBand_iface, lpcGUID, ppobj);
472 IDirectMusicBand_Release(&obj->IDirectMusicBand_iface);
473
474 return hr;
475}
static const IDirectMusicObjectVtbl band_object_vtbl
Definition: band.c:374
static const IDirectMusicBandVtbl band_vtbl
Definition: band.c:219
static const IPersistStreamVtbl band_persist_stream_vtbl
Definition: band.c:445
static void list_init(struct list_entry *head)
Definition: list.h:51
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk)
Definition: dmobject.c:749
#define IDirectMusicBand_QueryInterface(p, a, b)
Definition: dmusici.h:813

◆ dump_DMUS_IO_INSTRUMENT()

void dump_DMUS_IO_INSTRUMENT ( DMUS_IO_INSTRUMENT *  inst)

Definition at line 24 of file band.c.

25{
26 TRACE("DMUS_IO_INSTRUMENT: %p\n", inst);
27 TRACE(" - dwPatch: %lu\n", inst->dwPatch);
28 TRACE(" - dwAssignPatch: %lu\n", inst->dwAssignPatch);
29 TRACE(" - dwNoteRanges[0]: %lu\n", inst->dwNoteRanges[0]);
30 TRACE(" - dwNoteRanges[1]: %lu\n", inst->dwNoteRanges[1]);
31 TRACE(" - dwNoteRanges[2]: %lu\n", inst->dwNoteRanges[2]);
32 TRACE(" - dwNoteRanges[3]: %lu\n", inst->dwNoteRanges[3]);
33 TRACE(" - dwPChannel: %lu\n", inst->dwPChannel);
34 TRACE(" - dwFlags: %lx\n", inst->dwFlags);
35 TRACE(" - bPan: %u\n", inst->bPan);
36 TRACE(" - bVolume: %u\n", inst->bVolume);
37 TRACE(" - nTranspose: %d\n", inst->nTranspose);
38 TRACE(" - dwChannelPriority: %lu\n", inst->dwChannelPriority);
39 TRACE(" - nPitchBendRange: %d\n", inst->nPitchBendRange);
40}
DWORD dwNoteRanges[4]
Definition: dmusicf.h:672
short nPitchBendRange
Definition: dmusicf.h:679
DWORD dwChannelPriority
Definition: dmusicf.h:678

Referenced by band_persist_stream_Load().

◆ impl_from_IDirectMusicBand()

static struct band * impl_from_IDirectMusicBand ( IDirectMusicBand *  iface)
inlinestatic

Definition at line 84 of file band.c.

85{
86 return CONTAINING_RECORD(iface, struct band, IDirectMusicBand_iface);
87}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by band_add_instrument(), band_AddRef(), band_connect_to_collection(), band_CreateSegment(), band_Download(), band_QueryInterface(), band_Release(), band_send_messages(), and band_Unload().

◆ impl_from_IPersistStream()

static struct band * impl_from_IPersistStream ( IPersistStream *  iface)
inlinestatic

Definition at line 384 of file band.c.

385{
386 return CONTAINING_RECORD(iface, struct band, dmobj.IPersistStream_iface);
387}

Referenced by band_persist_stream_Load().

◆ instrument_entry_destroy()

static void instrument_entry_destroy ( struct instrument_entry *  entry)
static

Definition at line 68 of file band.c.

69{
71 if (entry->collection) IDirectMusicCollection_Release(entry->collection);
72 free(entry);
73}

Referenced by band_Release().

◆ instrument_entry_unload()

static HRESULT instrument_entry_unload ( struct instrument_entry *  entry)
static

Definition at line 52 of file band.c.

53{
54 HRESULT hr;
55
56 if (!entry->download) return S_OK;
57
58 if (FAILED(hr = IDirectMusicPort_UnloadInstrument(entry->download_port, entry->download)))
59 WARN("Failed to unload entry instrument, hr %#lx\n", hr);
61 entry->download = NULL;
62 IDirectMusicPort_Release(entry->download_port);
63 entry->download_port = NULL;
64
65 return hr;
66}
#define IDirectMusicPort_Release(p)
Definition: dmusicc.h:680
#define IDirectMusicDownloadedInstrument_Release(p)
Definition: dmusicc.h:552
#define IDirectMusicPort_UnloadInstrument(p, a)
Definition: dmusicc.h:686

Referenced by band_Download(), band_Unload(), and instrument_entry_destroy().

◆ parse_dmbd_chunk()

static HRESULT parse_dmbd_chunk ( struct band *  This,
IStream *  stream,
struct chunk_entry *  parent 
)
static

Definition at line 300 of file band.c.

301{
302 struct chunk_entry chunk = {.parent = parent};
303 HRESULT hr;
304
305 if (FAILED(hr = dmobj_parsedescriptor(stream, parent, &This->dmobj.desc,
308 return hr;
309
310 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
311 {
312 switch (MAKE_IDTYPE(chunk.id, chunk.type))
313 {
317 /* already parsed by dmobj_parsedescriptor */
318 break;
319
322 break;
323
324 default:
325 FIXME("Ignoring chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
326 break;
327 }
328
329 if (FAILED(hr)) break;
330 }
331
332 return hr;
333}
static HRESULT parse_lbil_list(struct band *This, IStream *stream, struct chunk_entry *parent)
Definition: band.c:276
HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk)
Definition: dmobject.c:360
static HRESULT stream_reset_chunk_data(IStream *stream, const struct chunk_entry *chunk)
Definition: dmobject.h:50
#define DMUS_FOURCC_GUID_CHUNK
Definition: dmusicf.h:42
#define DMUS_FOURCC_VERSION_CHUNK
Definition: dmusicf.h:51
#define DMUS_FOURCC_INSTRUMENTS_LIST
Definition: dmusicf.h:64
#define DMUS_FOURCC_UNFO_LIST
Definition: dmusicf.h:44
r parent
Definition: btrfs.c:3010
#define FOURCC_LIST
Definition: mmsystem.h:565

Referenced by band_persist_stream_Load().

◆ parse_lbil_list()

static HRESULT parse_lbil_list ( struct band *  This,
IStream *  stream,
struct chunk_entry *  parent 
)
static

Definition at line 276 of file band.c.

277{
278 struct chunk_entry chunk = {.parent = parent};
279 HRESULT hr;
280
281 while ((hr = stream_next_chunk(stream, &chunk)) == S_OK)
282 {
283 switch (MAKE_IDTYPE(chunk.id, chunk.type))
284 {
287 break;
288
289 default:
290 FIXME("Ignoring chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
291 break;
292 }
293
294 if (FAILED(hr)) break;
295 }
296
297 return hr;
298}
static HRESULT parse_lbin_list(struct band *This, IStream *stream, struct chunk_entry *parent)
Definition: band.c:229
#define DMUS_FOURCC_INSTRUMENT_LIST
Definition: dmusicf.h:65

Referenced by parse_dmbd_chunk().

◆ parse_lbin_list()

static HRESULT parse_lbin_list ( struct band *  This,
IStream *  stream,
struct chunk_entry *  parent 
)
static

Definition at line 229 of file band.c.

230{
231 struct chunk_entry chunk = {.parent = parent};
232 IDirectMusicCollection *collection = NULL;
233 struct instrument_entry *entry;
234 DMUS_IO_INSTRUMENT inst = {0};
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 {
243 UINT size = sizeof(inst);
244 if (chunk.size == offsetof(DMUS_IO_INSTRUMENT, nPitchBendRange)) size = chunk.size;
245 if (FAILED(hr = stream_chunk_get_data(stream, &chunk, &inst, size))) break;
246 break;
247 }
248
250 {
251 IDirectMusicObject *object;
252 if (FAILED(hr = dmobj_parsereference(stream, &chunk, &object))) break;
253 hr = IDirectMusicObject_QueryInterface(object, &IID_IDirectMusicCollection, (void **)&collection);
255 break;
256 }
257
258 default:
259 FIXME("Ignoring chunk %s %s\n", debugstr_fourcc(chunk.id), debugstr_fourcc(chunk.type));
260 break;
261 }
262
263 if (FAILED(hr)) break;
264 }
265
266 if (FAILED(hr)) return hr;
267
268 if (!(entry = calloc(1, sizeof(*entry)))) return E_OUTOFMEMORY;
269 memcpy(&entry->instrument, &inst, sizeof(DMUS_IO_INSTRUMENT));
270 entry->collection = collection;
271 list_add_tail(&This->instruments, &entry->entry);
272
273 return hr;
274}
HRESULT stream_chunk_get_data(IStream *stream, const struct chunk_entry *chunk, void *data, ULONG size)
Definition: dmobject.c:417
HRESULT dmobj_parsereference(IStream *stream, const struct chunk_entry *list, IDirectMusicObject **dmobj)
Definition: dmobject.c:654
#define DMUS_FOURCC_INSTRUMENT_CHUNK
Definition: dmusicf.h:66
#define DMUS_FOURCC_REF_LIST
Definition: dmusicf.h:102
#define IDirectMusicObject_QueryInterface(p, a, b)
Definition: dmusici.h:842
#define IDirectMusicObject_Release(p)
Definition: dmusici.h:844
GLsizeiptr size
Definition: glext.h:5919
unsigned int UINT
Definition: sysinfo.c:13
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define offsetof(TYPE, MEMBER)
uint16_t size
Definition: btrfs_drv.h:563

Referenced by parse_lbil_list().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dmband  )

Variable Documentation

◆ band_object_vtbl

const IDirectMusicObjectVtbl band_object_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI band_object_ParseDescriptor(IDirectMusicObject *iface, IStream *stream, DMUS_OBJECTDESC *desc)
Definition: band.c:335
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
Definition: dmobject.c:503
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface)
Definition: dmobject.c:497
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, void **ret_iface)
Definition: dmobject.c:484
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
Definition: dmobject.c:518
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface)
Definition: dmobject.c:491

Definition at line 374 of file band.c.

Referenced by create_dmband().

◆ band_persist_stream_vtbl

const IPersistStreamVtbl band_persist_stream_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI band_persist_stream_Load(IPersistStream *iface, IStream *stream)
Definition: band.c:389
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface)
Definition: dmobject.c:702
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
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface)
Definition: dmobject.c:696
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid, void **ret_iface)
Definition: dmobject.c:689
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

Definition at line 445 of file band.c.

Referenced by create_dmband().

◆ band_vtbl

const IDirectMusicBandVtbl band_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI band_Download(IDirectMusicBand *iface, IDirectMusicPerformance *performance)
Definition: band.c:171
static ULONG WINAPI band_AddRef(IDirectMusicBand *iface)
Definition: band.c:113
static HRESULT WINAPI band_QueryInterface(IDirectMusicBand *iface, REFIID riid, void **ret_iface)
Definition: band.c:89
static HRESULT WINAPI band_Unload(IDirectMusicBand *iface, IDirectMusicPerformance *performance)
Definition: band.c:202
static ULONG WINAPI band_Release(IDirectMusicBand *iface)
Definition: band.c:123
static HRESULT WINAPI band_CreateSegment(IDirectMusicBand *iface, IDirectMusicSegment **segment)
Definition: band.c:147

Definition at line 219 of file band.c.

Referenced by create_dmband().