Commit 495e3288 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

dmusic: Cleanup IDirectMusicCollection_GetInstrument.

parent 82f3b86c
......@@ -103,27 +103,27 @@ static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_Release(LP
}
/* IDirectMusicCollection Interface follows: */
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_GetInstrument(LPDIRECTMUSICCOLLECTION iface, DWORD dwPatch, IDirectMusicInstrument** ppInstrument)
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_GetInstrument(LPDIRECTMUSICCOLLECTION iface, DWORD patch, IDirectMusicInstrument** instrument)
{
IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface);
DMUS_PRIVATE_INSTRUMENTENTRY *tmpEntry;
struct list *listEntry;
DWORD dwInstPatch;
TRACE("(%p, %d, %p)\n", This, dwPatch, ppInstrument);
LIST_FOR_EACH (listEntry, &This->Instruments) {
tmpEntry = LIST_ENTRY(listEntry, DMUS_PRIVATE_INSTRUMENTENTRY, entry);
IDirectMusicInstrument_GetPatch (tmpEntry->pInstrument, &dwInstPatch);
if (dwPatch == dwInstPatch) {
*ppInstrument = tmpEntry->pInstrument;
IDirectMusicInstrument_AddRef (tmpEntry->pInstrument);
IDirectMusicInstrumentImpl_Custom_Load (tmpEntry->pInstrument, This->pStm); /* load instrument before returning it */
TRACE(": returning instrument %p\n", *ppInstrument);
DMUS_PRIVATE_INSTRUMENTENTRY *inst_entry;
struct list *list_entry;
DWORD inst_patch;
TRACE("(%p/%p)->(%u, %p)\n", iface, This, patch, instrument);
LIST_FOR_EACH(list_entry, &This->Instruments) {
inst_entry = LIST_ENTRY(list_entry, DMUS_PRIVATE_INSTRUMENTENTRY, entry);
IDirectMusicInstrument_GetPatch(inst_entry->pInstrument, &inst_patch);
if (patch == inst_patch) {
*instrument = inst_entry->pInstrument;
IDirectMusicInstrument_AddRef(inst_entry->pInstrument);
IDirectMusicInstrumentImpl_Custom_Load(inst_entry->pInstrument, This->pStm);
TRACE(": returning instrument %p\n", *instrument);
return S_OK;
}
}
TRACE(": instrument not found\n");
return DMUS_E_INVALIDPATCH;
......
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