wined3d: No longer make sub-resources full resources.
[wine.git] / dlls / dmime / timesigtrack.c
blob9bd7450264a02aca9c0b2c86ae24138584df33aa
1 /* IDirectMusicTimeSigTrack Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "dmime_private.h"
21 #include "dmobject.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
25 /*****************************************************************************
26 * IDirectMusicTimeSigTrack implementation
28 typedef struct IDirectMusicTimeSigTrack {
29 IDirectMusicTrack IDirectMusicTrack_iface;
30 struct dmobject dmobj; /* IPersistStream only */
31 LONG ref;
32 } IDirectMusicTimeSigTrack;
34 /* IDirectMusicTimeSigTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicTimeSigTrack *impl_from_IDirectMusicTrack(IDirectMusicTrack *iface)
37 return CONTAINING_RECORD(iface, IDirectMusicTimeSigTrack, IDirectMusicTrack_iface);
40 static HRESULT WINAPI IDirectMusicTrackImpl_QueryInterface(IDirectMusicTrack *iface, REFIID riid,
41 void **ret_iface)
43 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
45 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface);
47 *ret_iface = NULL;
49 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack))
50 *ret_iface = iface;
51 else if (IsEqualIID(riid, &IID_IPersistStream))
52 *ret_iface = &This->dmobj.IPersistStream_iface;
53 else {
54 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
55 return E_NOINTERFACE;
58 IUnknown_AddRef((IUnknown*)*ret_iface);
59 return S_OK;
62 static ULONG WINAPI IDirectMusicTrackImpl_AddRef(IDirectMusicTrack *iface)
64 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
65 LONG ref = InterlockedIncrement(&This->ref);
67 TRACE("(%p) ref=%d\n", This, ref);
69 return ref;
72 static ULONG WINAPI IDirectMusicTrackImpl_Release(IDirectMusicTrack *iface)
74 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
75 LONG ref = InterlockedDecrement(&This->ref);
77 TRACE("(%p) ref=%d\n", This, ref);
79 if (!ref) {
80 HeapFree(GetProcessHeap(), 0, This);
81 DMIME_UnlockModule();
84 return ref;
87 static HRESULT WINAPI IDirectMusicTrackImpl_Init(IDirectMusicTrack *iface,
88 IDirectMusicSegment *pSegment)
90 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
91 FIXME("(%p, %p): stub\n", This, pSegment);
92 return S_OK;
95 static HRESULT WINAPI IDirectMusicTrackImpl_InitPlay(IDirectMusicTrack *iface,
96 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
97 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
99 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
100 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
101 return S_OK;
104 static HRESULT WINAPI IDirectMusicTrackImpl_EndPlay(IDirectMusicTrack *iface, void *pStateData)
106 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
107 FIXME("(%p, %p): stub\n", This, pStateData);
108 return S_OK;
111 static HRESULT WINAPI IDirectMusicTrackImpl_Play(IDirectMusicTrack *iface, void *pStateData,
112 MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags,
113 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
115 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
116 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
117 return S_OK;
120 static HRESULT WINAPI IDirectMusicTrackImpl_GetParam(IDirectMusicTrack *iface, REFGUID rguidType,
121 MUSIC_TIME mtTime, MUSIC_TIME *pmtNext, void *pParam)
123 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
124 FIXME("(%p, %s, %d, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
125 return S_OK;
128 static HRESULT WINAPI IDirectMusicTrackImpl_SetParam(IDirectMusicTrack *iface, REFGUID rguidType,
129 MUSIC_TIME mtTime, void *pParam)
131 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
132 FIXME("(%p, %s, %d, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
133 return S_OK;
136 static HRESULT WINAPI IDirectMusicTrackImpl_IsParamSupported(IDirectMusicTrack *iface,
137 REFGUID rguidType)
139 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
141 TRACE("(%p, %s)\n", This, debugstr_dmguid(rguidType));
142 if (IsEqualGUID (rguidType, &GUID_DisableTimeSig)
143 || IsEqualGUID (rguidType, &GUID_EnableTimeSig)
144 || IsEqualGUID (rguidType, &GUID_TimeSignature)) {
145 TRACE("param supported\n");
146 return S_OK;
148 TRACE("param unsupported\n");
149 return DMUS_E_TYPE_UNSUPPORTED;
152 static HRESULT WINAPI IDirectMusicTrackImpl_AddNotificationType(IDirectMusicTrack *iface,
153 REFGUID rguidNotificationType)
155 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
156 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
157 return S_OK;
160 static HRESULT WINAPI IDirectMusicTrackImpl_RemoveNotificationType(IDirectMusicTrack *iface,
161 REFGUID rguidNotificationType)
163 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
164 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
165 return S_OK;
168 static HRESULT WINAPI IDirectMusicTrackImpl_Clone(IDirectMusicTrack *iface, MUSIC_TIME mtStart,
169 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
171 IDirectMusicTimeSigTrack *This = impl_from_IDirectMusicTrack(iface);
172 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
173 return S_OK;
176 static const IDirectMusicTrackVtbl dmtack_vtbl = {
177 IDirectMusicTrackImpl_QueryInterface,
178 IDirectMusicTrackImpl_AddRef,
179 IDirectMusicTrackImpl_Release,
180 IDirectMusicTrackImpl_Init,
181 IDirectMusicTrackImpl_InitPlay,
182 IDirectMusicTrackImpl_EndPlay,
183 IDirectMusicTrackImpl_Play,
184 IDirectMusicTrackImpl_GetParam,
185 IDirectMusicTrackImpl_SetParam,
186 IDirectMusicTrackImpl_IsParamSupported,
187 IDirectMusicTrackImpl_AddNotificationType,
188 IDirectMusicTrackImpl_RemoveNotificationType,
189 IDirectMusicTrackImpl_Clone
192 static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
194 FIXME(": Loading not implemented yet\n");
195 return S_OK;
198 static const IPersistStreamVtbl persiststream_vtbl = {
199 dmobj_IPersistStream_QueryInterface,
200 dmobj_IPersistStream_AddRef,
201 dmobj_IPersistStream_Release,
202 dmobj_IPersistStream_GetClassID,
203 unimpl_IPersistStream_IsDirty,
204 IPersistStreamImpl_Load,
205 unimpl_IPersistStream_Save,
206 unimpl_IPersistStream_GetSizeMax
209 /* for ClassFactory */
210 HRESULT WINAPI create_dmtimesigtrack(REFIID lpcGUID, void **ppobj)
212 IDirectMusicTimeSigTrack *track;
213 HRESULT hr;
215 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
216 if (!track) {
217 *ppobj = NULL;
218 return E_OUTOFMEMORY;
220 track->IDirectMusicTrack_iface.lpVtbl = &dmtack_vtbl;
221 track->ref = 1;
222 dmobject_init(&track->dmobj, &CLSID_DirectMusicTimeSigTrack,
223 (IUnknown *)&track->IDirectMusicTrack_iface);
224 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
226 DMIME_LockModule();
227 hr = IDirectMusicTrack_QueryInterface(&track->IDirectMusicTrack_iface, lpcGUID, ppobj);
228 IDirectMusicTrack_Release(&track->IDirectMusicTrack_iface);
230 return hr;