mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
dmusic: Use static variables for instrument header and id instead of using pointer.
This commit is contained in:
parent
bf0605c08a
commit
898c2954e0
@ -662,7 +662,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Load(LPPERSISTST
|
|||||||
LPDMUS_PRIVATE_INSTRUMENTENTRY new_instrument = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_INSTRUMENTENTRY));
|
LPDMUS_PRIVATE_INSTRUMENTENTRY new_instrument = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_INSTRUMENTENTRY));
|
||||||
TRACE_(dmfile)(": instrument list\n");
|
TRACE_(dmfile)(": instrument list\n");
|
||||||
/* Only way to create this one... even M$ does it discretely */
|
/* Only way to create this one... even M$ does it discretely */
|
||||||
DMUSIC_CreateDirectMusicInstrumentImpl(&IID_IDirectMusicInstrument, (LPVOID*)&new_instrument->pInstrument, NULL);
|
DMUSIC_CreateDirectMusicInstrumentImpl(&IID_IDirectMusicInstrument, (void**)&new_instrument->pInstrument, NULL);
|
||||||
{
|
{
|
||||||
IDirectMusicInstrumentImpl *instrument = impl_from_IDirectMusicInstrument(new_instrument->pInstrument);
|
IDirectMusicInstrumentImpl *instrument = impl_from_IDirectMusicInstrument(new_instrument->pInstrument);
|
||||||
/* Store offset and length, they will be needed when loading the instrument */
|
/* Store offset and length, they will be needed when loading the instrument */
|
||||||
@ -677,14 +677,12 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Load(LPPERSISTST
|
|||||||
switch (chunk.fccID) {
|
switch (chunk.fccID) {
|
||||||
case FOURCC_INSH: {
|
case FOURCC_INSH: {
|
||||||
TRACE_(dmfile)(": instrument header chunk\n");
|
TRACE_(dmfile)(": instrument header chunk\n");
|
||||||
instrument->pHeader = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, chunk.dwSize);
|
IStream_Read(stream, &instrument->header, chunk.dwSize, NULL);
|
||||||
IStream_Read(stream, instrument->pHeader, chunk.dwSize, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FOURCC_DLID: {
|
case FOURCC_DLID: {
|
||||||
TRACE_(dmfile)(": DLID (GUID) chunk\n");
|
TRACE_(dmfile)(": DLID (GUID) chunk\n");
|
||||||
instrument->pInstrumentID = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, chunk.dwSize);
|
IStream_Read(stream, &instrument->id, chunk.dwSize, NULL);
|
||||||
IStream_Read(stream, instrument->pInstrumentID, chunk.dwSize, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FOURCC_LIST: {
|
case FOURCC_LIST: {
|
||||||
@ -712,14 +710,14 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Load(LPPERSISTST
|
|||||||
/* DEBUG: dumps whole instrument object tree: */
|
/* DEBUG: dumps whole instrument object tree: */
|
||||||
if (TRACE_ON(dmusic)) {
|
if (TRACE_ON(dmusic)) {
|
||||||
TRACE("*** IDirectMusicInstrument (%p) ***\n", instrument);
|
TRACE("*** IDirectMusicInstrument (%p) ***\n", instrument);
|
||||||
if (instrument->pInstrumentID)
|
if (!IsEqualGUID(&instrument->id, &GUID_NULL))
|
||||||
TRACE(" - GUID = %s\n", debugstr_dmguid(instrument->pInstrumentID));
|
TRACE(" - GUID = %s\n", debugstr_dmguid(&instrument->id));
|
||||||
TRACE(" - Instrument header:\n");
|
TRACE(" - Instrument header:\n");
|
||||||
TRACE(" - cRegions: %d\n", instrument->pHeader->cRegions);
|
TRACE(" - cRegions: %d\n", instrument->header.cRegions);
|
||||||
TRACE(" - Locale:\n");
|
TRACE(" - Locale:\n");
|
||||||
TRACE(" - ulBank: %d\n", instrument->pHeader->Locale.ulBank);
|
TRACE(" - ulBank: %d\n", instrument->header.Locale.ulBank);
|
||||||
TRACE(" - ulInstrument: %d\n", instrument->pHeader->Locale.ulInstrument);
|
TRACE(" - ulInstrument: %d\n", instrument->header.Locale.ulInstrument);
|
||||||
TRACE(" => dwPatch: %d\n", MIDILOCALE2Patch(&instrument->pHeader->Locale));
|
TRACE(" => dwPatch: %d\n", MIDILOCALE2Patch(&instrument->header.Locale));
|
||||||
}
|
}
|
||||||
list_add_tail(&This->Instruments, &new_instrument->entry);
|
list_add_tail(&This->Instruments, &new_instrument->entry);
|
||||||
}
|
}
|
||||||
|
@ -238,8 +238,8 @@ struct IDirectMusicInstrumentImpl {
|
|||||||
/* IDirectMusicInstrumentImpl fields */
|
/* IDirectMusicInstrumentImpl fields */
|
||||||
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
|
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
|
||||||
ULONG length; /* Length of the instrument in the stream */
|
ULONG length; /* Length of the instrument in the stream */
|
||||||
LPGUID pInstrumentID;
|
GUID id;
|
||||||
LPINSTHEADER pHeader;
|
INSTHEADER header;
|
||||||
WCHAR wszName[DMUS_MAX_NAME];
|
WCHAR wszName[DMUS_MAX_NAME];
|
||||||
/* instrument data */
|
/* instrument data */
|
||||||
BOOL loaded;
|
BOOL loaded;
|
||||||
|
@ -92,7 +92,7 @@ static HRESULT WINAPI IDirectMusicInstrumentImpl_GetPatch(LPDIRECTMUSICINSTRUMEN
|
|||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, pdwPatch);
|
TRACE("(%p)->(%p)\n", This, pdwPatch);
|
||||||
|
|
||||||
*pdwPatch = MIDILOCALE2Patch(&This->pHeader->Locale);
|
*pdwPatch = MIDILOCALE2Patch(&This->header.Locale);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ static HRESULT WINAPI IDirectMusicInstrumentImpl_SetPatch(LPDIRECTMUSICINSTRUMEN
|
|||||||
|
|
||||||
TRACE("(%p)->(%d): stub\n", This, dwPatch);
|
TRACE("(%p)->(%d): stub\n", This, dwPatch);
|
||||||
|
|
||||||
Patch2MIDILOCALE(dwPatch, &This->pHeader->Locale);
|
Patch2MIDILOCALE(dwPatch, &This->header.Locale);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, ISt
|
|||||||
return DMUS_E_UNSUPPORTED_STREAM;
|
return DMUS_E_UNSUPPORTED_STREAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->regions = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->regions) * This->pHeader->cRegions);
|
This->regions = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->regions) * This->header.cRegions);
|
||||||
if (!This->regions)
|
if (!This->regions)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user