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
33 #include "wine/debug.h"
34 #include "wine/list.h"
35 #include "wine/unicode.h"
43 /*****************************************************************************
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_
{
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 /*****************************************************************************
78 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
79 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
80 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
81 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
82 extern HRESULT WINAPI
DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
84 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicCollectionImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
85 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
87 /*****************************************************************************
88 * IDirectMusic8Impl implementation structure
90 struct IDirectMusic8Impl
{
92 const IDirectMusic8Vtbl
*lpVtbl
;
95 /* IDirectMusicImpl fields */
96 IReferenceClockImpl
* pMasterClock
;
97 IDirectMusicPort
** ppPorts
;
101 /*****************************************************************************
102 * IDirectMusicBufferImpl implementation structure
104 struct IDirectMusicBufferImpl
{
105 /* IUnknown fields */
106 const IDirectMusicBufferVtbl
*lpVtbl
;
109 /* IDirectMusicBufferImpl fields */
112 /*****************************************************************************
113 * IDirectMusicDownloadedInstrumentImpl implementation structure
115 struct IDirectMusicDownloadedInstrumentImpl
{
116 /* IUnknown fields */
117 const IDirectMusicDownloadedInstrumentVtbl
*lpVtbl
;
120 /* IDirectMusicDownloadedInstrumentImpl fields */
123 /*****************************************************************************
124 * IDirectMusicDownloadImpl implementation structure
126 struct IDirectMusicDownloadImpl
{
127 /* IUnknown fields */
128 const IDirectMusicDownloadVtbl
*lpVtbl
;
131 /* IDirectMusicDownloadImpl fields */
134 /*****************************************************************************
135 * IDirectMusicPortImpl implementation structure
137 struct IDirectMusicPortImpl
{
138 /* IUnknown fields */
139 const IDirectMusicPortVtbl
*lpVtbl
;
140 const IDirectMusicPortDownloadVtbl
*lpDownloadVtbl
;
141 const IDirectMusicThruVtbl
*lpThruVtbl
;
144 /* IDirectMusicPortImpl fields */
145 IDirectSound
* pDirectSound
;
146 IReferenceClock
* pLatencyClock
;
149 DMUS_PORTPARAMS params
;
151 DMUSIC_PRIVATE_CHANNEL_GROUP group
[1];
154 /** Internal factory */
155 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID
, LPVOID
*ppobj
, LPUNKNOWN pUnkOuter
, LPDMUS_PORTPARAMS pPortParams
, LPDMUS_PORTCAPS pPortCaps
) DECLSPEC_HIDDEN
;
157 /*****************************************************************************
158 * IReferenceClockImpl implementation structure
160 struct IReferenceClockImpl
{
161 /* IUnknown fields */
162 const IReferenceClockVtbl
*lpVtbl
;
165 /* IReferenceClockImpl fields */
166 REFERENCE_TIME rtTime
;
167 DMUS_CLOCKINFO pClockInfo
;
170 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY
{
171 struct list entry
; /* for listing elements */
172 IDirectMusicInstrument
* pInstrument
;
173 } DMUS_PRIVATE_INSTRUMENTENTRY
, *LPDMUS_PRIVATE_INSTRUMENTENTRY
;
175 typedef struct _DMUS_PRIVATE_POOLCUE
{
176 struct list entry
; /* for listing elements */
177 } DMUS_PRIVATE_POOLCUE
, *LPDMUS_PRIVATE_POOLCUE
;
179 /*****************************************************************************
180 * IDirectMusicCollectionImpl implementation structure
182 struct IDirectMusicCollectionImpl
{
183 /* IUnknown fields */
184 const IUnknownVtbl
*UnknownVtbl
;
185 const IDirectMusicCollectionVtbl
*CollectionVtbl
;
186 const IDirectMusicObjectVtbl
*ObjectVtbl
;
187 const IPersistStreamVtbl
*PersistStreamVtbl
;
190 /* IDirectMusicCollectionImpl fields */
191 IStream
*pStm
; /* stream from which we load collection and later instruments */
192 LARGE_INTEGER liCollectionPosition
; /* offset in a stream where collection was loaded from */
193 LARGE_INTEGER liWavePoolTablePosition
; /* offset in a stream where wave pool table can be found */
194 LPDMUS_OBJECTDESC pDesc
;
195 CHAR
* szCopyright
; /* FIXME: should probably placed somewhere else */
198 LPPOOLTABLE pPoolTable
;
201 struct list Instruments
;
204 /*****************************************************************************
205 * IDirectMusicInstrumentImpl implementation structure
207 struct IDirectMusicInstrumentImpl
{
208 /* IUnknown fields */
209 const IUnknownVtbl
*UnknownVtbl
;
210 const IDirectMusicInstrumentVtbl
*InstrumentVtbl
;
213 /* IDirectMusicInstrumentImpl fields */
214 LARGE_INTEGER liInstrumentPosition
; /* offset in a stream where instrument chunk can be found */
215 LPGUID pInstrumentID
;
216 LPINSTHEADER pHeader
;
217 WCHAR wszName
[DMUS_MAX_NAME
];
218 /* instrument data */
222 extern HRESULT WINAPI
IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface
, LPSTREAM pStm
) DECLSPEC_HIDDEN
;
224 /**********************************************************************
225 * Dll lifetime tracking declaration for dmusic.dll
227 extern LONG DMUSIC_refCount DECLSPEC_HIDDEN
;
228 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount
); }
229 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount
); }
232 /*****************************************************************************
235 /* my custom ICOM stuff */
236 #define ICOM_NAME_MULTI(impl,field,iface,name) impl* const name=(impl*)((char*)(iface) - offsetof(impl,field))
237 #define ICOM_THIS_MULTI(impl,field,iface) ICOM_NAME_MULTI(impl,field,iface,This)
239 /* for simpler reading */
240 typedef struct _DMUS_PRIVATE_CHUNK
{
241 FOURCC fccID
; /* FOURCC ID of the chunk */
242 DWORD dwSize
; /* size of the chunk */
243 } DMUS_PRIVATE_CHUNK
, *LPDMUS_PRIVATE_CHUNK
;
245 /* used for generic dumping (copied from ddraw) */
256 /* used for initialising structs (primarily for DMUS_OBJECTDESC) */
257 #define DM_STRUCT_INIT(x) \
259 memset((x), 0, sizeof(*(x))); \
260 (x)->dwSize = sizeof(*x); \
263 #define FE(x) { x, #x }
264 #define GE(x) { &x, #x }
266 /* dwPatch from MIDILOCALE */
267 extern DWORD
MIDILOCALE2Patch (const MIDILOCALE
*pLocale
) DECLSPEC_HIDDEN
;
268 /* MIDILOCALE from dwPatch */
269 extern void Patch2MIDILOCALE (DWORD dwPatch
, LPMIDILOCALE pLocale
) DECLSPEC_HIDDEN
;
271 /* check whether the given DWORD is even (return 0) or odd (return 1) */
272 extern int even_or_odd (DWORD number
) DECLSPEC_HIDDEN
;
273 /* FOURCC to string conversion for debug messages */
274 extern const char *debugstr_fourcc (DWORD fourcc
) DECLSPEC_HIDDEN
;
275 /* returns name of given GUID */
276 extern const char *debugstr_dmguid (const GUID
*id
) DECLSPEC_HIDDEN
;
277 /* Dump whole DMUS_OBJECTDESC struct */
278 extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc
) DECLSPEC_HIDDEN
;
280 #endif /* __WINE_DMUSIC_PRIVATE_H */