d3dx9/tests: Add basic tests for ID3DXRenderToEnvMap.
[wine/multimedia.git] / dlls / dmusic / dmusic_private.h
blob0572a824aaebcee5d529a3e9b6bf67c47ae947ad
1 /*
2 * DirectMusic Private Include
4 * Copyright (C) 2003-2004 Rok Mandeljc
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_DMUSIC_PRIVATE_H
22 #define __WINE_DMUSIC_PRIVATE_H
24 #include <stdarg.h>
26 #define COBJMACROS
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winnt.h"
31 #include "wingdi.h"
32 #include "winuser.h"
34 #include "wine/debug.h"
35 #include "wine/list.h"
36 #include "wine/unicode.h"
37 #include "winreg.h"
38 #include "objbase.h"
40 #include "dmusici.h"
41 #include "dmusicf.h"
42 #include "dmusics.h"
44 /*****************************************************************************
45 * Interfaces
47 typedef struct IDirectMusic8Impl IDirectMusic8Impl;
48 typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
49 typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
50 typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
51 typedef struct IDirectMusicPortDownloadImpl IDirectMusicPortDownloadImpl;
52 typedef struct IDirectMusicPortImpl IDirectMusicPortImpl;
53 typedef struct IDirectMusicThruImpl IDirectMusicThruImpl;
54 typedef struct IReferenceClockImpl IReferenceClockImpl;
56 typedef struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl;
57 typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
60 /*****************************************************************************
61 * Some stuff to make my life easier :=)
64 /* some sort of aux. midi channel: big fake at the moment; accepts only priority
65 changes... more coming soon */
66 typedef struct DMUSIC_PRIVATE_MCHANNEL_ {
67 DWORD priority;
68 } DMUSIC_PRIVATE_MCHANNEL, *LPDMUSIC_PRIVATE_MCHANNEL;
70 /* some sort of aux. channel group: collection of 16 midi channels */
71 typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
72 DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
73 } DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
76 /*****************************************************************************
77 * ClassFactory
80 /* CLSID */
81 extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
82 extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
84 /* Internal */
85 extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) DECLSPEC_HIDDEN;
86 extern HRESULT DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
87 extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
88 extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
89 extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
91 /*****************************************************************************
92 * IDirectMusic8Impl implementation structure
94 struct IDirectMusic8Impl {
95 /* IUnknown fields */
96 IDirectMusic8 IDirectMusic8_iface;
97 LONG ref;
99 /* IDirectMusicImpl fields */
100 IReferenceClockImpl* pMasterClock;
101 IDirectMusicPort** ppPorts;
102 int nrofports;
105 /*****************************************************************************
106 * IDirectMusicBufferImpl implementation structure
108 struct IDirectMusicBufferImpl {
109 /* IUnknown fields */
110 IDirectMusicBuffer IDirectMusicBuffer_iface;
111 LONG ref;
113 /* IDirectMusicBufferImpl fields */
114 GUID format;
115 DWORD size;
116 LPBYTE data;
117 DWORD write_pos;
118 REFERENCE_TIME start_time;
121 /*****************************************************************************
122 * IDirectMusicDownloadedInstrumentImpl implementation structure
124 struct IDirectMusicDownloadedInstrumentImpl {
125 /* IUnknown fields */
126 const IDirectMusicDownloadedInstrumentVtbl *lpVtbl;
127 LONG ref;
129 /* IDirectMusicDownloadedInstrumentImpl fields */
132 /*****************************************************************************
133 * IDirectMusicDownloadImpl implementation structure
135 struct IDirectMusicDownloadImpl {
136 /* IUnknown fields */
137 const IDirectMusicDownloadVtbl *lpVtbl;
138 LONG ref;
140 /* IDirectMusicDownloadImpl fields */
143 /*****************************************************************************
144 * IDirectMusicPortImpl implementation structure
146 struct IDirectMusicPortImpl {
147 /* IUnknown fields */
148 IDirectMusicPort IDirectMusicPort_iface;
149 IDirectMusicPortDownload IDirectMusicPortDownload_iface;
150 IDirectMusicThru IDirectMusicThru_iface;
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 /** Internal factory */
164 extern HRESULT DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps) DECLSPEC_HIDDEN;
166 /*****************************************************************************
167 * IReferenceClockImpl implementation structure
169 struct IReferenceClockImpl {
170 /* IUnknown fields */
171 IReferenceClock IReferenceClock_iface;
172 LONG ref;
174 /* IReferenceClockImpl fields */
175 REFERENCE_TIME rtTime;
176 DMUS_CLOCKINFO pClockInfo;
179 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
180 struct list entry; /* for listing elements */
181 IDirectMusicInstrument* pInstrument;
182 } DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
184 typedef struct _DMUS_PRIVATE_POOLCUE {
185 struct list entry; /* for listing elements */
186 } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
188 /*****************************************************************************
189 * IDirectMusicCollectionImpl implementation structure
191 struct IDirectMusicCollectionImpl {
192 /* IUnknown fields */
193 IDirectMusicCollection IDirectMusicCollection_iface;
194 IDirectMusicObject IDirectMusicObject_iface;
195 IPersistStream IPersistStream_iface;
196 LONG ref;
198 /* IDirectMusicCollectionImpl fields */
199 IStream *pStm; /* stream from which we load collection and later instruments */
200 LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
201 LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
202 LPDMUS_OBJECTDESC pDesc;
203 CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
204 LPDLSHEADER pHeader;
205 /* pool table */
206 LPPOOLTABLE pPoolTable;
207 LPPOOLCUE pPoolCues;
208 /* instruments */
209 struct list Instruments;
212 /*****************************************************************************
213 * IDirectMusicInstrumentImpl implementation structure
215 struct IDirectMusicInstrumentImpl {
216 /* IUnknown fields */
217 IDirectMusicInstrument IDirectMusicInstrument_iface;
218 LONG ref;
220 /* IDirectMusicInstrumentImpl fields */
221 LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
222 LPGUID pInstrumentID;
223 LPINSTHEADER pHeader;
224 WCHAR wszName[DMUS_MAX_NAME];
225 /* instrument data */
228 static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
230 return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface);
233 /* custom :) */
234 extern HRESULT IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm) DECLSPEC_HIDDEN;
236 /**********************************************************************
237 * Dll lifetime tracking declaration for dmusic.dll
239 extern LONG DMUSIC_refCount DECLSPEC_HIDDEN;
240 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
241 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
244 /*****************************************************************************
245 * Misc.
247 /* my custom ICOM stuff */
248 #define ICOM_NAME_MULTI(impl,field,iface,name) impl* const name=(impl*)((char*)(iface) - offsetof(impl,field))
249 #define ICOM_THIS_MULTI(impl,field,iface) ICOM_NAME_MULTI(impl,field,iface,This)
251 /* for simpler reading */
252 typedef struct _DMUS_PRIVATE_CHUNK {
253 FOURCC fccID; /* FOURCC ID of the chunk */
254 DWORD dwSize; /* size of the chunk */
255 } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
257 /* used for generic dumping (copied from ddraw) */
258 typedef struct {
259 DWORD val;
260 const char* name;
261 } flag_info;
263 typedef struct {
264 const GUID *guid;
265 const char* name;
266 } guid_info;
268 /* used for initialising structs (primarily for DMUS_OBJECTDESC) */
269 #define DM_STRUCT_INIT(x) \
270 do { \
271 memset((x), 0, sizeof(*(x))); \
272 (x)->dwSize = sizeof(*x); \
273 } while (0)
275 #define FE(x) { x, #x }
276 #define GE(x) { &x, #x }
278 /* dwPatch from MIDILOCALE */
279 extern DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) DECLSPEC_HIDDEN;
280 /* MIDILOCALE from dwPatch */
281 extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale) DECLSPEC_HIDDEN;
283 /* check whether the given DWORD is even (return 0) or odd (return 1) */
284 extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
285 /* FOURCC to string conversion for debug messages */
286 extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
287 /* returns name of given GUID */
288 extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
289 /* Dump whole DMUS_OBJECTDESC struct */
290 extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN;
291 /* Dump whole DMUS_PORTPARAMS struct */
292 extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) DECLSPEC_HIDDEN;
294 #endif /* __WINE_DMUSIC_PRIVATE_H */