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

dmusic: Get rid of the IDirectMusicInstrumentImpl typedef.

parent 9abd659e
...@@ -140,7 +140,7 @@ static HRESULT WINAPI collection_EnumInstrument(IDirectMusicCollection *iface, ...@@ -140,7 +140,7 @@ static HRESULT WINAPI collection_EnumInstrument(IDirectMusicCollection *iface,
LIST_FOR_EACH(list_entry, &This->Instruments) { LIST_FOR_EACH(list_entry, &This->Instruments) {
inst_entry = LIST_ENTRY(list_entry, DMUS_PRIVATE_INSTRUMENTENTRY, entry); inst_entry = LIST_ENTRY(list_entry, DMUS_PRIVATE_INSTRUMENTENTRY, entry);
if (i == index) { if (i == index) {
IDirectMusicInstrumentImpl *instrument = impl_from_IDirectMusicInstrument(inst_entry->pInstrument); struct instrument *instrument = impl_from_IDirectMusicInstrument(inst_entry->pInstrument);
IDirectMusicInstrument_GetPatch(inst_entry->pInstrument, patch); IDirectMusicInstrument_GetPatch(inst_entry->pInstrument, patch);
if (name) { if (name) {
length = min(lstrlenW(instrument->wszName), name_length - 1); length = min(lstrlenW(instrument->wszName), name_length - 1);
...@@ -379,7 +379,7 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, ...@@ -379,7 +379,7 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface,
/* Only way to create this one... even M$ does it discretely */ /* Only way to create this one... even M$ does it discretely */
instrument_create(&new_instrument->pInstrument); instrument_create(&new_instrument->pInstrument);
{ {
IDirectMusicInstrumentImpl *instrument = impl_from_IDirectMusicInstrument(new_instrument->pInstrument); struct instrument *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 */
liMove.QuadPart = 0; liMove.QuadPart = 0;
IStream_Seek(stream, liMove, STREAM_SEEK_CUR, &dlibInstrumentPosition); IStream_Seek(stream, liMove, STREAM_SEEK_CUR, &dlibInstrumentPosition);
......
...@@ -49,8 +49,6 @@ typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl; ...@@ -49,8 +49,6 @@ typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl; typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
typedef struct IReferenceClockImpl IReferenceClockImpl; typedef struct IReferenceClockImpl IReferenceClockImpl;
typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
/***************************************************************************** /*****************************************************************************
* Some stuff to make my life easier :=) * Some stuff to make my life easier :=)
*/ */
...@@ -175,15 +173,11 @@ typedef struct _DMUS_PRIVATE_POOLCUE { ...@@ -175,15 +173,11 @@ typedef struct _DMUS_PRIVATE_POOLCUE {
struct list entry; /* for listing elements */ struct list entry; /* for listing elements */
} DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE; } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
/***************************************************************************** struct instrument
* IDirectMusicInstrumentImpl implementation structure {
*/
struct IDirectMusicInstrumentImpl {
/* IUnknown fields */
IDirectMusicInstrument IDirectMusicInstrument_iface; IDirectMusicInstrument IDirectMusicInstrument_iface;
LONG ref; LONG ref;
/* 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 */
GUID id; GUID id;
...@@ -196,9 +190,9 @@ struct IDirectMusicInstrumentImpl { ...@@ -196,9 +190,9 @@ struct IDirectMusicInstrumentImpl {
instrument_articulation *articulations; instrument_articulation *articulations;
}; };
static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface) static inline struct instrument *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
{ {
return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface); return CONTAINING_RECORD(iface, struct instrument, IDirectMusicInstrument_iface);
} }
extern HRESULT instrument_load(IDirectMusicInstrument *iface, IStream *stream); extern HRESULT instrument_load(IDirectMusicInstrument *iface, IStream *stream);
......
...@@ -57,7 +57,7 @@ static HRESULT WINAPI instrument_QueryInterface(LPDIRECTMUSICINSTRUMENT iface, R ...@@ -57,7 +57,7 @@ static HRESULT WINAPI instrument_QueryInterface(LPDIRECTMUSICINSTRUMENT iface, R
static ULONG WINAPI instrument_AddRef(LPDIRECTMUSICINSTRUMENT iface) static ULONG WINAPI instrument_AddRef(LPDIRECTMUSICINSTRUMENT iface)
{ {
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); struct instrument *This = impl_from_IDirectMusicInstrument(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p): new ref = %lu\n", iface, ref); TRACE("(%p): new ref = %lu\n", iface, ref);
...@@ -67,7 +67,7 @@ static ULONG WINAPI instrument_AddRef(LPDIRECTMUSICINSTRUMENT iface) ...@@ -67,7 +67,7 @@ static ULONG WINAPI instrument_AddRef(LPDIRECTMUSICINSTRUMENT iface)
static ULONG WINAPI instrument_Release(LPDIRECTMUSICINSTRUMENT iface) static ULONG WINAPI instrument_Release(LPDIRECTMUSICINSTRUMENT iface)
{ {
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); struct instrument *This = impl_from_IDirectMusicInstrument(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): new ref = %lu\n", iface, ref); TRACE("(%p): new ref = %lu\n", iface, ref);
...@@ -88,7 +88,7 @@ static ULONG WINAPI instrument_Release(LPDIRECTMUSICINSTRUMENT iface) ...@@ -88,7 +88,7 @@ static ULONG WINAPI instrument_Release(LPDIRECTMUSICINSTRUMENT iface)
static HRESULT WINAPI instrument_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch) static HRESULT WINAPI instrument_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch)
{ {
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); struct instrument *This = impl_from_IDirectMusicInstrument(iface);
TRACE("(%p)->(%p)\n", This, pdwPatch); TRACE("(%p)->(%p)\n", This, pdwPatch);
...@@ -99,7 +99,7 @@ static HRESULT WINAPI instrument_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* ...@@ -99,7 +99,7 @@ static HRESULT WINAPI instrument_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD*
static HRESULT WINAPI instrument_SetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch) static HRESULT WINAPI instrument_SetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch)
{ {
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); struct instrument *This = impl_from_IDirectMusicInstrument(iface);
TRACE("(%p, %ld): stub\n", This, dwPatch); TRACE("(%p, %ld): stub\n", This, dwPatch);
...@@ -119,15 +119,15 @@ static const IDirectMusicInstrumentVtbl instrument_vtbl = ...@@ -119,15 +119,15 @@ static const IDirectMusicInstrumentVtbl instrument_vtbl =
HRESULT instrument_create(IDirectMusicInstrument **ret_iface) HRESULT instrument_create(IDirectMusicInstrument **ret_iface)
{ {
IDirectMusicInstrumentImpl *dminst; struct instrument *instrument;
*ret_iface = NULL; *ret_iface = NULL;
if (!(dminst = calloc(1, sizeof(*dminst)))) return E_OUTOFMEMORY; if (!(instrument = calloc(1, sizeof(*instrument)))) return E_OUTOFMEMORY;
dminst->IDirectMusicInstrument_iface.lpVtbl = &instrument_vtbl; instrument->IDirectMusicInstrument_iface.lpVtbl = &instrument_vtbl;
dminst->ref = 1; instrument->ref = 1;
TRACE("Created DirectMusicInstrument %p\n", dminst); TRACE("Created DirectMusicInstrument %p\n", instrument);
*ret_iface = &dminst->IDirectMusicInstrument_iface; *ret_iface = &instrument->IDirectMusicInstrument_iface;
return S_OK; return S_OK;
} }
...@@ -172,7 +172,7 @@ static inline HRESULT advance_stream(IStream *stream, ULONG bytes) ...@@ -172,7 +172,7 @@ static inline HRESULT advance_stream(IStream *stream, ULONG bytes)
return ret; return ret;
} }
static HRESULT load_region(IDirectMusicInstrumentImpl *This, IStream *stream, instrument_region *region, ULONG length) static HRESULT load_region(struct instrument *This, IStream *stream, instrument_region *region, ULONG length)
{ {
HRESULT ret; HRESULT ret;
DMUS_PRIVATE_CHUNK chunk; DMUS_PRIVATE_CHUNK chunk;
...@@ -242,7 +242,7 @@ static HRESULT load_region(IDirectMusicInstrumentImpl *This, IStream *stream, in ...@@ -242,7 +242,7 @@ static HRESULT load_region(IDirectMusicInstrumentImpl *This, IStream *stream, in
return S_OK; return S_OK;
} }
static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stream, ULONG length) static HRESULT load_articulation(struct instrument *This, IStream *stream, ULONG length)
{ {
HRESULT ret; HRESULT ret;
instrument_articulation *articulation; instrument_articulation *articulation;
...@@ -278,7 +278,7 @@ static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stre ...@@ -278,7 +278,7 @@ static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stre
/* Function that loads all instrument data and which is called from IDirectMusicCollection_GetInstrument as in native */ /* Function that loads all instrument data and which is called from IDirectMusicCollection_GetInstrument as in native */
HRESULT instrument_load(IDirectMusicInstrument *iface, IStream *stream) HRESULT instrument_load(IDirectMusicInstrument *iface, IStream *stream)
{ {
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); struct instrument *This = impl_from_IDirectMusicInstrument(iface);
HRESULT hr; HRESULT hr;
DMUS_PRIVATE_CHUNK chunk; DMUS_PRIVATE_CHUNK chunk;
ULONG i = 0; ULONG i = 0;
......
...@@ -266,7 +266,7 @@ static HRESULT WINAPI synth_port_DownloadInstrument(IDirectMusicPort *iface, IDi ...@@ -266,7 +266,7 @@ static HRESULT WINAPI synth_port_DownloadInstrument(IDirectMusicPort *iface, IDi
IDirectMusicDownloadedInstrument **downloaded_instrument, DMUS_NOTERANGE *note_ranges, DWORD num_note_ranges) IDirectMusicDownloadedInstrument **downloaded_instrument, DMUS_NOTERANGE *note_ranges, DWORD num_note_ranges)
{ {
struct synth_port *This = synth_from_IDirectMusicPort(iface); struct synth_port *This = synth_from_IDirectMusicPort(iface);
IDirectMusicInstrumentImpl *instrument_object; struct instrument *instrument_object;
HRESULT ret; HRESULT ret;
BOOL on_heap; BOOL on_heap;
HANDLE download; HANDLE download;
......
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