Fix SetDataFormat and implement GetDeviceInfo for mouse device.
[wine] / dlls / dmusic / dmusic_performance.c
1 /* IDirectMusicPerformance Implementation
2  * IDirectMusicPerformance8 Implementation
3  *
4  * Copyright (C) 2003 Rok Mandeljc
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
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
14  * GNU Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20
21 #include "windef.h"
22 #include "winbase.h"
23 #include "winuser.h"
24 #include "wingdi.h"
25 #include "wine/debug.h"
26
27 #include "dmusic_private.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
30
31 /* IDirectMusicPerformance IUnknown parts follow: */
32 HRESULT WINAPI IDirectMusicPerformanceImpl_QueryInterface (LPDIRECTMUSICPERFORMANCE iface, REFIID riid, LPVOID *ppobj)
33 {
34         ICOM_THIS(IDirectMusicPerformanceImpl,iface);
35
36         if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPerformance))
37         {
38                 IDirectMusicPerformanceImpl_AddRef(iface);
39                 *ppobj = This;
40                 return DS_OK;
41         }
42         WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
43         return E_NOINTERFACE;
44 }
45
46 ULONG WINAPI IDirectMusicPerformanceImpl_AddRef (LPDIRECTMUSICPERFORMANCE iface)
47 {
48         ICOM_THIS(IDirectMusicPerformanceImpl,iface);
49         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
50         return ++(This->ref);
51 }
52
53 ULONG WINAPI IDirectMusicPerformanceImpl_Release (LPDIRECTMUSICPERFORMANCE iface)
54 {
55         ICOM_THIS(IDirectMusicPerformanceImpl,iface);
56         ULONG ref = --This->ref;
57         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
58         if (ref == 0)
59         {
60                 HeapFree(GetProcessHeap(), 0, This);
61         }
62         return ref;
63 }
64
65 /* IDirectMusicPerformance Interface follow: */
66 HRESULT WINAPI IDirectMusicPerformanceImpl_Init (LPDIRECTMUSICPERFORMANCE iface, IDirectMusic** ppDirectMusic, LPDIRECTSOUND pDirectSound, HWND hWnd)
67 {
68         ICOM_THIS(IDirectMusicPerformanceImpl,iface);
69         FIXME("(iface = %p, dmusic = %p (*dmusic = %p), dsound = %p, hwnd = %p): semi-stub\n", This, ppDirectMusic, *ppDirectMusic, pDirectSound, hWnd);
70         
71         /* app creates it's own dmusic object and gives it to performance */
72         if (*ppDirectMusic)
73         {
74                 TRACE("App provides DirectMusic\n");
75                 /* FIXME: is this correct? */
76                 memcpy((LPDIRECTMUSIC)This->dmusic, *ppDirectMusic, sizeof(*ppDirectMusic));
77                 IDirectMusicImpl_AddRef((LPDIRECTMUSIC)This->dmusic);
78                 /* app is supposed to be in charge of everything else */
79                 return S_OK;
80         }
81         /* app allows the performance to initialise itfself and needs a pointer to object*/
82         if (!*ppDirectMusic)
83         {
84                 TRACE("DirectMusic to be created; needed\n");
85                 if (!This->dmusic)
86                         DMUSIC_CreateDirectMusic(&IID_IDirectMusic, (LPDIRECTMUSIC*)&This->dmusic, NULL);
87                 *ppDirectMusic = (LPDIRECTMUSIC)This->dmusic;
88                 if (*ppDirectMusic)
89                         IDirectMusicImpl_AddRef(*ppDirectMusic);
90         }
91         /* app allows the performance to initialise itself and does not need a pointer to object*/
92         if (!ppDirectMusic)
93         {
94                 TRACE("DirectMusic to be created; not needed\n");
95         }
96         
97         return S_OK;
98 }
99
100 HRESULT WINAPI IDirectMusicPerformanceImpl_PlaySegment (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicSegment* pSegment, DWORD dwFlags, __int64 i64StartTime, IDirectMusicSegmentState** ppSegmentState)
101 {
102         FIXME("stub\n");
103         return S_OK;
104 }
105
106 HRESULT WINAPI IDirectMusicPerformanceImpl_Stop (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicSegment* pSegment, IDirectMusicSegmentState* pSegmentState, MUSIC_TIME mtTime, DWORD dwFlags)
107 {
108         FIXME("stub\n");
109         return DS_OK;
110 }
111
112 HRESULT WINAPI IDirectMusicPerformanceImpl_GetSegmentState (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicSegmentState** ppSegmentState, MUSIC_TIME mtTime)
113 {
114         FIXME("stub\n");
115         return DS_OK;
116 }
117
118 HRESULT WINAPI IDirectMusicPerformanceImpl_SetPrepareTime (LPDIRECTMUSICPERFORMANCE iface, DWORD dwMilliSeconds)
119 {
120         FIXME("stub\n");
121         return DS_OK;
122 }
123
124 HRESULT WINAPI IDirectMusicPerformanceImpl_GetPrepareTime (LPDIRECTMUSICPERFORMANCE iface, DWORD* pdwMilliSeconds)
125 {
126         FIXME("stub\n");
127         return DS_OK;
128 }
129
130 HRESULT WINAPI IDirectMusicPerformanceImpl_SetBumperLength (LPDIRECTMUSICPERFORMANCE iface, DWORD dwMilliSeconds)
131 {
132         FIXME("stub\n");
133         return DS_OK;
134 }
135
136 HRESULT WINAPI IDirectMusicPerformanceImpl_GetBumperLength (LPDIRECTMUSICPERFORMANCE iface, DWORD* pdwMilliSeconds)
137 {
138         FIXME("stub\n");
139         return DS_OK;
140 }
141
142 HRESULT WINAPI IDirectMusicPerformanceImpl_SendPMsg (LPDIRECTMUSICPERFORMANCE iface, DMUS_PMSG* pPMSG)
143 {
144         FIXME("stub\n");
145         return DS_OK;
146 }
147
148 HRESULT WINAPI IDirectMusicPerformanceImpl_MusicToReferenceTime (LPDIRECTMUSICPERFORMANCE iface, MUSIC_TIME mtTime, REFERENCE_TIME* prtTime)
149 {
150         FIXME("stub\n");
151         return DS_OK;
152 }
153
154 HRESULT WINAPI IDirectMusicPerformanceImpl_ReferenceToMusicTime (LPDIRECTMUSICPERFORMANCE iface, REFERENCE_TIME rtTime, MUSIC_TIME* pmtTime)
155 {
156         FIXME("stub\n");
157         return DS_OK;
158 }
159
160 HRESULT WINAPI IDirectMusicPerformanceImpl_IsPlaying (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicSegment* pSegment, IDirectMusicSegmentState* pSegState)
161 {
162         FIXME("stub\n");
163         return DS_OK;
164 }
165
166 HRESULT WINAPI IDirectMusicPerformanceImpl_GetTime (LPDIRECTMUSICPERFORMANCE iface, REFERENCE_TIME* prtNow, MUSIC_TIME* pmtNow)
167 {
168         FIXME("stub\n");
169         return DS_OK;
170 }
171
172 HRESULT WINAPI IDirectMusicPerformanceImpl_AllocPMsg (LPDIRECTMUSICPERFORMANCE iface, ULONG cb, DMUS_PMSG** ppPMSG)
173 {
174         FIXME("stub\n");
175         return DS_OK;
176 }
177
178 HRESULT WINAPI IDirectMusicPerformanceImpl_FreePMsg (LPDIRECTMUSICPERFORMANCE iface, DMUS_PMSG* pPMSG)
179 {
180         FIXME("stub\n");
181         return DS_OK;
182 }
183
184 HRESULT WINAPI IDirectMusicPerformanceImpl_GetGraph (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicGraph** ppGraph)
185 {
186         FIXME("stub\n");
187         return DS_OK;
188 }
189
190 HRESULT WINAPI IDirectMusicPerformanceImpl_SetGraph (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicGraph* pGraph)
191 {
192         FIXME("stub\n");
193         return DS_OK;
194 }
195
196 HRESULT WINAPI IDirectMusicPerformanceImpl_SetNotificationHandle (LPDIRECTMUSICPERFORMANCE iface, HANDLE hNotification, REFERENCE_TIME rtMinimum)
197 {
198         FIXME("stub\n");
199         return DS_OK;
200 }
201
202 HRESULT WINAPI IDirectMusicPerformanceImpl_GetNotificationPMsg (LPDIRECTMUSICPERFORMANCE iface, DMUS_NOTIFICATION_PMSG** ppNotificationPMsg)
203 {
204         FIXME("stub\n");
205         return DS_OK;
206 }
207
208 HRESULT WINAPI IDirectMusicPerformanceImpl_AddNotificationType (LPDIRECTMUSICPERFORMANCE iface, REFGUID rguidNotificationType)
209 {
210         FIXME("stub\n");
211         return DS_OK;
212 }
213
214 HRESULT WINAPI IDirectMusicPerformanceImpl_RemoveNotificationType (LPDIRECTMUSICPERFORMANCE iface, REFGUID rguidNotificationType)
215 {
216         FIXME("stub\n");
217         return DS_OK;
218 }
219
220 HRESULT WINAPI IDirectMusicPerformanceImpl_AddPort (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicPort* pPort)
221 {
222         ICOM_THIS(IDirectMusicPerformanceImpl,iface);
223         
224         FIXME("(%p, %p): stub\n", This, pPort);
225         
226         return DMUS_E_CANNOT_OPEN_PORT;
227 }
228
229 HRESULT WINAPI IDirectMusicPerformanceImpl_RemovePort (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicPort* pPort)
230 {
231         FIXME("stub\n");
232         return DS_OK;
233 }
234
235 HRESULT WINAPI IDirectMusicPerformanceImpl_AssignPChannelBlock (LPDIRECTMUSICPERFORMANCE iface, DWORD dwBlockNum, IDirectMusicPort* pPort, DWORD dwGroup)
236 {
237         ICOM_THIS(IDirectMusicPerformanceImpl,iface);   
238
239         FIXME("(%p, %ld, %p, %ld): stub\n", This, dwBlockNum, pPort, dwGroup);
240
241         return E_INVALIDARG;
242 }
243
244 HRESULT WINAPI IDirectMusicPerformanceImpl_AssignPChannel (LPDIRECTMUSICPERFORMANCE iface, DWORD dwPChannel, IDirectMusicPort* pPort, DWORD dwGroup, DWORD dwMChannel)
245 {
246         FIXME("stub\n");
247         return DS_OK;
248 }
249
250 HRESULT WINAPI IDirectMusicPerformanceImpl_PChannelInfo (LPDIRECTMUSICPERFORMANCE iface, DWORD dwPChannel, IDirectMusicPort** ppPort, DWORD* pdwGroup, DWORD* pdwMChannel)
251 {
252         FIXME("stub\n");
253         return DS_OK;
254 }
255
256 HRESULT WINAPI IDirectMusicPerformanceImpl_DownloadInstrument (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicInstrument* pInst, DWORD dwPChannel, IDirectMusicDownloadedInstrument** ppDownInst, DMUS_NOTERANGE* pNoteRanges, DWORD dwNumNoteRanges, IDirectMusicPort** ppPort, DWORD* pdwGroup, DWORD* pdwMChannel)
257 {
258         FIXME("stub\n");
259         return DS_OK;
260 }
261
262 HRESULT WINAPI IDirectMusicPerformanceImpl_Invalidate (LPDIRECTMUSICPERFORMANCE iface, MUSIC_TIME mtTime, DWORD dwFlags)
263 {
264         FIXME("stub\n");
265         return DS_OK;
266 }
267
268 HRESULT WINAPI IDirectMusicPerformanceImpl_GetParam (LPDIRECTMUSICPERFORMANCE iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam)
269 {
270         FIXME("stub\n");
271         return DS_OK;
272 }
273
274 HRESULT WINAPI IDirectMusicPerformanceImpl_SetParam (LPDIRECTMUSICPERFORMANCE iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, void* pParam)
275 {
276         FIXME("stub\n");
277         return DS_OK;
278 }
279
280 HRESULT WINAPI IDirectMusicPerformanceImpl_GetGlobalParam (LPDIRECTMUSICPERFORMANCE iface, REFGUID rguidType, void* pParam, DWORD dwSize)
281 {
282         FIXME("stub\n");
283         return DS_OK;
284 }
285
286 HRESULT WINAPI IDirectMusicPerformanceImpl_SetGlobalParam (LPDIRECTMUSICPERFORMANCE iface, REFGUID rguidType, void* pParam, DWORD dwSize)
287 {
288         FIXME("stub\n");
289         return DS_OK;
290 }
291
292 HRESULT WINAPI IDirectMusicPerformanceImpl_GetLatencyTime (LPDIRECTMUSICPERFORMANCE iface, REFERENCE_TIME* prtTime)
293 {
294         FIXME("stub\n");
295         return DS_OK;
296 }
297
298 HRESULT WINAPI IDirectMusicPerformanceImpl_GetQueueTime (LPDIRECTMUSICPERFORMANCE iface, REFERENCE_TIME* prtTime)
299 {
300         FIXME("stub\n");
301         return DS_OK;
302 }
303
304 HRESULT WINAPI IDirectMusicPerformanceImpl_AdjustTime (LPDIRECTMUSICPERFORMANCE iface, REFERENCE_TIME rtAmount)
305 {
306         FIXME("stub\n");
307         return DS_OK;
308 }
309
310 HRESULT WINAPI IDirectMusicPerformanceImpl_CloseDown (LPDIRECTMUSICPERFORMANCE iface)
311 {
312         ICOM_THIS(IDirectMusicPerformanceImpl,iface);
313         FIXME("(%p): semi-stub\n", This);
314         return S_OK;
315 }
316
317 HRESULT WINAPI IDirectMusicPerformanceImpl_GetResolvedTime (LPDIRECTMUSICPERFORMANCE iface, REFERENCE_TIME rtTime, REFERENCE_TIME* prtResolved, DWORD dwTimeResolveFlags)
318 {
319         FIXME("stub\n");
320         return DS_OK;
321 }
322
323 HRESULT WINAPI IDirectMusicPerformanceImpl_MIDIToMusic (LPDIRECTMUSICPERFORMANCE iface, BYTE bMIDIValue, DMUS_CHORD_KEY* pChord, BYTE bPlayMode, BYTE bChordLevel, WORD* pwMusicValue)
324 {
325         FIXME("stub\n");
326         return DS_OK;
327 }
328
329 HRESULT WINAPI IDirectMusicPerformanceImpl_MusicToMIDI (LPDIRECTMUSICPERFORMANCE iface, WORD wMusicValue, DMUS_CHORD_KEY* pChord, BYTE bPlayMode, BYTE bChordLevel, BYTE* pbMIDIValue)
330 {
331         FIXME("stub\n");
332         return DS_OK;
333 }
334
335 HRESULT WINAPI IDirectMusicPerformanceImpl_TimeToRhythm (LPDIRECTMUSICPERFORMANCE iface, MUSIC_TIME mtTime, DMUS_TIMESIGNATURE* pTimeSig, WORD* pwMeasure, BYTE* pbBeat, BYTE* pbGrid, short* pnOffset)
336 {
337         FIXME("stub\n");
338         return DS_OK;
339 }
340
341 HRESULT WINAPI IDirectMusicPerformanceImpl_RhythmToTime (LPDIRECTMUSICPERFORMANCE iface, WORD wMeasure, BYTE bBeat, BYTE bGrid, short nOffset, DMUS_TIMESIGNATURE* pTimeSig, MUSIC_TIME* pmtTime)
342 {
343         FIXME("stub\n");
344         return DS_OK;
345 }
346
347 ICOM_VTABLE(IDirectMusicPerformance) DirectMusicPerformance_Vtbl =
348 {
349     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
350         IDirectMusicPerformanceImpl_QueryInterface,
351         IDirectMusicPerformanceImpl_AddRef,
352         IDirectMusicPerformanceImpl_Release,
353         IDirectMusicPerformanceImpl_Init,
354         IDirectMusicPerformanceImpl_PlaySegment,
355         IDirectMusicPerformanceImpl_Stop,
356         IDirectMusicPerformanceImpl_GetSegmentState,
357         IDirectMusicPerformanceImpl_SetPrepareTime,
358         IDirectMusicPerformanceImpl_GetPrepareTime,
359         IDirectMusicPerformanceImpl_SetBumperLength,
360         IDirectMusicPerformanceImpl_GetBumperLength,
361         IDirectMusicPerformanceImpl_SendPMsg,
362         IDirectMusicPerformanceImpl_MusicToReferenceTime,
363         IDirectMusicPerformanceImpl_ReferenceToMusicTime,
364         IDirectMusicPerformanceImpl_IsPlaying,
365         IDirectMusicPerformanceImpl_GetTime,
366         IDirectMusicPerformanceImpl_AllocPMsg,
367         IDirectMusicPerformanceImpl_FreePMsg,
368         IDirectMusicPerformanceImpl_GetGraph,
369         IDirectMusicPerformanceImpl_SetGraph,
370         IDirectMusicPerformanceImpl_SetNotificationHandle,
371         IDirectMusicPerformanceImpl_GetNotificationPMsg,
372         IDirectMusicPerformanceImpl_AddNotificationType,
373         IDirectMusicPerformanceImpl_RemoveNotificationType,
374         IDirectMusicPerformanceImpl_AddPort,
375         IDirectMusicPerformanceImpl_RemovePort,
376         IDirectMusicPerformanceImpl_AssignPChannelBlock,
377         IDirectMusicPerformanceImpl_AssignPChannel,
378         IDirectMusicPerformanceImpl_PChannelInfo,
379         IDirectMusicPerformanceImpl_DownloadInstrument,
380         IDirectMusicPerformanceImpl_Invalidate,
381         IDirectMusicPerformanceImpl_GetParam,
382         IDirectMusicPerformanceImpl_SetParam,
383         IDirectMusicPerformanceImpl_GetGlobalParam,
384         IDirectMusicPerformanceImpl_SetGlobalParam,
385         IDirectMusicPerformanceImpl_GetLatencyTime,
386         IDirectMusicPerformanceImpl_GetQueueTime,
387         IDirectMusicPerformanceImpl_AdjustTime,
388         IDirectMusicPerformanceImpl_CloseDown,
389         IDirectMusicPerformanceImpl_GetResolvedTime,
390         IDirectMusicPerformanceImpl_MIDIToMusic,
391         IDirectMusicPerformanceImpl_MusicToMIDI,
392         IDirectMusicPerformanceImpl_TimeToRhythm,
393         IDirectMusicPerformanceImpl_RhythmToTime
394 };
395
396 /* for ClassFactory */
397 HRESULT WINAPI DMUSIC_CreateDirectMusicPerformance (LPCGUID lpcGUID, LPDIRECTMUSICPERFORMANCE *ppDMPerf, LPUNKNOWN pUnkOuter)
398 {
399         IDirectMusicPerformanceImpl *pPerf;
400
401         TRACE("(%p,%p,%p)\n",lpcGUID, ppDMPerf, pUnkOuter);
402         if (IsEqualGUID(lpcGUID, &IID_IDirectMusicPerformance))
403         {
404                 pPerf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPerformanceImpl));
405                 if (NULL == pPerf)
406                 {
407                         *ppDMPerf = (LPDIRECTMUSICPERFORMANCE)NULL;
408                         return E_OUTOFMEMORY;
409                 }
410                 pPerf->lpVtbl = &DirectMusicPerformance_Vtbl;
411                 pPerf->ref = 1;
412                 *ppDMPerf = (LPDIRECTMUSICPERFORMANCE)pPerf;
413                 return S_OK;
414         }
415         WARN("No interface found\n");
416         
417         return E_NOINTERFACE;
418 }
419
420
421 /* IDirectMusicPerformance8 IUnknown parts follow: */
422 HRESULT WINAPI IDirectMusicPerformance8Impl_QueryInterface (LPDIRECTMUSICPERFORMANCE8 iface, REFIID riid, LPVOID *ppobj)
423 {
424         ICOM_THIS(IDirectMusicPerformance8Impl,iface);
425
426         if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPerformance8))
427         {
428                 IDirectMusicPerformance8Impl_AddRef(iface);
429                 *ppobj = This;
430                 return DS_OK;
431         }
432         WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
433         return E_NOINTERFACE;
434 }
435
436 ULONG WINAPI IDirectMusicPerformance8Impl_AddRef (LPDIRECTMUSICPERFORMANCE8 iface)
437 {
438         ICOM_THIS(IDirectMusicPerformance8Impl,iface);
439         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
440         return ++(This->ref);
441 }
442
443 ULONG WINAPI IDirectMusicPerformance8Impl_Release (LPDIRECTMUSICPERFORMANCE8 iface)
444 {
445         ICOM_THIS(IDirectMusicPerformance8Impl,iface);
446         ULONG ref = --This->ref;
447         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
448         if (ref == 0)
449         {
450                 HeapFree(GetProcessHeap(), 0, This);
451         }
452         return ref;
453 }
454
455 /* IDirectMusicPerformance Interface part follow: */
456 HRESULT WINAPI IDirectMusicPerformance8Impl_Init (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusic** ppDirectMusic, LPDIRECTSOUND pDirectSound, HWND hWnd)
457 {
458         FIXME("stub\n");
459         return DS_OK;
460 }
461
462 HRESULT WINAPI IDirectMusicPerformance8Impl_PlaySegment (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicSegment* pSegment, DWORD dwFlags, __int64 i64StartTime, IDirectMusicSegmentState** ppSegmentState)
463 {
464         FIXME("stub\n");
465         return DS_OK;
466 }
467
468 HRESULT WINAPI IDirectMusicPerformance8Impl_Stop (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicSegment* pSegment, IDirectMusicSegmentState* pSegmentState, MUSIC_TIME mtTime, DWORD dwFlags)
469 {
470         FIXME("stub\n");
471         return DS_OK;
472 }
473
474 HRESULT WINAPI IDirectMusicPerformance8Impl_GetSegmentState (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicSegmentState** ppSegmentState, MUSIC_TIME mtTime)
475 {
476         FIXME("stub\n");
477         return DS_OK;
478 }
479
480 HRESULT WINAPI IDirectMusicPerformance8Impl_SetPrepareTime (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwMilliSeconds)
481 {
482         FIXME("stub\n");
483         return DS_OK;
484 }
485
486 HRESULT WINAPI IDirectMusicPerformance8Impl_GetPrepareTime (LPDIRECTMUSICPERFORMANCE8 iface, DWORD* pdwMilliSeconds)
487 {
488         FIXME("stub\n");
489         return DS_OK;
490 }
491
492 HRESULT WINAPI IDirectMusicPerformance8Impl_SetBumperLength (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwMilliSeconds)
493 {
494         FIXME("stub\n");
495         return DS_OK;
496 }
497
498 HRESULT WINAPI IDirectMusicPerformance8Impl_GetBumperLength (LPDIRECTMUSICPERFORMANCE8 iface, DWORD* pdwMilliSeconds)
499 {
500         FIXME("stub\n");
501         return DS_OK;
502 }
503
504 HRESULT WINAPI IDirectMusicPerformance8Impl_SendPMsg (LPDIRECTMUSICPERFORMANCE8 iface, DMUS_PMSG* pPMSG)
505 {
506         FIXME("stub\n");
507         return DS_OK;
508 }
509
510 HRESULT WINAPI IDirectMusicPerformance8Impl_MusicToReferenceTime (LPDIRECTMUSICPERFORMANCE8 iface, MUSIC_TIME mtTime, REFERENCE_TIME* prtTime)
511 {
512         FIXME("stub\n");
513         return DS_OK;
514 }
515
516 HRESULT WINAPI IDirectMusicPerformance8Impl_ReferenceToMusicTime (LPDIRECTMUSICPERFORMANCE8 iface, REFERENCE_TIME rtTime, MUSIC_TIME* pmtTime)
517 {
518         FIXME("stub\n");
519         return DS_OK;
520 }
521
522 HRESULT WINAPI IDirectMusicPerformance8Impl_IsPlaying (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicSegment* pSegment, IDirectMusicSegmentState* pSegState)
523 {
524         FIXME("stub\n");
525         return DS_OK;
526 }
527
528 HRESULT WINAPI IDirectMusicPerformance8Impl_GetTime (LPDIRECTMUSICPERFORMANCE8 iface, REFERENCE_TIME* prtNow, MUSIC_TIME* pmtNow)
529 {
530         FIXME("stub\n");
531         return DS_OK;
532 }
533
534 HRESULT WINAPI IDirectMusicPerformance8Impl_AllocPMsg (LPDIRECTMUSICPERFORMANCE8 iface, ULONG cb, DMUS_PMSG** ppPMSG)
535 {
536         FIXME("stub\n");
537         return DS_OK;
538 }
539
540 HRESULT WINAPI IDirectMusicPerformance8Impl_FreePMsg (LPDIRECTMUSICPERFORMANCE8 iface, DMUS_PMSG* pPMSG)
541 {
542         FIXME("stub\n");
543         return DS_OK;
544 }
545
546 HRESULT WINAPI IDirectMusicPerformance8Impl_GetGraph (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicGraph** ppGraph)
547 {
548         FIXME("stub\n");
549         return DS_OK;
550 }
551
552 HRESULT WINAPI IDirectMusicPerformance8Impl_SetGraph (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicGraph* pGraph)
553 {
554         FIXME("stub\n");
555         return DS_OK;
556 }
557
558 HRESULT WINAPI IDirectMusicPerformance8Impl_SetNotificationHandle (LPDIRECTMUSICPERFORMANCE8 iface, HANDLE hNotification, REFERENCE_TIME rtMinimum)
559 {
560         FIXME("stub\n");
561         return DS_OK;
562 }
563
564 HRESULT WINAPI IDirectMusicPerformance8Impl_GetNotificationPMsg (LPDIRECTMUSICPERFORMANCE8 iface, DMUS_NOTIFICATION_PMSG** ppNotificationPMsg)
565 {
566         FIXME("stub\n");
567         return DS_OK;
568 }
569
570 HRESULT WINAPI IDirectMusicPerformance8Impl_AddNotificationType (LPDIRECTMUSICPERFORMANCE8 iface, REFGUID rguidNotificationType)
571 {
572         FIXME("stub\n");
573         return DS_OK;
574 }
575
576 HRESULT WINAPI IDirectMusicPerformance8Impl_RemoveNotificationType (LPDIRECTMUSICPERFORMANCE8 iface, REFGUID rguidNotificationType)
577 {
578         FIXME("stub\n");
579         return DS_OK;
580 }
581
582 HRESULT WINAPI IDirectMusicPerformance8Impl_AddPort (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicPort* pPort)
583 {
584         FIXME("stub\n");
585         return DS_OK;
586 }
587
588 HRESULT WINAPI IDirectMusicPerformance8Impl_RemovePort (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicPort* pPort)
589 {
590         FIXME("stub\n");
591         return DS_OK;
592 }
593
594 HRESULT WINAPI IDirectMusicPerformance8Impl_AssignPChannelBlock (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwBlockNum, IDirectMusicPort* pPort, DWORD dwGroup)
595 {
596         FIXME("stub\n");
597         return DS_OK;
598 }
599
600 HRESULT WINAPI IDirectMusicPerformance8Impl_AssignPChannel (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwPChannel, IDirectMusicPort* pPort, DWORD dwGroup, DWORD dwMChannel)
601 {
602         FIXME("stub\n");
603         return DS_OK;
604 }
605
606 HRESULT WINAPI IDirectMusicPerformance8Impl_PChannelInfo (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwPChannel, IDirectMusicPort** ppPort, DWORD* pdwGroup, DWORD* pdwMChannel)
607 {
608         FIXME("stub\n");
609         return DS_OK;
610 }
611
612 HRESULT WINAPI IDirectMusicPerformance8Impl_DownloadInstrument (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicInstrument* pInst, DWORD dwPChannel, IDirectMusicDownloadedInstrument** ppDownInst, DMUS_NOTERANGE* pNoteRanges, DWORD dwNumNoteRanges, IDirectMusicPort** ppPort, DWORD* pdwGroup, DWORD* pdwMChannel)
613 {
614         FIXME("stub\n");
615         return DS_OK;
616 }
617
618 HRESULT WINAPI IDirectMusicPerformance8Impl_Invalidate (LPDIRECTMUSICPERFORMANCE8 iface, MUSIC_TIME mtTime, DWORD dwFlags)
619 {
620         FIXME("stub\n");
621         return DS_OK;
622 }
623
624 HRESULT WINAPI IDirectMusicPerformance8Impl_GetParam (LPDIRECTMUSICPERFORMANCE8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam)
625 {
626         FIXME("stub\n");
627         return DS_OK;
628 }
629
630 HRESULT WINAPI IDirectMusicPerformance8Impl_SetParam (LPDIRECTMUSICPERFORMANCE8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, void* pParam)
631 {
632         FIXME("stub\n");
633         return DS_OK;
634 }
635
636 HRESULT WINAPI IDirectMusicPerformance8Impl_GetGlobalParam (LPDIRECTMUSICPERFORMANCE8 iface, REFGUID rguidType, void* pParam, DWORD dwSize)
637 {
638         FIXME("stub\n");
639         return DS_OK;
640 }
641
642 HRESULT WINAPI IDirectMusicPerformance8Impl_SetGlobalParam (LPDIRECTMUSICPERFORMANCE8 iface, REFGUID rguidType, void* pParam, DWORD dwSize)
643 {
644         FIXME("stub\n");
645         return DS_OK;
646 }
647
648 HRESULT WINAPI IDirectMusicPerformance8Impl_GetLatencyTime (LPDIRECTMUSICPERFORMANCE8 iface, REFERENCE_TIME* prtTime)
649 {
650         FIXME("stub\n");
651         return DS_OK;
652 }
653
654 HRESULT WINAPI IDirectMusicPerformance8Impl_GetQueueTime (LPDIRECTMUSICPERFORMANCE8 iface, REFERENCE_TIME* prtTime)
655 {
656         FIXME("stub\n");
657         return DS_OK;
658 }
659
660 HRESULT WINAPI IDirectMusicPerformance8Impl_AdjustTime (LPDIRECTMUSICPERFORMANCE8 iface, REFERENCE_TIME rtAmount)
661 {
662         FIXME("stub\n");
663         return DS_OK;
664 }
665
666 HRESULT WINAPI IDirectMusicPerformance8Impl_CloseDown (LPDIRECTMUSICPERFORMANCE8 iface)
667 {
668         FIXME("stub\n");
669         return DS_OK;
670 }
671
672 HRESULT WINAPI IDirectMusicPerformance8Impl_GetResolvedTime (LPDIRECTMUSICPERFORMANCE8 iface, REFERENCE_TIME rtTime, REFERENCE_TIME* prtResolved, DWORD dwTimeResolveFlags)
673 {
674         FIXME("stub\n");
675         return DS_OK;
676 }
677
678 HRESULT WINAPI IDirectMusicPerformance8Impl_MIDIToMusic (LPDIRECTMUSICPERFORMANCE8 iface, BYTE bMIDIValue, DMUS_CHORD_KEY* pChord, BYTE bPlayMode, BYTE bChordLevel, WORD* pwMusicValue)
679 {
680         FIXME("stub\n");
681         return DS_OK;
682 }
683
684 HRESULT WINAPI IDirectMusicPerformance8Impl_MusicToMIDI (LPDIRECTMUSICPERFORMANCE8 iface, WORD wMusicValue, DMUS_CHORD_KEY* pChord, BYTE bPlayMode, BYTE bChordLevel, BYTE* pbMIDIValue)
685 {
686         FIXME("stub\n");
687         return DS_OK;
688 }
689
690 HRESULT WINAPI IDirectMusicPerformance8Impl_TimeToRhythm (LPDIRECTMUSICPERFORMANCE8 iface, MUSIC_TIME mtTime, DMUS_TIMESIGNATURE* pTimeSig, WORD* pwMeasure, BYTE* pbBeat, BYTE* pbGrid, short* pnOffset)
691 {
692         FIXME("stub\n");
693         return DS_OK;
694 }
695
696 HRESULT WINAPI IDirectMusicPerformance8Impl_RhythmToTime (LPDIRECTMUSICPERFORMANCE8 iface, WORD wMeasure, BYTE bBeat, BYTE bGrid, short nOffset, DMUS_TIMESIGNATURE* pTimeSig, MUSIC_TIME* pmtTime)
697 {
698         FIXME("stub\n");
699         return DS_OK;
700 }
701
702 /* IDirectMusicPerformance8 Interface part follow: */
703 HRESULT WINAPI IDirectMusicPerformance8ImplInitAudio (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusic** ppDirectMusic, IDirectSound** ppDirectSound, HWND hWnd, DWORD dwDefaultPathType, DWORD dwPChannelCount, DWORD dwFlags, DMUS_AUDIOPARAMS* pParams)
704 {
705         FIXME("stub\n");
706         return DS_OK;
707 }
708
709 HRESULT WINAPI IDirectMusicPerformance8ImplPlaySegmentEx (LPDIRECTMUSICPERFORMANCE8 iface, IUnknown* pSource, WCHAR* pwzSegmentName, IUnknown* pTransition, DWORD dwFlags, __int64 i64StartTime, IDirectMusicSegmentState** ppSegmentState, IUnknown* pFrom, IUnknown* pAudioPath)
710 {
711         FIXME("stub\n");
712         return DS_OK;
713 }
714
715 HRESULT WINAPI IDirectMusicPerformance8ImplStopEx (LPDIRECTMUSICPERFORMANCE8 iface, IUnknown* pObjectToStop, __int64 i64StopTime, DWORD dwFlags)
716 {
717         FIXME("stub\n");
718         return DS_OK;
719 }
720
721 HRESULT WINAPI IDirectMusicPerformance8ImplClonePMsg (LPDIRECTMUSICPERFORMANCE8 iface, DMUS_PMSG* pSourcePMSG, DMUS_PMSG** ppCopyPMSG)
722 {
723         FIXME("stub\n");
724         return DS_OK;
725 }
726
727 HRESULT WINAPI IDirectMusicPerformance8ImplCreateAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IUnknown* pSourceConfig, BOOL fActivate, IDirectMusicAudioPath** ppNewPath)
728 {
729         FIXME("stub\n");
730         return DS_OK;
731 }
732
733 HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwType, DWORD dwPChannelCount, BOOL fActivate, IDirectMusicAudioPath** ppNewPath)
734 {
735         FIXME("stub\n");
736         return DS_OK;
737 }
738
739 HRESULT WINAPI IDirectMusicPerformance8ImplSetDefaultAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicAudioPath* pAudioPath)
740 {
741         FIXME("stub\n");
742         return DS_OK;
743 }
744
745 HRESULT WINAPI IDirectMusicPerformance8ImplGetDefaultAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicAudioPath** ppAudioPath)
746 {
747         FIXME("stub\n");
748         return DS_OK;
749 }
750
751 HRESULT WINAPI IDirectMusicPerformance8ImplGetParamEx (LPDIRECTMUSICPERFORMANCE8 iface, REFGUID rguidType, DWORD dwTrackID, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam)
752 {
753         FIXME("stub\n");
754         return DS_OK;
755 }
756
757 ICOM_VTABLE(IDirectMusicPerformance8) DirectMusicPerformance8_Vtbl =
758 {
759     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
760         IDirectMusicPerformance8Impl_QueryInterface,
761         IDirectMusicPerformance8Impl_AddRef,
762         IDirectMusicPerformance8Impl_Release,
763         IDirectMusicPerformance8Impl_Init,
764         IDirectMusicPerformance8Impl_PlaySegment,
765         IDirectMusicPerformance8Impl_Stop,
766         IDirectMusicPerformance8Impl_GetSegmentState,
767         IDirectMusicPerformance8Impl_SetPrepareTime,
768         IDirectMusicPerformance8Impl_GetPrepareTime,
769         IDirectMusicPerformance8Impl_SetBumperLength,
770         IDirectMusicPerformance8Impl_GetBumperLength,
771         IDirectMusicPerformance8Impl_SendPMsg,
772         IDirectMusicPerformance8Impl_MusicToReferenceTime,
773         IDirectMusicPerformance8Impl_ReferenceToMusicTime,
774         IDirectMusicPerformance8Impl_IsPlaying,
775         IDirectMusicPerformance8Impl_GetTime,
776         IDirectMusicPerformance8Impl_AllocPMsg,
777         IDirectMusicPerformance8Impl_FreePMsg,
778         IDirectMusicPerformance8Impl_GetGraph,
779         IDirectMusicPerformance8Impl_SetGraph,
780         IDirectMusicPerformance8Impl_SetNotificationHandle,
781         IDirectMusicPerformance8Impl_GetNotificationPMsg,
782         IDirectMusicPerformance8Impl_AddNotificationType,
783         IDirectMusicPerformance8Impl_RemoveNotificationType,
784         IDirectMusicPerformance8Impl_AddPort,
785         IDirectMusicPerformance8Impl_RemovePort,
786         IDirectMusicPerformance8Impl_AssignPChannelBlock,
787         IDirectMusicPerformance8Impl_AssignPChannel,
788         IDirectMusicPerformance8Impl_PChannelInfo,
789         IDirectMusicPerformance8Impl_DownloadInstrument,
790         IDirectMusicPerformance8Impl_Invalidate,
791         IDirectMusicPerformance8Impl_GetParam,
792         IDirectMusicPerformance8Impl_SetParam,
793         IDirectMusicPerformance8Impl_GetGlobalParam,
794         IDirectMusicPerformance8Impl_SetGlobalParam,
795         IDirectMusicPerformance8Impl_GetLatencyTime,
796         IDirectMusicPerformance8Impl_GetQueueTime,
797         IDirectMusicPerformance8Impl_AdjustTime,
798         IDirectMusicPerformance8Impl_CloseDown,
799         IDirectMusicPerformance8Impl_GetResolvedTime,
800         IDirectMusicPerformance8Impl_MIDIToMusic,
801         IDirectMusicPerformance8Impl_MusicToMIDI,
802         IDirectMusicPerformance8Impl_TimeToRhythm,
803         IDirectMusicPerformance8Impl_RhythmToTime,
804         IDirectMusicPerformance8ImplInitAudio,
805         IDirectMusicPerformance8ImplPlaySegmentEx,
806         IDirectMusicPerformance8ImplStopEx,
807         IDirectMusicPerformance8ImplClonePMsg,
808         IDirectMusicPerformance8ImplCreateAudioPath,
809         IDirectMusicPerformance8ImplCreateStandardAudioPath,
810         IDirectMusicPerformance8ImplSetDefaultAudioPath,
811         IDirectMusicPerformance8ImplGetDefaultAudioPath,
812         IDirectMusicPerformance8ImplGetParamEx
813 };
814
815 /* for ClassFactory */
816 HRESULT WINAPI DMUSIC_CreateDirectMusicPerformance8 (LPCGUID lpcGUID, LPDIRECTMUSICPERFORMANCE8 *ppDMPerf8, LPUNKNOWN pUnkOuter)
817 {
818         IDirectMusicPerformance8Impl *pPerf8;
819
820         TRACE("(%p,%p,%p)\n",lpcGUID, ppDMPerf8, pUnkOuter);
821         if (IsEqualGUID(lpcGUID, &IID_IDirectMusicPerformance8))
822         {
823                 pPerf8 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPerformance8Impl));
824                 if (NULL == pPerf8)
825                 {
826                         *ppDMPerf8 = (LPDIRECTMUSICPERFORMANCE8)NULL;
827                         return E_OUTOFMEMORY;
828                 }
829                 pPerf8->lpVtbl = &DirectMusicPerformance8_Vtbl;
830                 pPerf8->ref = 1;
831                 *ppDMPerf8 = (LPDIRECTMUSICPERFORMANCE8)pPerf8;
832                 return S_OK;
833         }
834         WARN("No interface found\n");
835         
836         return E_NOINTERFACE;
837 }