winex11: Keep the result string in the IME UI window procedure.
[wine.git] / dlls / dmusic / clock.c
blob2086bfa3f1e1a61aaee4f06bd59e1f629cd71f78
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"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
25 static inline IReferenceClockImpl *impl_from_IReferenceClock(IReferenceClock *iface)
27 return CONTAINING_RECORD(iface, IReferenceClockImpl, IReferenceClock_iface);
30 /* IReferenceClockImpl IUnknown part: */
31 static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
33 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
34 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
36 if (IsEqualIID (riid, &IID_IUnknown) ||
37 IsEqualIID (riid, &IID_IReferenceClock)) {
38 IUnknown_AddRef(iface);
39 *ppobj = This;
40 return S_OK;
42 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
43 return E_NOINTERFACE;
46 static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface)
48 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
49 ULONG ref = InterlockedIncrement(&This->ref);
51 TRACE("(%p)->(): new ref = %u\n", This, ref);
53 return ref;
56 static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
58 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
59 ULONG ref = InterlockedDecrement(&This->ref);
61 TRACE("(%p)->(): new ref = %u\n", This, ref);
63 if (!ref) {
64 HeapFree(GetProcessHeap(), 0, This);
65 DMUSIC_UnlockModule();
68 return ref;
71 /* IReferenceClockImpl IReferenceClock part: */
72 static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME* pTime)
74 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
76 TRACE("(%p)->(%p)\n", This, pTime);
78 *pTime = This->rtTime;
80 return S_OK;
83 static HRESULT WINAPI IReferenceClockImpl_AdviseTime(IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie)
85 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
87 FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
89 return S_OK;
92 static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie)
94 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
96 FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
98 return S_OK;
101 static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie)
103 IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
105 FIXME("(%p)->(%d): stub\n", This, dwAdviseCookie);
107 return S_OK;
110 static const IReferenceClockVtbl ReferenceClock_Vtbl = {
111 IReferenceClockImpl_QueryInterface,
112 IReferenceClockImpl_AddRef,
113 IReferenceClockImpl_Release,
114 IReferenceClockImpl_GetTime,
115 IReferenceClockImpl_AdviseTime,
116 IReferenceClockImpl_AdvisePeriodic,
117 IReferenceClockImpl_Unadvise
120 /* for ClassFactory */
121 HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter)
123 IReferenceClockImpl* clock;
124 HRESULT hr;
126 TRACE("(%s, %p, %p)\n", debugstr_guid(riid), ret_iface, unkouter);
128 clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
129 if (!clock) {
130 *ret_iface = NULL;
131 return E_OUTOFMEMORY;
134 clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl;
135 clock->ref = 1;
136 clock->rtTime = 0;
137 clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
139 DMUSIC_LockModule();
140 hr = IReferenceClockImpl_QueryInterface(&clock->IReferenceClock_iface, riid, ret_iface);
141 IReferenceClock_Release(&clock->IReferenceClock_iface);
143 return hr;