Only do unicode conversion in HTML Help control when filename is
[wine] / dlls / dmcompos / chordmaptrack.c
1 /* IDirectMusicChordMapTrack Implementation
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
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
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include "dmcompos_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos);
23 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
24
25 /*****************************************************************************
26  * IDirectMusicChordMapTrack implementation
27  */
28 /* IDirectMusicChordMapTrack IUnknown part: */
29 HRESULT WINAPI IDirectMusicChordMapTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
30         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, UnknownVtbl, iface);
31         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
32
33         if (IsEqualIID (riid, &IID_IUnknown)) {
34                 *ppobj = (LPUNKNOWN)&This->UnknownVtbl;
35                 IDirectMusicChordMapTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
36                 return S_OK;
37         } else if (IsEqualIID (riid, &IID_IDirectMusicTrack)
38           || IsEqualIID (riid, &IID_IDirectMusicTrack8)) {
39                 *ppobj = (LPDIRECTMUSICTRACK8)&This->TrackVtbl;
40                 IDirectMusicChordMapTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8)&This->TrackVtbl);
41                 return S_OK;
42         } else if (IsEqualIID (riid, &IID_IPersistStream)) {
43                 *ppobj = (LPPERSISTSTREAM)&This->PersistStreamVtbl;
44                 IDirectMusicChordMapTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
45                 return S_OK;
46         }
47         
48         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
49         return E_NOINTERFACE;
50 }
51
52 ULONG WINAPI IDirectMusicChordMapTrack_IUnknown_AddRef (LPUNKNOWN iface) {
53         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, UnknownVtbl, iface);
54         ULONG ref = InterlockedIncrement(&This->ref);
55
56         TRACE("(%p): AddRef from %ld\n", This, ref - 1);
57         
58         DMCOMPOS_LockModule();
59         
60         return ref;
61 }
62
63 ULONG WINAPI IDirectMusicChordMapTrack_IUnknown_Release (LPUNKNOWN iface) {
64         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, UnknownVtbl, iface);
65         ULONG ref = InterlockedDecrement(&This->ref);
66
67         TRACE("(%p): ReleaseRef to %ld\n", This, ref);
68         
69         if (ref == 0) {
70                 HeapFree(GetProcessHeap(), 0, This);
71         }
72         
73         DMCOMPOS_UnlockModule();
74         
75         return ref;
76 }
77
78 IUnknownVtbl DirectMusicChordMapTrack_Unknown_Vtbl = {
79         IDirectMusicChordMapTrack_IUnknown_QueryInterface,
80         IDirectMusicChordMapTrack_IUnknown_AddRef,
81         IDirectMusicChordMapTrack_IUnknown_Release
82 };
83
84 /* IDirectMusicChordMapTrack IDirectMusicTrack8 part: */
85 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) {
86         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
87         return IDirectMusicChordMapTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
88 }
89
90 ULONG WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface) {
91         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
92         return IDirectMusicChordMapTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
93 }
94
95 ULONG WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface) {
96         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
97         return IDirectMusicChordMapTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
98 }
99
100 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) {
101         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
102         FIXME("(%p, %p): stub\n", This, pSegment);
103         return S_OK;
104 }
105
106 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) {
107         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
108         FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
109         return S_OK;
110 }
111
112 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) {
113         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
114         FIXME("(%p, %p): stub\n", This, pStateData);
115         return S_OK;
116 }
117
118 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) {
119         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
120         FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
121         return S_OK;
122 }
123
124 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
125         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
126         FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
127         return S_OK;
128 }
129
130 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) {
131         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
132         FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
133         return S_OK;
134 }
135
136 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) {
137         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
138         TRACE("(%p, %s): ", This, debugstr_dmguid(rguidType));
139         if (IsEqualGUID (rguidType, &GUID_IDirectMusicChordMap)) {
140                 TRACE("param supported\n");
141                 return S_OK;
142         }
143         TRACE("param unsupported\n");
144         return DMUS_E_TYPE_UNSUPPORTED;
145 }
146
147 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
148         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
149         FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
150         return S_OK;
151 }
152
153 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
154         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
155         FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
156         return S_OK;
157 }
158
159 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) {
160         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
161         FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack);
162         return S_OK;
163 }
164
165 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) {
166         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
167         FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
168         return S_OK;
169 }
170
171 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
172         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
173         FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags);
174         return S_OK;
175 }
176
177 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
178         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
179         FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, pParam, pStateData, dwFlags);
180         return S_OK;
181 }
182
183 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
184         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
185         FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
186         return S_OK;
187 }
188
189 HRESULT WINAPI IDirectMusicChordMapTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
190         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, TrackVtbl, iface);
191         FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
192         return S_OK;
193 }
194
195 IDirectMusicTrack8Vtbl DirectMusicChordMapTrack_Track_Vtbl = {
196         IDirectMusicChordMapTrack_IDirectMusicTrack_QueryInterface,
197         IDirectMusicChordMapTrack_IDirectMusicTrack_AddRef,
198         IDirectMusicChordMapTrack_IDirectMusicTrack_Release,
199         IDirectMusicChordMapTrack_IDirectMusicTrack_Init,
200         IDirectMusicChordMapTrack_IDirectMusicTrack_InitPlay,
201         IDirectMusicChordMapTrack_IDirectMusicTrack_EndPlay,
202         IDirectMusicChordMapTrack_IDirectMusicTrack_Play,
203         IDirectMusicChordMapTrack_IDirectMusicTrack_GetParam,
204         IDirectMusicChordMapTrack_IDirectMusicTrack_SetParam,
205         IDirectMusicChordMapTrack_IDirectMusicTrack_IsParamSupported,
206         IDirectMusicChordMapTrack_IDirectMusicTrack_AddNotificationType,
207         IDirectMusicChordMapTrack_IDirectMusicTrack_RemoveNotificationType,
208         IDirectMusicChordMapTrack_IDirectMusicTrack_Clone,
209         IDirectMusicChordMapTrack_IDirectMusicTrack_PlayEx,
210         IDirectMusicChordMapTrack_IDirectMusicTrack_GetParamEx,
211         IDirectMusicChordMapTrack_IDirectMusicTrack_SetParamEx,
212         IDirectMusicChordMapTrack_IDirectMusicTrack_Compose,
213         IDirectMusicChordMapTrack_IDirectMusicTrack_Join
214 };
215
216 /* IDirectMusicChordMapTrack IPersistStream part: */
217 HRESULT WINAPI IDirectMusicChordMapTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
218         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, PersistStreamVtbl, iface);
219         return IDirectMusicChordMapTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
220 }
221
222 ULONG WINAPI IDirectMusicChordMapTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
223         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, PersistStreamVtbl, iface);
224         return IDirectMusicChordMapTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
225 }
226
227 ULONG WINAPI IDirectMusicChordMapTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
228         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, PersistStreamVtbl, iface);
229         return IDirectMusicChordMapTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
230 }
231
232 HRESULT WINAPI IDirectMusicChordMapTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
233         return E_NOTIMPL;
234 }
235
236 HRESULT WINAPI IDirectMusicChordMapTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
237         return E_NOTIMPL;
238 }
239
240 HRESULT WINAPI IDirectMusicChordMapTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
241         ICOM_THIS_MULTI(IDirectMusicChordMapTrack, PersistStreamVtbl, iface);
242         FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
243         return S_OK;
244 }
245
246 HRESULT WINAPI IDirectMusicChordMapTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
247         return E_NOTIMPL;
248 }
249
250 HRESULT WINAPI IDirectMusicChordMapTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
251         return E_NOTIMPL;
252 }
253
254 IPersistStreamVtbl DirectMusicChordMapTrack_PersistStream_Vtbl = {
255         IDirectMusicChordMapTrack_IPersistStream_QueryInterface,
256         IDirectMusicChordMapTrack_IPersistStream_AddRef,
257         IDirectMusicChordMapTrack_IPersistStream_Release,
258         IDirectMusicChordMapTrack_IPersistStream_GetClassID,
259         IDirectMusicChordMapTrack_IPersistStream_IsDirty,
260         IDirectMusicChordMapTrack_IPersistStream_Load,
261         IDirectMusicChordMapTrack_IPersistStream_Save,
262         IDirectMusicChordMapTrack_IPersistStream_GetSizeMax
263 };
264
265 /* for ClassFactory */
266 HRESULT WINAPI DMUSIC_CreateDirectMusicChordMapTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
267         IDirectMusicChordMapTrack* track;
268         
269         track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapTrack));
270         if (NULL == track) {
271                 *ppobj = NULL;
272                 return E_OUTOFMEMORY;
273         }
274         track->UnknownVtbl = &DirectMusicChordMapTrack_Unknown_Vtbl;
275         track->TrackVtbl = &DirectMusicChordMapTrack_Track_Vtbl;
276         track->PersistStreamVtbl = &DirectMusicChordMapTrack_PersistStream_Vtbl;
277         track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
278         DM_STRUCT_INIT(track->pDesc);
279         track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
280         memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicChordMapTrack, sizeof (CLSID));
281         track->ref = 0; /* will be inited by QueryInterface */
282         
283         return IDirectMusicChordMapTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);
284 }