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