dmime_private.h 13.6 KB
Newer Older
1 2
/* DirectMusicInteractiveEngine Private Include
 *
3
 * Copyright (C) 2003-2004 Rok Mandeljc
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 *
 * You should have received a copy of the GNU General Public 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 21 22
 */

#ifndef __WINE_DMIME_PRIVATE_H
#define __WINE_DMIME_PRIVATE_H

23
#include <stdio.h>
24
#include <stdarg.h>
25
#include <string.h>
26

27 28
#define COBJMACROS

29 30 31
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
32
#include "wingdi.h"
33 34 35 36 37 38
#include "winuser.h"

#include "wine/debug.h"
#include "wine/list.h"
#include "wine/unicode.h"
#include "winreg.h"
39
#include "objbase.h"
40

41 42
#include "dmusici.h"
#include "dmusicf.h"
43
#include "dmusics.h"
44
#include "dmusicc.h"
45 46 47 48 49 50 51 52 53 54 55 56

/*****************************************************************************
 * Interfaces
 */
typedef struct IDirectMusicPerformance8Impl IDirectMusicPerformance8Impl;
typedef struct IDirectMusicSegment8Impl IDirectMusicSegment8Impl;
typedef struct IDirectMusicSegmentState8Impl IDirectMusicSegmentState8Impl;
typedef struct IDirectMusicGraphImpl IDirectMusicGraphImpl;
typedef struct IDirectMusicAudioPathImpl IDirectMusicAudioPathImpl;
typedef struct IDirectMusicTool8Impl IDirectMusicTool8Impl;
typedef struct IDirectMusicPatternTrackImpl IDirectMusicPatternTrackImpl;

57 58 59 60 61 62 63 64 65 66
typedef struct IDirectMusicLyricsTrack IDirectMusicLyricsTrack;
typedef struct IDirectMusicMarkerTrack IDirectMusicMarkerTrack;
typedef struct IDirectMusicParamControlTrack IDirectMusicParamControlTrack;
typedef struct IDirectMusicSegTriggerTrack IDirectMusicSegTriggerTrack;
typedef struct IDirectMusicSeqTrack IDirectMusicSeqTrack;
typedef struct IDirectMusicSysExTrack IDirectMusicSysExTrack;
typedef struct IDirectMusicTempoTrack IDirectMusicTempoTrack;
typedef struct IDirectMusicTimeSigTrack IDirectMusicTimeSigTrack;
typedef struct IDirectMusicWaveTrack IDirectMusicWaveTrack;
	
67 68 69
/*****************************************************************************
 * ClassFactory
 */
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPerformanceImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicSegmentImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicSegmentStateImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicGraphImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPathImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicToolImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPatternTrackImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);

extern HRESULT WINAPI DMUSIC_CreateDirectMusicLyricsTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicMarkerTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicParamControlTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicSegTriggerTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicSeqTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicSysExTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicTempoTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicTimeSigTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicWaveTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);

88

89 90 91 92 93 94 95 96 97
/*****************************************************************************
 * Auxiliary definitions
 */
typedef struct _DMUS_PRIVATE_SEGMENT_TRACK {
  struct list entry; /* for listing elements */
  DWORD dwGroupBits;
  IDirectMusicTrack* pTrack;
} DMUS_PRIVATE_SEGMENT_TRACK, *LPDMUS_PRIVATE_SEGMENT_TRACK;

98 99 100 101 102
typedef struct _DMUS_PRIVATE_TEMPO_ITEM {
  struct list entry; /* for listing elements */
  DMUS_IO_TEMPO_ITEM item;
} DMUS_PRIVATE_TEMPO_ITEM, *LPDMUS_PRIVATE_TEMPO_ITEM;

103 104 105 106 107 108 109
typedef struct _DMUS_PRIVATE_SEGMENT_ITEM {
  struct list entry; /* for listing elements */
  DMUS_IO_SEGMENT_ITEM_HEADER header;
  IDirectMusicObject* pObject;
  WCHAR wszName[DMUS_MAX_NAME];
} DMUS_PRIVATE_SEGMENT_ITEM, *LPDMUS_PRIVATE_SEGMENT_ITEM;

110 111 112 113 114 115
typedef struct _DMUS_PRIVATE_GRAPH_TOOL {
  struct list entry; /* for listing elements */
  DWORD dwIndex;
  IDirectMusicTool* pTool;
} DMUS_PRIVATE_GRAPH_TOOL, *LPDMUS_PRIVATE_GRAPH_TOOL;

