Commit 070cfc35 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

dmband: Handle the DirectX 7 version of DMUS_IO_INSTRUMENT structure.

parent e4a5af6c
......@@ -171,6 +171,8 @@ static const IDirectMusicObjectVtbl dmobject_vtbl = {
band_IDirectMusicObject_ParseDescriptor
};
#define DMUS_IO_INSTRUMENT_DX7_SIZE offsetof(DMUS_IO_INSTRUMENT, nPitchBendRange)
/* IDirectMusicBandImpl IPersistStream part: */
static HRESULT parse_instrument(IDirectMusicBandImpl *This, DMUS_PRIVATE_CHUNK *pChunk,
IStream *pStm)
......@@ -199,8 +201,14 @@ static HRESULT parse_instrument(IDirectMusicBandImpl *This, DMUS_PRIVATE_CHUNK *
switch (Chunk.fccID) {
case DMUS_FOURCC_INSTRUMENT_CHUNK: {
TRACE_(dmfile)(": Instrument chunk\n");
if (Chunk.dwSize != sizeof(DMUS_IO_INSTRUMENT)) return E_FAIL;
IStream_Read (pStm, &inst, sizeof(DMUS_IO_INSTRUMENT), NULL);
if (Chunk.dwSize != sizeof(DMUS_IO_INSTRUMENT) && Chunk.dwSize != DMUS_IO_INSTRUMENT_DX7_SIZE) {
ERR_(dmfile)("unexpected size %d\n", Chunk.dwSize);
return E_FAIL;
}
IStream_Read (pStm, &inst, Chunk.dwSize, NULL);
if (Chunk.dwSize != sizeof(DMUS_IO_INSTRUMENT))
inst.nPitchBendRange = 0;
TRACE_(dmfile)(" - dwPatch: %u\n", inst.dwPatch);
TRACE_(dmfile)(" - dwAssignPatch: %u\n", inst.dwAssignPatch);
TRACE_(dmfile)(" - dwNoteRanges[0]: %u\n", inst.dwNoteRanges[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment