msxml3: Correct IDispatchEx Invoke to return the correct object.
[wine] / dlls / dmime / dmime_private.h
1 /* DirectMusicInteractiveEngine Private Include
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
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.
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 GNU
13  * Lesser General Public License for more details.
14  *
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
18  */
19
20 #ifndef __WINE_DMIME_PRIVATE_H
21 #define __WINE_DMIME_PRIVATE_H
22
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <string.h>
26
27 #define COBJMACROS
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winnt.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34
35 #include "wine/debug.h"
36 #include "wine/list.h"
37 #include "wine/unicode.h"
38 #include "winreg.h"
39 #include "objbase.h"
40
41 #include "dmusici.h"
42 #include "dmusicf.h"
43 #include "dmusics.h"
44 #include "dmusicc.h"
45
46 /*****************************************************************************
47  * Interfaces
48  */
49 typedef struct IDirectMusicPerformance8Impl IDirectMusicPerformance8Impl;
50 typedef struct IDirectMusicSegment8Impl IDirectMusicSegment8Impl;
51 typedef struct IDirectMusicSegmentState8Impl IDirectMusicSegmentState8Impl;
52 typedef struct IDirectMusicGraphImpl IDirectMusicGraphImpl;
53 typedef struct IDirectMusicAudioPathImpl IDirectMusicAudioPathImpl;
54 typedef struct IDirectMusicTool8Impl IDirectMusicTool8Impl;
55 typedef struct IDirectMusicPatternTrackImpl IDirectMusicPatternTrackImpl;
56
57 typedef struct IDirectMusicLyricsTrack IDirectMusicLyricsTrack;
58 typedef struct IDirectMusicMarkerTrack IDirectMusicMarkerTrack;
59 typedef struct IDirectMusicParamControlTrack IDirectMusicParamControlTrack;
60 typedef struct IDirectMusicSegTriggerTrack IDirectMusicSegTriggerTrack;
61 typedef struct IDirectMusicSeqTrack IDirectMusicSeqTrack;
62 typedef struct IDirectMusicSysExTrack IDirectMusicSysExTrack;
63 typedef struct IDirectMusicTempoTrack IDirectMusicTempoTrack;
64 typedef struct IDirectMusicTimeSigTrack IDirectMusicTimeSigTrack;
65 typedef struct IDirectMusicWaveTrack IDirectMusicWaveTrack;
66         
67 /*****************************************************************************
68  * ClassFactory
69  */
70 extern HRESULT WINAPI DMUSIC_CreateDirectMusicPerformanceImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
71 extern HRESULT WINAPI DMUSIC_CreateDirectMusicSegmentImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
72 extern HRESULT WINAPI DMUSIC_CreateDirectMusicSegmentStateImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
73 extern HRESULT WINAPI DMUSIC_CreateDirectMusicGraphImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
74 extern HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPathImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
75 extern HRESULT WINAPI DMUSIC_CreateDirectMusicToolImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
76 extern HRESULT WINAPI DMUSIC_CreateDirectMusicPatternTrackImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
77
78 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLyricsTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
79 extern HRESULT WINAPI DMUSIC_CreateDirectMusicMarkerTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
80 extern HRESULT WINAPI DMUSIC_CreateDirectMusicParamControlTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
81 extern HRESULT WINAPI DMUSIC_CreateDirectMusicSegTriggerTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
82 extern HRESULT WINAPI DMUSIC_CreateDirectMusicSeqTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
83 extern HRESULT WINAPI DMUSIC_CreateDirectMusicSysExTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
84 extern HRESULT WINAPI DMUSIC_CreateDirectMusicTempoTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
85 extern HRESULT WINAPI DMUSIC_CreateDirectMusicTimeSigTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
86 extern HRESULT WINAPI DMUSIC_CreateDirectMusicWaveTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
87
88
89 /*****************************************************************************
90  * Auxiliary definitions
91  */
92 typedef struct _DMUS_PRIVATE_SEGMENT_TRACK {
93   struct list entry; /* for listing elements */
94   DWORD dwGroupBits;
95   IDirectMusicTrack* pTrack;
96 } DMUS_PRIVATE_SEGMENT_TRACK, *LPDMUS_PRIVATE_SEGMENT_TRACK;
97
98 typedef struct _DMUS_PRIVATE_TEMPO_ITEM {
99   struct list entry; /* for listing elements */
100   DMUS_IO_TEMPO_ITEM item;
101 } DMUS_PRIVATE_TEMPO_ITEM, *LPDMUS_PRIVATE_TEMPO_ITEM;
102
103 typedef struct _DMUS_PRIVATE_SEGMENT_ITEM {
104   struct list entry; /* for listing elements */
105   DMUS_IO_SEGMENT_ITEM_HEADER header;
106   IDirectMusicObject* pObject;
107   WCHAR wszName[DMUS_MAX_NAME];
108 } DMUS_PRIVATE_SEGMENT_ITEM, *LPDMUS_PRIVATE_SEGMENT_ITEM;
109
110 typedef struct _DMUS_PRIVATE_GRAPH_TOOL {
111   struct list entry; /* for listing elements */
112   DWORD dwIndex;
113   IDirectMusicTool* pTool;
114 } DMUS_PRIVATE_GRAPH_TOOL, *LPDMUS_PRIVATE_GRAPH_TOOL;
115
116 typedef struct _DMUS_PRIVATE_TEMPO_PLAY_STATE {
117   DWORD dummy;
118 } DMUS_PRIVATE_TEMPO_PLAY_STATE, *LPDMUS_PRIVATE_TEMPO_PLAY_STATE;
119
120 /* some sort of aux. performance channel: as far as i can understand, these are 
121    used to represent a particular midi channel in particular group at particular
122    group; so all we need to do is to fill it with parent port, group and midi 
123    channel ? */
124 typedef struct DMUSIC_PRIVATE_PCHANNEL_ {
125         DWORD channel; /* map to this channel... */
126         DWORD group; /* ... in this group ... */
127         IDirectMusicPort *port; /* ... at this port */
128 } DMUSIC_PRIVATE_PCHANNEL, *LPDMUSIC_PRIVATE_PCHANNEL;
129
130 /*****************************************************************************
131  * IDirectMusicPerformance8Impl implementation structure
132  */
133 struct IDirectMusicPerformance8Impl {
134   /* IUnknown fields */
135   const IDirectMusicPerformance8Vtbl *lpVtbl;
136   LONG                   ref;
137
138   /* IDirectMusicPerformanceImpl fields */
139   IDirectMusic8*         pDirectMusic;
140   IDirectSound*          pDirectSound;
141   IDirectMusicGraph*     pToolGraph;
142   DMUS_AUDIOPARAMS       pParams;
143
144   /* global parameters */
145   BOOL  fAutoDownload;
146   char  cMasterGrooveLevel;
147   float fMasterTempo;
148   long  lMasterVolume;
149         
150   /* performance channels */
151   DMUSIC_PRIVATE_PCHANNEL PChannel[32];
152
153    /* IDirectMusicPerformance8Impl fields */
154   IDirectMusicAudioPath* pDefaultPath;
155   HANDLE hNotification;
156   REFERENCE_TIME rtMinimum;
157
158   REFERENCE_TIME rtLatencyTime;
159   DWORD dwBumperLength;
160   DWORD dwPrepareTime;
161   /** Message Processing */
162   HANDLE         procThread;
163   DWORD          procThreadId;
164   REFERENCE_TIME procThreadStartTime;
165   BOOL           procThreadTicStarted;
166   CRITICAL_SECTION safe;
167   struct DMUS_PMSGItem* head; 
168   struct DMUS_PMSGItem* imm_head; 
169 };
170
171 /*****************************************************************************
172  * IDirectMusicSegment8Impl implementation structure
173  */
174 struct IDirectMusicSegment8Impl {
175   /* IUnknown fields */
176   const IUnknownVtbl *UnknownVtbl;
177   const IDirectMusicSegment8Vtbl *SegmentVtbl;
178   const IDirectMusicObjectVtbl *ObjectVtbl;
179   const IPersistStreamVtbl *PersistStreamVtbl;
180   LONG           ref;
181
182   /* IDirectMusicSegment8Impl fields */
183   LPDMUS_OBJECTDESC      pDesc;
184   DMUS_IO_SEGMENT_HEADER header;
185   IDirectMusicGraph*     pGraph; 
186   struct list Tracks;
187 };
188
189 /*****************************************************************************
190  * IDirectMusicSegmentState8Impl implementation structure
191  */
192 struct IDirectMusicSegmentState8Impl {
193   /* IUnknown fields */
194   const IDirectMusicSegmentState8Vtbl *lpVtbl;
195   LONG           ref;
196
197   /* IDirectMusicSegmentState8Impl fields */
198 };
199
200 /*****************************************************************************
201  * IDirectMusicGraphImpl implementation structure
202  */
203 struct IDirectMusicGraphImpl {
204   /* IUnknown fields */
205   const IUnknownVtbl *UnknownVtbl;
206   const IDirectMusicGraphVtbl *GraphVtbl;
207   const IDirectMusicObjectVtbl *ObjectVtbl;
208   const IPersistStreamVtbl *PersistStreamVtbl;
209   LONG           ref;
210
211   /* IDirectMusicGraphImpl fields */
212   LPDMUS_OBJECTDESC pDesc;
213   WORD              num_tools;
214   struct list       Tools;
215 };
216
217 /*****************************************************************************
218  * IDirectMusicAudioPathImpl implementation structure
219  */
220 struct IDirectMusicAudioPathImpl {
221   /* IUnknown fields */
222   const IUnknownVtbl *UnknownVtbl;
223   const IDirectMusicAudioPathVtbl *AudioPathVtbl;
224   const IDirectMusicObjectVtbl *ObjectVtbl;
225   const IPersistStreamVtbl *PersistStreamVtbl;
226   LONG           ref;
227
228   /* IDirectMusicAudioPathImpl fields */
229   LPDMUS_OBJECTDESC pDesc;
230         
231   IDirectMusicPerformance8* pPerf;
232   IDirectMusicGraph*        pToolGraph;
233   IDirectSoundBuffer*       pDSBuffer;
234   IDirectSoundBuffer*       pPrimary;
235
236   BOOL fActive;
237 };
238
239 /*****************************************************************************
240  * IDirectMusicTool8Impl implementation structure
241  */
242 struct IDirectMusicTool8Impl {
243   /* IUnknown fields */
244   const IDirectMusicTool8Vtbl *lpVtbl;
245   LONG           ref;
246
247   /* IDirectMusicTool8Impl fields */
248 };
249
250 /*****************************************************************************
251  * IDirectMusicPatternTrackImpl implementation structure
252  */
253 struct IDirectMusicPatternTrackImpl {
254   /* IUnknown fields */
255   const IDirectMusicPatternTrackVtbl *lpVtbl;
256   LONG           ref;
257
258   /* IDirectMusicPatternTrackImpl fields */
259 };
260
261 /*****************************************************************************
262  * IDirectMusicLyricsTrack implementation structure
263  */
264 struct IDirectMusicLyricsTrack
265 {
266   /* IUnknown fields */
267   const IUnknownVtbl *UnknownVtbl;
268   const IDirectMusicTrack8Vtbl *TrackVtbl;
269   const IPersistStreamVtbl *PersistStreamVtbl;
270   LONG           ref;
271
272   /* IDirectMusicLyricsTrack fields */
273   LPDMUS_OBJECTDESC pDesc;
274 };
275
276 /*****************************************************************************
277  * IDirectMusicMarkerTrack implementation structure
278  */
279 struct IDirectMusicMarkerTrack {
280   /* IUnknown fields */
281   const IUnknownVtbl *UnknownVtbl;
282   const IDirectMusicTrack8Vtbl *TrackVtbl;
283   const IPersistStreamVtbl *PersistStreamVtbl;
284   LONG           ref;
285
286   /* IDirectMusicMarkerTrack fields */
287   LPDMUS_OBJECTDESC pDesc;
288 };
289
290 /*****************************************************************************
291  * IDirectMusicParamControlTrack implementation structure
292  */
293 struct IDirectMusicParamControlTrack {
294   /* IUnknown fields */
295   const IUnknownVtbl *UnknownVtbl;
296   const IDirectMusicTrack8Vtbl *TrackVtbl;
297   const IPersistStreamVtbl *PersistStreamVtbl;
298   LONG           ref;
299
300   /* IDirectMusicParamControlTrack fields */
301   LPDMUS_OBJECTDESC pDesc;
302 };
303
304 /*****************************************************************************
305  * IDirectMusicSegTriggerTrack implementation structure
306  */
307 struct IDirectMusicSegTriggerTrack {
308   /* IUnknown fields */
309   const IUnknownVtbl *UnknownVtbl;
310   const IDirectMusicTrack8Vtbl *TrackVtbl;
311   const IPersistStreamVtbl *PersistStreamVtbl;
312   LONG           ref;
313
314   /* IDirectMusicSegTriggerTrack fields */
315   LPDMUS_OBJECTDESC pDesc;
316
317   struct list Items;
318 };
319
320 /*****************************************************************************
321  * IDirectMusicSeqTrack implementation structure
322  */
323 struct IDirectMusicSeqTrack {
324   /* IUnknown fields */
325   const IUnknownVtbl *UnknownVtbl;
326   const IDirectMusicTrack8Vtbl *TrackVtbl;
327   const IPersistStreamVtbl *PersistStreamVtbl;
328   LONG           ref;
329
330   /* IDirectMusicSeqTrack fields */
331   LPDMUS_OBJECTDESC pDesc;
332 };
333
334 /*****************************************************************************
335  * IDirectMusicSysExTrack implementation structure
336  */
337 struct IDirectMusicSysExTrack {
338   /* IUnknown fields */
339   const IUnknownVtbl *UnknownVtbl;
340   const IDirectMusicTrack8Vtbl *TrackVtbl;
341   const IPersistStreamVtbl *PersistStreamVtbl;
342   LONG           ref;
343
344   /* IDirectMusicSysExTrack fields */
345   LPDMUS_OBJECTDESC pDesc;
346 };
347
348 /*****************************************************************************
349  * IDirectMusicTempoTrack implementation structure
350  */
351 struct IDirectMusicTempoTrack {
352   /* IUnknown fields */
353   const IUnknownVtbl *UnknownVtbl;
354   const IDirectMusicTrack8Vtbl *TrackVtbl;
355   const IPersistStreamVtbl *PersistStreamVtbl;
356   LONG           ref;
357
358   /* IDirectMusicTempoTrack fields */
359   LPDMUS_OBJECTDESC pDesc;
360   BOOL enabled;
361   struct list Items;
362 };
363
364 /*****************************************************************************
365  * IDirectMusicTimeSigTrack implementation structure
366  */
367 struct IDirectMusicTimeSigTrack {
368   /* IUnknown fields */
369   const IUnknownVtbl *UnknownVtbl;
370   const IDirectMusicTrack8Vtbl *TrackVtbl;
371   const IPersistStreamVtbl *PersistStreamVtbl;
372   LONG           ref;
373
374   /* IDirectMusicTimeSigTrack fields */
375   LPDMUS_OBJECTDESC pDesc;
376 };
377
378 /*****************************************************************************
379  * IDirectMusicWaveTrack implementation structure
380  */
381 struct IDirectMusicWaveTrack {
382   /* IUnknown fields */
383   const IUnknownVtbl *UnknownVtbl;
384   const IDirectMusicTrack8Vtbl *TrackVtbl;
385   const IPersistStreamVtbl *PersistStreamVtbl;
386   LONG           ref;
387
388   /* IDirectMusicWaveTrack fields */
389   LPDMUS_OBJECTDESC pDesc;
390 };
391
392 /**********************************************************************
393  * Dll lifetime tracking declaration for dmime.dll
394  */
395 extern LONG DMIME_refCount;
396 static inline void DMIME_LockModule(void) { InterlockedIncrement( &DMIME_refCount ); }
397 static inline void DMIME_UnlockModule(void) { InterlockedDecrement( &DMIME_refCount ); }
398
399 /*****************************************************************************
400  * Misc.
401  */
402
403 #include "dmutils.h"
404
405 #endif  /* __WINE_DMIME_PRIVATE_H */