Store the SysIP property using a string to avoid trouble with 16-bit
[wine/wine64.git] / dlls / dmusic / dmusic_private.h
blob48092b36ce1d1ccbbdf6cb98f31812b312a3b17d
1 /* DirectMusic Private Include
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (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
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 * Predeclare the interface implementation structures
62 extern const IDirectMusicPortVtbl DirectMusicPort_Vtbl;
64 /*****************************************************************************
65 * Some stuff to make my life easier :=)
68 /* some sort of aux. midi channel: big fake at the moment; accepts only priority
69 changes... more coming soon */
70 typedef struct DMUSIC_PRIVATE_MCHANNEL_ {
71 DWORD priority;
72 } DMUSIC_PRIVATE_MCHANNEL, *LPDMUSIC_PRIVATE_MCHANNEL;
74 /* some sort of aux. channel group: collection of 16 midi channels */
75 typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
76 DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
77 } DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
80 /*****************************************************************************
81 * ClassFactory
83 extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
84 extern HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
85 extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
86 extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
87 extern HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
89 extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
90 extern HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
92 /*****************************************************************************
93 * IDirectMusic8Impl implementation structure
95 struct IDirectMusic8Impl {
96 /* IUnknown fields */
97 const IDirectMusic8Vtbl *lpVtbl;
98 LONG ref;
100 /* IDirectMusicImpl fields */
101 IReferenceClockImpl* pMasterClock;
102 IDirectMusicPortImpl** ppPorts;
103 int nrofports;
106 /* IUnknown: */
107 extern ULONG WINAPI IDirectMusic8Impl_AddRef (LPDIRECTMUSIC8 iface);
109 /*****************************************************************************
110 * IDirectMusicBufferImpl implementation structure
112 struct IDirectMusicBufferImpl {
113 /* IUnknown fields */
114 const IDirectMusicBufferVtbl *lpVtbl;
115 LONG ref;
117 /* IDirectMusicBufferImpl fields */
120 /* IUnknown: */
121 extern ULONG WINAPI IDirectMusicBufferImpl_AddRef (LPDIRECTMUSICBUFFER iface);
123 /*****************************************************************************
124 * IDirectMusicDownloadedInstrumentImpl implementation structure
126 struct IDirectMusicDownloadedInstrumentImpl {
127 /* IUnknown fields */
128 const IDirectMusicDownloadedInstrumentVtbl *lpVtbl;
129 LONG ref;
131 /* IDirectMusicDownloadedInstrumentImpl fields */
134 /* IUnknown: */
135 extern ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface);
136 /* IDirectMusicDownloadedInstrumentImpl: */
137 /* none yet */
139 /*****************************************************************************
140 * IDirectMusicDownloadImpl implementation structure
142 struct IDirectMusicDownloadImpl {
143 /* IUnknown fields */
144 const IDirectMusicDownloadVtbl *lpVtbl;
145 LONG ref;
147 /* IDirectMusicDownloadImpl fields */
150 /* IUnknown: */
151 extern ULONG WINAPI IDirectMusicDownloadImpl_AddRef (LPDIRECTMUSICDOWNLOAD iface);
153 /*****************************************************************************
154 * IDirectMusicPortDownloadImpl implementation structure
156 struct IDirectMusicPortDownloadImpl {
157 /* IUnknown fields */
158 const IDirectMusicPortDownloadVtbl *lpVtbl;
159 LONG ref;
161 /* IDirectMusicPortDownloadImpl fields */
164 /* IUnknown: */
165 extern ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface);
167 /*****************************************************************************
168 * IDirectMusicPortImpl implementation structure
170 struct IDirectMusicPortImpl {
171 /* IUnknown fields */
172 const IDirectMusicPortVtbl *lpVtbl;
173 LONG ref;
175 /* IDirectMusicPortImpl fields */
176 IDirectSound* pDirectSound;
177 IReferenceClock* pLatencyClock;
178 BOOL fActive;
179 LPDMUS_PORTCAPS pCaps;
180 LPDMUS_PORTPARAMS pParams;
181 int nrofgroups;
182 DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
185 /* IUnknown: */
186 extern ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface);
188 /*****************************************************************************
189 * IDirectMusicThruImpl implementation structure
191 struct IDirectMusicThruImpl {
192 /* IUnknown fields */
193 const IDirectMusicThruVtbl *lpVtbl;
194 LONG ref;
196 /* IDirectMusicThruImpl fields */
199 /* IUnknown: */
200 extern ULONG WINAPI IDirectMusicThruImpl_AddRef (LPDIRECTMUSICTHRU iface);
202 /*****************************************************************************
203 * IReferenceClockImpl implementation structure
205 struct IReferenceClockImpl {
206 /* IUnknown fields */
207 const IReferenceClockVtbl *lpVtbl;
208 LONG ref;
210 /* IReferenceClockImpl fields */
211 REFERENCE_TIME rtTime;
212 DMUS_CLOCKINFO pClockInfo;
215 /* IUnknown: */
216 extern ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface);
218 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
219 struct list entry; /* for listing elements */
220 IDirectMusicInstrument* pInstrument;
221 } DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
223 typedef struct _DMUS_PRIVATE_POOLCUE {
224 struct list entry; /* for listing elements */
225 } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
227 /*****************************************************************************
228 * IDirectMusicCollectionImpl implementation structure
230 struct IDirectMusicCollectionImpl {
231 /* IUnknown fields */
232 const IUnknownVtbl *UnknownVtbl;
233 const IDirectMusicCollectionVtbl *CollectionVtbl;
234 const IDirectMusicObjectVtbl *ObjectVtbl;
235 const IPersistStreamVtbl *PersistStreamVtbl;
236 LONG ref;
238 /* IDirectMusicCollectionImpl fields */
239 IStream *pStm; /* stream from which we load collection and later instruments */
240 LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
241 LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
242 LPDMUS_OBJECTDESC pDesc;
243 CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
244 LPDLSHEADER pHeader;
245 /* pool table */
246 LPPOOLTABLE pPoolTable;
247 LPPOOLCUE pPoolCues;
248 /* instruments */
249 struct list Instruments;
252 /* IUnknown: */
253 extern ULONG WINAPI IDirectMusicCollectionImpl_IUnknown_AddRef (LPUNKNOWN iface);
254 /* IDirectMusicCollection: */
255 extern ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef (LPDIRECTMUSICCOLLECTION iface);
256 /* IDirectMusicObject: */
257 extern ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface);
258 /* IPersistStream: */
259 extern ULONG WINAPI IDirectMusicCollectionImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface);
261 /*****************************************************************************
262 * IDirectMusicInstrumentImpl implementation structure
264 struct IDirectMusicInstrumentImpl {
265 /* IUnknown fields */
266 const IUnknownVtbl *UnknownVtbl;
267 const IDirectMusicInstrumentVtbl *InstrumentVtbl;
268 LONG ref;
270 /* IDirectMusicInstrumentImpl fields */
271 LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
272 LPGUID pInstrumentID;
273 LPINSTHEADER pHeader;
274 WCHAR wszName[DMUS_MAX_NAME];
275 /* instrument data */
278 /* IUnknown: */
279 extern ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface);
280 /* IDirectMusicInstrumentImpl: */
281 extern ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef (LPDIRECTMUSICINSTRUMENT iface);
282 /* custom :) */
283 extern HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm);
285 /**********************************************************************
286 * Dll lifetime tracking declaration for dmusic.dll
288 extern LONG DMUSIC_refCount;
289 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
290 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
292 /*****************************************************************************
293 * Helper Functions
295 void register_waveport (LPGUID lpGUID, LPCSTR lpszDesc, LPCSTR lpszDrvName, LPVOID lpContext);
298 /*****************************************************************************
299 * Misc.
301 /* my custom ICOM stuff */
302 #define ICOM_NAME_MULTI(impl,field,iface,name) impl* const name=(impl*)((char*)(iface) - offsetof(impl,field))
303 #define ICOM_THIS_MULTI(impl,field,iface) ICOM_NAME_MULTI(impl,field,iface,This)
305 /* for simpler reading */
306 typedef struct _DMUS_PRIVATE_CHUNK {
307 FOURCC fccID; /* FOURCC ID of the chunk */
308 DWORD dwSize; /* size of the chunk */
309 } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
311 /* used for generic dumping (copied from ddraw) */
312 typedef struct {
313 DWORD val;
314 const char* name;
315 } flag_info;
317 typedef struct {
318 const GUID *guid;
319 const char* name;
320 } guid_info;
322 /* used for initialising structs (primarily for DMUS_OBJECTDESC) */
323 #define DM_STRUCT_INIT(x) \
324 do { \
325 memset((x), 0, sizeof(*(x))); \
326 (x)->dwSize = sizeof(*x); \
327 } while (0)
329 #define FE(x) { x, #x }
330 #define GE(x) { &x, #x }
332 /* dwPatch from MIDILOCALE */
333 extern DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale);
334 /* MIDILOCALE from dwPatch */
335 extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale);
337 /* check whether the given DWORD is even (return 0) or odd (return 1) */
338 extern int even_or_odd (DWORD number);
339 /* FOURCC to string conversion for debug messages */
340 extern const char *debugstr_fourcc (DWORD fourcc);
341 /* DMUS_VERSION struct to string conversion for debug messages */
342 extern const char *debugstr_dmversion (LPDMUS_VERSION version);
343 /* returns name of given GUID */
344 extern const char *debugstr_dmguid (const GUID *id);
345 /* returns name of given error code */
346 extern const char *debugstr_dmreturn (DWORD code);
347 /* generic flags-dumping function */
348 extern const char *debugstr_flags (DWORD flags, const flag_info* names, size_t num_names);
349 extern const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask);
350 /* dump whole DMUS_OBJECTDESC struct */
351 extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc);
353 #endif /* __WINE_DMUSIC_PRIVATE_H */