116 117 118
typedef struct _DMUS_PRIVATE_TEMPO_PLAY_STATE {
  DWORD dummy;
} DMUS_PRIVATE_TEMPO_PLAY_STATE, *LPDMUS_PRIVATE_TEMPO_PLAY_STATE;
119

120 121 122 123
/* some sort of aux. performance channel: as far as i can understand, these are 
   used to represent a particular midi channel in particular group at particular
   group; so all we need to do is to fill it with parent port, group and midi 
   channel ? */
124
typedef struct DMUSIC_PRIVATE_PCHANNEL_ {
125 126 127 128 129
	DWORD channel; /* map to this channel... */
	DWORD group; /* ... in this group ... */
	IDirectMusicPort *port; /* ... at this port */
} DMUSIC_PRIVATE_PCHANNEL, *LPDMUSIC_PRIVATE_PCHANNEL;

130 131 132
/*****************************************************************************
 * IDirectMusicPerformance8Impl implementation structure
 */
133
struct IDirectMusicPerformance8Impl {
134
  /* IUnknown fields */
135
  const IDirectMusicPerformance8Vtbl *lpVtbl;
136
  LONG                   ref;
137 138 139 140 141 142 143 144 145 146 147 148 149 150

  /* IDirectMusicPerformanceImpl fields */
  IDirectMusic8*         pDirectMusic;
  IDirectSound*          pDirectSound;
  IDirectMusicGraph*     pToolGraph;
  DMUS_AUDIOPARAMS       pParams;

  /* global parameters */
  BOOL  fAutoDownload;
  char  cMasterGrooveLevel;
  float fMasterTempo;
  long  lMasterVolume;
	
  /* performance channels */
151
  DMUSIC_PRIVATE_PCHANNEL PChannel[32];
152 153 154

   /* IDirectMusicPerformance8Impl fields */
  IDirectMusicAudioPath* pDefaultPath;
155 156
  HANDLE hNotification;
  REFERENCE_TIME rtMinimum;
157

158 159 160
  REFERENCE_TIME rtLatencyTime;
  DWORD dwBumperLength;
  DWORD dwPrepareTime;
161 162
  /** Message Processing */
  HANDLE         procThread;
163
  DWORD          procThreadId;
164 165
  REFERENCE_TIME procThreadStartTime;
  BOOL           procThreadTicStarted;
166 167 168
  CRITICAL_SECTION safe;
  struct DMUS_PMSGItem* head; 
  struct DMUS_PMSGItem* imm_head; 
169 170 171 172 173
};

/*****************************************************************************
 * IDirectMusicSegment8Impl implementation structure
 */
174
struct IDirectMusicSegment8Impl {
175
  /* IUnknown fields */
176 177 178 179
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicSegment8Vtbl *SegmentVtbl;
  const IDirectMusicObjectVtbl *ObjectVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
180
  LONG           ref;
181 182

  /* IDirectMusicSegment8Impl fields */
183 184
  LPDMUS_OBJECTDESC      pDesc;
  DMUS_IO_SEGMENT_HEADER header;
185 186
  IDirectMusicGraph*     pGraph; 
  struct list Tracks;
187 188 189 190 191
};

/*****************************************************************************
 * IDirectMusicSegmentState8Impl implementation structure
 */
192
struct IDirectMusicSegmentState8Impl {
193
  /* IUnknown fields */
194
  const IDirectMusicSegmentState8Vtbl *lpVtbl;
195
  LONG           ref;
196 197 198 199 200 201 202

  /* IDirectMusicSegmentState8Impl fields */
};

/*****************************************************************************
 * IDirectMusicGraphImpl implementation structure
 */
203
struct IDirectMusicGraphImpl {
204
  /* IUnknown fields */
205 206 207 208
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicGraphVtbl *GraphVtbl;
  const IDirectMusicObjectVtbl *ObjectVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
209
  LONG           ref;
210 211

  /* IDirectMusicGraphImpl fields */
212
  LPDMUS_OBJECTDESC pDesc;
213 214
  WORD              num_tools;
  struct list       Tools;
215 216 217 218 219
};

/*****************************************************************************
 * IDirectMusicAudioPathImpl implementation structure
 */
220
struct IDirectMusicAudioPathImpl {
221
  /* IUnknown fields */
222 223 224 225
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicAudioPathVtbl *AudioPathVtbl;
  const IDirectMusicObjectVtbl *ObjectVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
226
  LONG           ref;
227 228

