2 * DirectMusic Private Include
4 * Copyright (C) 2003-2004 Rok Mandeljc
5 * Copyright (C) 2012 Christian Costa
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_DMUSIC_PRIVATE_H
23 #define __WINE_DMUSIC_PRIVATE_H
28 #define NONAMELESSUNION
29 #define NONAMELESSSTRUCT
37 #include "wine/debug.h"
38 #include "wine/list.h"
39 #include "wine/unicode.h"
48 /*****************************************************************************
51 typedef struct IDirectMusic8Impl IDirectMusic8Impl
;
52 typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl
;
53 typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl
;
54 typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl
;
55 typedef struct IReferenceClockImpl IReferenceClockImpl
;
57 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
;
74 typedef struct port_info
{
76 HRESULT (*create
)(IDirectMusic8Impl
*parent
, DMUS_PORTPARAMS
*port_params
,
77 DMUS_PORTCAPS
*port_caps
, IDirectMusicPort
**port
);
81 typedef struct instrument_region
{
89 typedef struct instrument_articulation
{
90 CONNECTIONLIST connections_list
;
91 CONNECTION
*connections
;
92 } instrument_articulation
;
94 /*****************************************************************************
99 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
100 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
103 extern HRESULT
DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc
, LPVOID
* ret_iface
) DECLSPEC_HIDDEN
;
104 extern HRESULT
DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
105 extern HRESULT
DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
106 extern HRESULT
DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
108 /*****************************************************************************
109 * IDirectMusic8Impl implementation structure
111 struct IDirectMusic8Impl
{
112 IDirectMusic8 IDirectMusic8_iface
;
114 IDirectSound
*dsound
;
115 IReferenceClockImpl
*master_clock
;
116 IDirectMusicPort
**ports
;
118 port_info
*system_ports
;
119 int num_system_ports
;
122 /*****************************************************************************
123 * IDirectMusicBufferImpl implementation structure
125 struct IDirectMusicBufferImpl
{
126 /* IUnknown fields */
127 IDirectMusicBuffer IDirectMusicBuffer_iface
;
130 /* IDirectMusicBufferImpl fields */
135 REFERENCE_TIME start_time
;
138 /*****************************************************************************
139 * IDirectMusicDownloadedInstrumentImpl implementation structure
141 struct IDirectMusicDownloadedInstrumentImpl
{
142 /* IUnknown fields */
143 IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface
;
146 /* IDirectMusicDownloadedInstrumentImpl fields */
151 /*****************************************************************************
152 * IDirectMusicDownloadImpl implementation structure
154 struct IDirectMusicDownloadImpl
{
155 /* IUnknown fields */
156 IDirectMusicDownload IDirectMusicDownload_iface
;
159 /* IDirectMusicDownloadImpl fields */
162 /** Internal factory */
163 extern HRESULT
synth_port_create(IDirectMusic8Impl
*parent
, DMUS_PORTPARAMS
*port_params
,
164 DMUS_PORTCAPS
*port_caps
, IDirectMusicPort
**port
) DECLSPEC_HIDDEN
;
165 extern HRESULT
midi_out_port_create(IDirectMusic8Impl
*parent
, DMUS_PORTPARAMS
*port_params
,
166 DMUS_PORTCAPS
*port_caps
, IDirectMusicPort
**port
) DECLSPEC_HIDDEN
;
167 extern HRESULT
midi_in_port_create(IDirectMusic8Impl
*parent
, DMUS_PORTPARAMS
*port_params
,
168 DMUS_PORTCAPS
*port_caps
, IDirectMusicPort
**port
) DECLSPEC_HIDDEN
;
170 /*****************************************************************************
171 * IReferenceClockImpl implementation structure
173 struct IReferenceClockImpl
{
174 /* IUnknown fields */
175 IReferenceClock IReferenceClock_iface
;
178 /* IReferenceClockImpl fields */
179 REFERENCE_TIME rtTime
;
180 DMUS_CLOCKINFO pClockInfo
;
183 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY
{
184 struct list entry
; /* for listing elements */
185 IDirectMusicInstrument
* pInstrument
;
186 } DMUS_PRIVATE_INSTRUMENTENTRY
, *LPDMUS_PRIVATE_INSTRUMENTENTRY
;
188 typedef struct _DMUS_PRIVATE_POOLCUE
{
189 struct list entry
; /* for listing elements */
190 } DMUS_PRIVATE_POOLCUE
, *LPDMUS_PRIVATE_POOLCUE
;
192 /*****************************************************************************
193 * IDirectMusicInstrumentImpl implementation structure
195 struct IDirectMusicInstrumentImpl
{
196 /* IUnknown fields */
197 IDirectMusicInstrument IDirectMusicInstrument_iface
;
200 /* IDirectMusicInstrumentImpl fields */
201 LARGE_INTEGER liInstrumentPosition
; /* offset in a stream where instrument chunk can be found */
202 ULONG length
; /* Length of the instrument in the stream */
205 WCHAR wszName
[DMUS_MAX_NAME
];
206 /* instrument data */
208 instrument_region
*regions
;
209 ULONG nb_articulations
;
210 instrument_articulation
*articulations
;
213 static inline IDirectMusicInstrumentImpl
*impl_from_IDirectMusicInstrument(IDirectMusicInstrument
*iface
)
215 return CONTAINING_RECORD(iface
, IDirectMusicInstrumentImpl
, IDirectMusicInstrument_iface
);
219 extern HRESULT
IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument
*iface
, IStream
*stream
) DECLSPEC_HIDDEN
;
221 /**********************************************************************
222 * Dll lifetime tracking declaration for dmusic.dll
224 extern LONG DMUSIC_refCount DECLSPEC_HIDDEN
;
225 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount
); }
226 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount
); }
229 /*****************************************************************************
232 void dmusic_remove_port(IDirectMusic8Impl
*dmusic
, IDirectMusicPort
*port
) DECLSPEC_HIDDEN
;
234 /* for simpler reading */
235 typedef struct _DMUS_PRIVATE_CHUNK
{
236 FOURCC fccID
; /* FOURCC ID of the chunk */
237 DWORD dwSize
; /* size of the chunk */
238 } DMUS_PRIVATE_CHUNK
, *LPDMUS_PRIVATE_CHUNK
;
240 /* used for generic dumping (copied from ddraw) */
251 #define FE(x) { x, #x }
252 #define GE(x) { &x, #x }
254 /* dwPatch from MIDILOCALE */
255 extern DWORD
MIDILOCALE2Patch (const MIDILOCALE
*pLocale
) DECLSPEC_HIDDEN
;
256 /* MIDILOCALE from dwPatch */
257 extern void Patch2MIDILOCALE (DWORD dwPatch
, LPMIDILOCALE pLocale
) DECLSPEC_HIDDEN
;
259 /* check whether the given DWORD is even (return 0) or odd (return 1) */
260 extern int even_or_odd (DWORD number
) DECLSPEC_HIDDEN
;
261 /* FOURCC to string conversion for debug messages */
262 extern const char *debugstr_fourcc (DWORD fourcc
) DECLSPEC_HIDDEN
;
263 /* returns name of given GUID */
264 extern const char *debugstr_dmguid (const GUID
*id
) DECLSPEC_HIDDEN
;
265 /* Dump whole DMUS_OBJECTDESC struct */
266 extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc
) DECLSPEC_HIDDEN
;
267 /* Dump whole DMUS_PORTPARAMS struct */
268 extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params
) DECLSPEC_HIDDEN
;
270 #endif /* __WINE_DMUSIC_PRIVATE_H */