d3d10/effect: Use case-insensitive comparison in GetMemberTypeBySemantic().
[wine.git] / dlls / dmusic / clock.c
blob8a4cc9112a732801c41ddcd1c92c90982fb7e0b0
1 /*
2 * IReferenceClock Implementation
4 * Copyright (C) 2003-2004 Rok Mandeljc
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "dmusic_private.h"
22 #include "dmobject.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
26 static inline IReferenceClockImpl *impl_from_IReferenceClock(IReferenceClock *iface)
28 return CONTAINING_RECORD(iface, IReferenceClockImpl, IReferenceClock_iface);
31 /* IReferenceClockImpl IUnknown part: */
32 static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
34 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
35 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
37 if (IsEqualIID (riid, &IID_IUnknown) ||
38 IsEqualIID (riid, &IID_IReferenceClock)) {
39 IUnknown_AddRef(iface);
40 *ppobj = This;
41 return S_OK;
43 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
44 return E_NOINTERFACE;
47 static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface)
49 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
50 ULONG ref = InterlockedIncrement(&This->ref);
52 TRACE("(%p)->(): new ref = %u\n", This, ref);
54 return ref;
57 static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
59 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
60 ULONG ref = InterlockedDecrement(&This->ref);
62 TRACE("(%p)->(): new ref = %u\n", This, ref);
64 if (!ref) {
65 HeapFree(GetProcessHeap(), 0, This);
66 DMUSIC_UnlockModule();
69 return ref;
72 /* IReferenceClockImpl IReferenceClock part: */
73 static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME* pTime)
75 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
77 TRACE("(%p)->(%p)\n", This, pTime);
79 *pTime = This->rtTime;
81 return S_OK;
84 static HRESULT WINAPI IReferenceClockImpl_AdviseTime(IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie)
86 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
88 FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
90 return S_OK;
93 static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie)
95 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
97 FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
99 return S_OK;
102 static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie)
104 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
106 FIXME("(%p)->(%d): stub\n", This, dwAdviseCookie);
108 return S_OK;
111 static const IReferenceClockVtbl ReferenceClock_Vtbl = {
112 IReferenceClockImpl_QueryInterface,
113 IReferenceClockImpl_AddRef,
114 IReferenceClockImpl_Release,
115 IReferenceClockImpl_GetTime,
116 IReferenceClockImpl_AdviseTime,
117 IReferenceClockImpl_AdvisePeriodic,
118 IReferenceClockImpl_Unadvise
121 /* for ClassFactory */
122 HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter)
124 IReferenceClockImpl* clock;
125 HRESULT hr;
127 TRACE("(%s, %p, %p)\n", debugstr_guid(riid), ret_iface, unkouter);
129 clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
130 if (!clock) {
131 *ret_iface = NULL;
132 return E_OUTOFMEMORY;
135 clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl;
136 clock->ref = 1;
137 clock->rtTime = 0;
138 clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
140 DMUSIC_LockModule();
141 hr = IReferenceClockImpl_QueryInterface(&clock->IReferenceClock_iface, riid, ret_iface);
142 IReferenceClock_Release(&clock->IReferenceClock_iface);
144 return hr;