Commit d6dc41c2 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dmusic: Simplify and cleanup IDirectMusicInstrument constructor.

parent 4a60c0f6
......@@ -377,7 +377,7 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface,
DMUS_PRIVATE_INSTRUMENTENTRY *new_instrument = calloc(1, sizeof(DMUS_PRIVATE_INSTRUMENTENTRY));
TRACE_(dmfile)(": instrument list\n");
/* Only way to create this one... even M$ does it discretely */
DMUSIC_CreateDirectMusicInstrumentImpl(&IID_IDirectMusicInstrument, (void**)&new_instrument->pInstrument, NULL);
instrument_create(&new_instrument->pInstrument);
{
IDirectMusicInstrumentImpl *instrument = impl_from_IDirectMusicInstrument(new_instrument->pInstrument);
/* Store offset and length, they will be needed when loading the instrument */
......
......@@ -97,10 +97,11 @@ extern HRESULT collection_create(IUnknown **ret_iface);
/* Internal */
extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface);
extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT download_create(DWORD size, IDirectMusicDownload **ret_iface);
extern HRESULT instrument_create(IDirectMusicInstrument **ret_iface);
/*****************************************************************************
* IDirectMusic8Impl implementation structure
*/
......
......@@ -119,24 +119,18 @@ static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Vtbl =
IDirectMusicInstrumentImpl_SetPatch
};
/* for ClassFactory */
HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicInstrumentImpl* dminst;
HRESULT hr;
HRESULT instrument_create(IDirectMusicInstrument **ret_iface)
{
IDirectMusicInstrumentImpl *dminst;
dminst = calloc(1, sizeof(IDirectMusicInstrumentImpl));
if (NULL == dminst) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
*ret_iface = NULL;
if (!(dminst = calloc(1, sizeof(*dminst)))) return E_OUTOFMEMORY;
dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl;
dminst->ref = 1;
hr = IDirectMusicInstrument_QueryInterface(&dminst->IDirectMusicInstrument_iface, lpcGUID,
ppobj);
IDirectMusicInstrument_Release(&dminst->IDirectMusicInstrument_iface);
return hr;
TRACE("Created DirectMusicInstrument %p\n", dminst);
*ret_iface = &dminst->IDirectMusicInstrument_iface;
return S_OK;
}
static HRESULT read_from_stream(IStream *stream, void *data, ULONG size)
......
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