push 915ca0aa9d2991375796d4b573b1be50b5f1fb2c
[wine/hacks.git] / dlls / dmusic / dmusic_private.h
blobcda8d544db6fbb2a3632318d2ed29eb3277b93b8
1 /* DirectMusic Private Include
3 * Copyright (C) 2003-2004 Rok Mandeljc
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.
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.
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
20 #ifndef __WINE_DMUSIC_PRIVATE_H
21 #define __WINE_DMUSIC_PRIVATE_H
23 #include <stdarg.h>
25 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winnt.h"
30 #include "wingdi.h"
31 #include "winuser.h"
33 #include "wine/debug.h"
34 #include "wine/list.h"
35 #include "wine/unicode.h"
36 #include "winreg.h"
37 #include "objbase.h"
39 #include "dmusici.h"
40 #include "dmusicf.h"
41 #include "dmusics.h"
43 /*****************************************************************************
44 * Interfaces
46 typedef struct IDirectMusic8Impl IDirectMusic8Impl;
47 typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
48 typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
49 typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
50 typedef struct IDirectMusicPortDownloadImpl IDirectMusicPortDownloadImpl;
51 typedef struct IDirectMusicPortImpl IDirectMusicPortImpl;
52 typedef struct IDirectMusicThruImpl IDirectMusicThruImpl;
53 typedef struct IReferenceClockImpl IReferenceClockImpl;
55 typedef struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl;
56 typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
59 /*****************************************************************************
60 * Some stuff to make my life easier :=)
63 /* some sort of aux. midi channel: big fake at the moment; accepts only priority
64 changes... more coming soon */
65 typedef struct DMUSIC_PRIVATE_MCHANNEL_ {
66 DWORD priority;
67 } DMUSIC_PRIVATE_MCHANNEL, *LPDMUSIC_PRIVATE_MCHANNEL;
69 /* some sort of aux. channel group: collection of 16 midi channels */
70 typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
71 DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
72 } DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
75 /*****************************************************************************
76 * ClassFactory
78 extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
79 extern HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
80 extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
81 extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
82 extern HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
84 extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
85 extern HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
87 /*****************************************************************************
88 * IDirectMusic8Impl implementation structure
90 struct IDirectMusic8Impl {
91 /* IUnknown fields */
92 const IDirectMusic8Vtbl *lpVtbl;
93 LONG ref;
95 /* IDirectMusicImpl fields */
96 IReferenceClockImpl* pMasterClock;
97 IDirectMusicPort** ppPorts;
98 int nrofports;
101 /*****************************************************************************
102 * IDirectMusicBufferImpl implementation structure
104 struct IDirectMusicBufferImpl {
105 /* IUnknown fields */
106 const IDirectMusicBufferVtbl *lpVtbl;
107 LONG ref;
109 /* IDirectMusicBufferImpl fields */
112 /*****************************************************************************
113 * IDirectMusicDownloadedInstrumentImpl implementation structure
115 struct IDirectMusicDownloadedInstrumentImpl {
116 /* IUnknown fields */
117 const IDirectMusicDownloadedInstrumentVtbl *lpVtbl;
118 LONG ref;
120 /* IDirectMusicDownloadedInstrumentImpl fields */
123 /*****************************************************************************
124 * IDirectMusicDownloadImpl implementation structure
126 struct IDirectMusicDownloadImpl {
127 /* IUnknown fields */
128 const IDirectMusicDownloadVtbl *lpVtbl;
129 LONG ref;
131 /* IDirectMusicDownloadImpl fields */
134 /*****************************************************************************
135 * IDirectMusicPortDownloadImpl implementation structure
137 struct IDirectMusicPortDownloadImpl {
138 /* IUnknown fields */
139 const IDirectMusicPortDownloadVtbl *lpVtbl;
140 LONG ref;
142 /* IDirectMusicPortDownloadImpl fields */
145 /*****************************************************************************
146 * IDirectMusicPortImpl implementation structure
148 struct IDirectMusicPortImpl {
149 /* IUnknown fields */
150 const IDirectMusicPortVtbl *lpVtbl;
151 LONG ref;
153 /* IDirectMusicPortImpl fields */
154 IDirectSound* pDirectSound;
155 IReferenceClock* pLatencyClock;
156 BOOL fActive;
157 DMUS_PORTCAPS caps;
158 DMUS_PORTPARAMS params;
159 int nrofgroups;
160 DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
163 extern HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive);
165 /** Internal factory */
166 extern HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps);
168 /*****************************************************************************
169 * IDirectMusicThruImpl implementation structure
171 struct IDirectMusicThruImpl {
172 /* IUnknown fields */
173 const IDirectMusicThruVtbl *lpVtbl;
174 LONG ref;
176 /* IDirectMusicThruImpl fields */
179 /*****************************************************************************
180 * IReferenceClockImpl implementation structure
182 struct IReferenceClockImpl {
183 /* IUnknown fields */
184 const IReferenceClockVtbl *lpVtbl;
185 LONG ref;
187 /* IReferenceClockImpl fields */
188 REFERENCE_TIME rtTime;
189 DMUS_CLOCKINFO pClockInfo;
192 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
193 struct list entry; /* for listing elements */
194 IDirectMusicInstrument* pInstrument;
195 } DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
197 typedef struct _DMUS_PRIVATE_POOLCUE {
198 struct list entry; /* for listing elements */
199 } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
201 /*****************************************************************************
202 * IDirectMusicCollectionImpl implementation structure
204 struct IDirectMusicCollectionImpl {
205 /* IUnknown fields */
206 const IUnknownVtbl *UnknownVtbl;
207 const IDirectMusicCollectionVtbl *CollectionVtbl;
208 const IDirectMusicObjectVtbl *ObjectVtbl;
209 const IPersistStreamVtbl *PersistStreamVtbl;
210 LONG ref;
212 /* IDirectMusicCollectionImpl fields */
213 IStream *pStm; /* stream from which we load collection and later instruments */
214 LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
215 LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
216 LPDMUS_OBJECTDESC pDesc;
217 CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
218 LPDLSHEADER pHeader;
219 /* pool table */
220 LPPOOLTABLE pPoolTable;
221 LPPOOLCUE pPoolCues;
222 /* instruments */
223 struct list Instruments;
226 /*****************************************************************************
227 * IDirectMusicInstrumentImpl implementation structure
229 struct IDirectMusicInstrumentImpl {
230 /* IUnknown fields */
231 const IUnknownVtbl *UnknownVtbl;
232 const IDirectMusicInstrumentVtbl *InstrumentVtbl;
233 LONG ref;
235 /* IDirectMusicInstrumentImpl fields */
236 LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
237 LPGUID pInstrumentID;
238 LPINSTHEADER pHeader;
239 WCHAR wszName[DMUS_MAX_NAME];
240 /* instrument data */
243 /* custom :) */
244 extern HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm);
246 /**********************************************************************
247 * Dll lifetime tracking declaration for dmusic.dll
249 extern LONG DMUSIC_refCount;
250 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
251 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
254 /*****************************************************************************
255 * Misc.
257 /* my custom ICOM stuff */
258 #define ICOM_NAME_MULTI(impl,field,iface,name) impl* const name=(impl*)((char*)(iface) - offsetof(impl,field))
259 #define ICOM_THIS_MULTI(impl,field,iface) ICOM_NAME_MULTI(impl,field,iface,This)
261 /* for simpler reading */
262 typedef struct _DMUS_PRIVATE_CHUNK {
263 FOURCC fccID; /* FOURCC ID of the chunk */
264 DWORD dwSize; /* size of the chunk */
265 } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
267 /* used for generic dumping (copied from ddraw) */
268 typedef struct {
269 DWORD val;
270 const char* name;
271 } flag_info;
273 typedef struct {
274 const GUID *guid;
275 const char* name;
276 } guid_info;
278 /* used for initialising structs (primarily for DMUS_OBJECTDESC) */
279 #define DM_STRUCT_INIT(x) \
280 do { \
281 memset((x), 0, sizeof(*(x))); \
282 (x)->dwSize = sizeof(*x); \
283 } while (0)
285 #define FE(x) { x, #x }
286 #define GE(x) { &x, #x }
288 /* dwPatch from MIDILOCALE */
289 extern DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale);
290 /* MIDILOCALE from dwPatch */
291 extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale);
293 /* check whether the given DWORD is even (return 0) or odd (return 1) */
294 extern int even_or_odd (DWORD number);
295 /* FOURCC to string conversion for debug messages */
296 extern const char *debugstr_fourcc (DWORD fourcc);
297 /* returns name of given GUID */
298 extern const char *debugstr_dmguid (const GUID *id);
299 /* dump whole DMUS_OBJECTDESC struct */
300 extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc);
302 #endif /* __WINE_DMUSIC_PRIVATE_H */