/* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSinkImpl(REFIID riid, void **ret_iface) { IDirectMusicSynthSinkImpl *obj; HRESULT hr; TRACE("(%s, %p)\n", debugstr_guid(riid), ret_iface); *ret_iface = NULL; obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynthSinkImpl)); if (!obj) return E_OUTOFMEMORY; obj->IDirectMusicSynthSink_iface.lpVtbl = &DirectMusicSynthSink_Vtbl; obj->IKsControl_iface.lpVtbl = &DMSynthSinkImpl_IKsControl_Vtbl; obj->ref = 1; hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&obj->latency_clock); if (FAILED(hr)) { HeapFree(GetProcessHeap(), 0, obj); return hr; } DMSYNTH_LockModule(); hr = IDirectMusicSynthSink_QueryInterface(&obj->IDirectMusicSynthSink_iface, riid, ret_iface); IDirectMusicSynthSink_Release(&obj->IDirectMusicSynthSink_iface); return hr; }
static ULONG WINAPI IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface) { IDirectMusicSynth8Impl *This = (IDirectMusicSynth8Impl *)iface; ULONG refCount = InterlockedIncrement(&This->ref); TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1); DMSYNTH_LockModule(); return refCount; }
static ULONG WINAPI IDirectMusicSynth8Impl_AddRef(LPDIRECTMUSICSYNTH8 iface) { IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p)->(): new ref = %u\n", This, ref); DMSYNTH_LockModule(); return ref; }
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) { TRACE("(%d)\n", dolock); if (dolock) DMSYNTH_LockModule(); else DMSYNTH_UnlockModule(); return S_OK; }
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) { DMSYNTH_LockModule(); return 2; /* non-heap based object */ }