  /* IDirectMusicAudioPathImpl fields */
229
  LPDMUS_OBJECTDESC pDesc;
230
	
231 232 233 234
  IDirectMusicPerformance8* pPerf;
  IDirectMusicGraph*        pToolGraph;
  IDirectSoundBuffer*       pDSBuffer;
  IDirectSoundBuffer*       pPrimary;
235 236

  BOOL fActive;
237 238 239 240 241
};

/*****************************************************************************
 * IDirectMusicTool8Impl implementation structure
 */
242
struct IDirectMusicTool8Impl {
243
  /* IUnknown fields */
244
  const IDirectMusicTool8Vtbl *lpVtbl;
245
  LONG           ref;
246 247 248 249 250

  /* IDirectMusicTool8Impl fields */
};

/*****************************************************************************
251 252
 * IDirectMusicPatternTrackImpl implementation structure
 */
253
struct IDirectMusicPatternTrackImpl {
254
  /* IUnknown fields */
255
  const IDirectMusicPatternTrackVtbl *lpVtbl;
256
  LONG           ref;
257 258 259 260 261 262 263 264

  /* IDirectMusicPatternTrackImpl fields */
};

/*****************************************************************************
 * IDirectMusicLyricsTrack implementation structure
 */
struct IDirectMusicLyricsTrack
265 266
{
  /* IUnknown fields */
267 268 269
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
270
  LONG           ref;
271

272
  /* IDirectMusicLyricsTrack fields */
273
  LPDMUS_OBJECTDESC pDesc;
274 275
};

276 277 278
/*****************************************************************************
 * IDirectMusicMarkerTrack implementation structure
 */
279
struct IDirectMusicMarkerTrack {
280
  /* IUnknown fields */
281 282 283
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
284
  LONG           ref;
285 286

  /* IDirectMusicMarkerTrack fields */
287
  LPDMUS_OBJECTDESC pDesc;
288 289 290 291 292
};

/*****************************************************************************
 * IDirectMusicParamControlTrack implementation structure
 */
293
struct IDirectMusicParamControlTrack {
294
  /* IUnknown fields */
295 296 297
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
298
  LONG           ref;
299 300

  /* IDirectMusicParamControlTrack fields */
301
  LPDMUS_OBJECTDESC pDesc;
302 303 304 305 306
};

/*****************************************************************************
 * IDirectMusicSegTriggerTrack implementation structure
 */
307
struct IDirectMusicSegTriggerTrack {
308
  /* IUnknown fields */
309 310 311
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
312
  LONG           ref;
313 314

  /* IDirectMusicSegTriggerTrack fields */
315
  LPDMUS_OBJECTDESC pDesc;
316 317

  struct list Items;
318 319 320 321 322
};

/*****************************************************************************
 * IDirectMusicSeqTrack implementation structure
 */
323
struct IDirectMusicSeqTrack {
324
  /* IUnknown fields */
325 326 327
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
328
  LONG           ref;
329 330

  /* IDirectMusicSeqTrack fields */
331
  LPDMUS_OBJECTDESC pDesc;
332 333 334 335 336
};

/*****************************************************************************
 * IDirectMusicSysExTrack implementation structure
 */
337
struct IDirectMusicSysExTrack {
338
  /* IUnknown fields */
339 340 341
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
342
  LONG           ref;
343 344

  /* IDirectMusicSysExTrack fields */
345
  LPDMUS_OBJECTDESC pDesc;
346 347 348 349 350
};

/*****************************************************************************
 * IDirectMusicTempoTrack implementation structure
 */
351
struct IDirectMusicTempoTrack {
352
  /* IUnknown fields */
353 354 355
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
356
  LONG           ref;
357 358

  /* IDirectMusicTempoTrack fields */
359
  LPDMUS_OBJECTDESC pDesc;
360 361
  BOOL enabled;
  struct list Items;
362 363 364 365 366
};

/*****************************************************************************
 * IDirectMusicTimeSigTrack implementation structure
 */
367
struct IDirectMusicTimeSigTrack {
368
  /* IUnknown fields */
369 370 371
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  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 384 385
  const IUnknownVtbl *UnknownVtbl;
  const IDirectMusicTrack8Vtbl *TrackVtbl;
  const IPersistStreamVtbl *PersistStreamVtbl;
386
  LONG           ref;
387

388 389
  /* IDirectMusicWaveTrack fields */
  LPDMUS_OBJECTDESC pDesc;
390 391
};

392 393 394 395
/**********************************************************************
 * Dll lifetime tracking declaration for dmime.dll
 */
extern LONG DMIME_refCount;
396 397
static inline void DMIME_LockModule(void) { InterlockedIncrement( &DMIME_refCount ); }
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 */