HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) { IDirectMusicBufferImpl* dmbuffer; TRACE("(%p, %p)\n", desc, ret_iface); *ret_iface = NULL; dmbuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl)); if (!dmbuffer) return E_OUTOFMEMORY; dmbuffer->IDirectMusicBuffer_iface.lpVtbl = &DirectMusicBuffer_Vtbl; dmbuffer->ref = 1; if (IsEqualGUID(&desc->guidBufferFormat, &GUID_NULL)) dmbuffer->format = KSDATAFORMAT_SUBTYPE_MIDI; else dmbuffer->format = desc->guidBufferFormat; dmbuffer->size = (desc->cbBuffer + 3) & ~3; /* Buffer size must be multiple of 4 bytes */ dmbuffer->data = HeapAlloc(GetProcessHeap(), 0, dmbuffer->size); if (!dmbuffer->data) { HeapFree(GetProcessHeap(), 0, dmbuffer); return E_OUTOFMEMORY; } DMUSIC_LockModule(); *ret_iface = &dmbuffer->IDirectMusicBuffer_iface; return S_OK; }
/* For ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter) { IDirectMusic8Impl *dmusic; HRESULT ret; TRACE("(%s, %p, %p)\n", debugstr_guid(riid), ret_iface, unkouter); *ret_iface = NULL; if (unkouter) return CLASS_E_NOAGGREGATION; dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl)); if (!dmusic) return E_OUTOFMEMORY; dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl; dmusic->ref = 1; dmusic->pMasterClock = NULL; dmusic->ppPorts = NULL; dmusic->nrofports = 0; ret = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL); if (FAILED(ret)) { HeapFree(GetProcessHeap(), 0, dmusic); return ret; } create_system_ports_list(dmusic); DMUSIC_LockModule(); ret = IDirectMusic8Impl_QueryInterface(&dmusic->IDirectMusic8_iface, riid, ret_iface); IDirectMusic8Impl_Release(&dmusic->IDirectMusic8_iface); return ret; }
static ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface) { IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface; ULONG refCount = InterlockedIncrement(&This->ref); TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); DMUSIC_LockModule(); return refCount; }
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface); ULONG refCount = InterlockedIncrement(&This->ref); TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); DMUSIC_LockModule(); return refCount; }
static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) { IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface; ULONG refCount = InterlockedIncrement(&This->ref); TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); DMUSIC_LockModule(); return refCount; }
static ULONG WINAPI IDirectMusic8Impl_AddRef(LPDIRECTMUSIC8 iface) { IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p)->(): new ref = %u\n", This, ref); DMUSIC_LockModule(); return ref; }
static ULONG WINAPI SynthPortImpl_IDirectMusicPort_AddRef(LPDIRECTMUSICPORT iface) { SynthPortImpl *This = impl_from_SynthPortImpl_IDirectMusicPort(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p)->(): new ref = %u\n", This, ref); DMUSIC_LockModule(); return ref; }
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface) { IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p)->(): new ref = %u\n", iface, ref); DMUSIC_LockModule(); return ref; }
static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef(LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) { IDirectMusicDownloadedInstrumentImpl *This = impl_from_IDirectMusicDownloadedInstrument(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p)->(): new ref = %u\n", iface, ref); DMUSIC_LockModule(); return ref; }
static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface) { IReferenceClockImpl *This = impl_from_IReferenceClock(iface); ULONG refCount = InterlockedIncrement(&This->ref); TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); DMUSIC_LockModule(); return refCount; }
static HRESULT DMUSIC_CreateDirectMusicDownloadedInstrumentImpl(IDirectMusicDownloadedInstrument **instrument) { IDirectMusicDownloadedInstrumentImpl *object; object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { *instrument = NULL; return E_OUTOFMEMORY; } object->IDirectMusicDownloadedInstrument_iface.lpVtbl = &DirectMusicDownloadedInstrument_Vtbl; object->ref = 1; *instrument = &object->IDirectMusicDownloadedInstrument_iface; DMUSIC_LockModule(); return S_OK; }