mshtml: Added PutProperty implementation.
[wine/winequartzdrv.git] / dlls / dmusic / dmusic_private.h
blob541e44909a2b04344fc605a7e7a23eb6d974dc94
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 * 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 IDirectMusicPort** ppPorts;
103 int nrofports;
106 /*****************************************************************************
107 * IDirectMusicBufferImpl implementation structure
109 struct IDirectMusicBufferImpl {
110 /* IUnknown fields */
111 const IDirectMusicBufferVtbl *lpVtbl;
112 LONG ref;
114 /* IDirectMusicBufferImpl fields */
117 /*****************************************************************************
118 * IDirectMusicDownloadedInstrumentImpl implementation structure
120 struct IDirectMusicDownloadedInstrumentImpl {
121 /* IUnknown fields */
122 const IDirectMusicDownloadedInstrumentVtbl *lpVtbl;
123 LONG ref;
125 /* IDirectMusicDownloadedInstrumentImpl fields */
128 /*****************************************************************************
129 * IDirectMusicDownloadImpl implementation structure
131 struct IDirectMusicDownloadImpl {
132 /* IUnknown fields */
133 const IDirectMusicDownloadVtbl *lpVtbl;
134 LONG ref;
136 /* IDirectMusicDownloadImpl fields */
139 /*****************************************************************************
140 * IDirectMusicPortDownloadImpl implementation structure
142 struct IDirectMusicPortDownloadImpl {
143 /* IUnknown fields */
144 const IDirectMusicPortDownloadVtbl *lpVtbl;
145 LONG ref;
147 /* IDirectMusicPortDownloadImpl fields */
150 /*****************************************************************************
151 * IDirectMusicPortImpl implementation structure
153 struct IDirectMusicPortImpl {
154 /* IUnknown fields */
155 const IDirectMusicPortVtbl *lpVtbl;
156 LONG ref;
158 /* IDirectMusicPortImpl fields */
159 IDirectSound* pDirectSound;
160 IReferenceClock* pLatencyClock;
161 BOOL fActive;
162 DMUS_PORTCAPS caps;
163 DMUS_PORTPARAMS params;
164 int nrofgroups;
165 DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
168 extern HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive);
170 /** Internal factory */
171 extern HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps);
173 /*****************************************************************************
174 * IDirectMusicThruImpl implementation structure
176 struct IDirectMusicThruImpl {
177 /* IUnknown fields */
178 const IDirectMusicThruVtbl *lpVtbl;
179 LONG ref;
181 /* IDirectMusicThruImpl fields */
184 /*****************************************************************************
185 * IReferenceClockImpl implementation structure
187 struct IReferenceClockImpl {
188 /* IUnknown fields */
189 const IReferenceClockVtbl *lpVtbl;
190 LONG ref;
192 /* IReferenceClockImpl fields */
193 REFERENCE_TIME rtTime;
194 DMUS_CLOCKINFO pClockInfo;
197 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
198 struct list entry; /* for listing elements */
199 IDirectMusicInstrument* pInstrument;
200 } DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
202 typedef struct _DMUS_PRIVATE_POOLCUE {
203 struct list entry; /* for listing elements */
204 } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
206 /*****************************************************************************
207 * IDirectMusicCollectionImpl implementation structure
209 struct IDirectMusicCollectionImpl {
210 /* IUnknown fields */
211 const IUnknownVtbl *UnknownVtbl;
212 const IDirectMusicCollectionVtbl *CollectionVtbl;
213 const IDirectMusicObjectVtbl *ObjectVtbl;
214 const IPersistStreamVtbl *PersistStreamVtbl;
215 LONG ref;
217 /* IDirectMusicCollectionImpl fields */
218 IStream *pStm; /* stream from which we load collection and later instruments */
219 LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
220 LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
221 LPDMUS_OBJECTDESC pDesc;
222 CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
223 LPDLSHEADER pHeader;
224 /* pool table */
225 LPPOOLTABLE pPoolTable;
226 LPPOOLCUE pPoolCues;
227 /* instruments */
228 struct list Instruments;
231 /*****************************************************************************
232 * IDirectMusicInstrumentImpl implementation structure
234 struct IDirectMusicInstrumentImpl {
235 /* IUnknown fields */
236 const IUnknownVtbl *UnknownVtbl;
237 const IDirectMusicInstrumentVtbl *InstrumentVtbl;
238 LONG ref;
240 /* IDirectMusicInstrumentImpl fields */
241 LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
242 LPGUID pInstrumentID;
243 LPINSTHEADER pHeader;
244 WCHAR wszName[DMUS_MAX_NAME];
245 /* instrument data */
248 /* custom :) */
249 extern HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm);
251 /**********************************************************************
252 * Dll lifetime tracking declaration for dmusic.dll
254 extern LONG DMUSIC_refCount;
255 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
256 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
258 /*****************************************************************************
259 * Helper Functions
261 void register_waveport (LPGUID lpGUID, LPCSTR lpszDesc, LPCSTR lpszDrvName, LPVOID lpContext);
264 /*****************************************************************************
265 * Misc.
267 /* my custom ICOM stuff */
268 #define ICOM_NAME_MULTI(impl,field,iface,name) impl* const name=(impl*)((char*)(iface) - offsetof(impl,field))
269 #define ICOM_THIS_MULTI(impl,field,iface) ICOM_NAME_MULTI(impl,field,iface,This)
271 /* for simpler reading */
272 typedef struct _DMUS_PRIVATE_CHUNK {
273 FOURCC fccID; /* FOURCC ID of the chunk */
274 DWORD dwSize; /* size of the chunk */
275 } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
277 /* used for generic dumping (copied from ddraw) */
278 typedef struct {
279 DWORD val;
280 const char* name;
281 } flag_info;
283 typedef struct {
284 const GUID *guid;
285 const char* name;
286 } guid_info;
288 /* used for initialising structs (primarily for DMUS_OBJECTDESC) */
289 #define DM_STRUCT_INIT(x) \
290 do { \
291 memset((x), 0, sizeof(*(x))); \
292 (x)->dwSize = sizeof(*x); \
293 } while (0)
295 #define FE(x) { x, #x }
296 #define GE(x) { &x, #x }
298 /* dwPatch from MIDILOCALE */
299 extern DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale);
300 /* MIDILOCALE from dwPatch */
301 extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale);
303 /* check whether the given DWORD is even (return 0) or odd (return 1) */
304 extern int even_or_odd (DWORD number);
305 /* FOURCC to string conversion for debug messages */
306 extern const char *debugstr_fourcc (DWORD fourcc);
307 /* DMUS_VERSION struct to string conversion for debug messages */
308 extern const char *debugstr_dmversion (const DMUS_VERSION *version);
309 /* returns name of given GUID */
310 extern const char *debugstr_dmguid (const GUID *id);
311 /* returns name of given error code */
312 extern const char *debugstr_dmreturn (DWORD code);
313 /* generic flags-dumping function */
314 extern const char *debugstr_flags (DWORD flags, const flag_info* names, size_t num_names);
315 extern const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask);
316 /* dump whole DMUS_OBJECTDESC struct */
317 extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc);
319 #endif /* __WINE_DMUSIC_PRIVATE_H */