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"
47 /*****************************************************************************
50 typedef struct IDirectMusic8Impl IDirectMusic8Impl
;
51 typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl
;
52 typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl
;
53 typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl
;
54 typedef struct IReferenceClockImpl IReferenceClockImpl
;
56 typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl
;
58 /*****************************************************************************
59 * Some stuff to make my life easier :=)
62 /* some sort of aux. midi channel: big fake at the moment; accepts only priority
63 changes... more coming soon */
64 typedef struct DMUSIC_PRIVATE_MCHANNEL_
{
66 } DMUSIC_PRIVATE_MCHANNEL
, *LPDMUSIC_PRIVATE_MCHANNEL
;
68 /* some sort of aux. channel group: collection of 16 midi channels */
69 typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_
{
70 DMUSIC_PRIVATE_MCHANNEL channel
[16]; /* 16 channels in a group */
71 } DMUSIC_PRIVATE_CHANNEL_GROUP
, *LPDMUSIC_PRIVATE_CHANNEL_GROUP
;
73 typedef struct port_info
{
75 HRESULT (*create
)(IDirectMusic8Impl
*parent
, DMUS_PORTPARAMS
*port_params
,
76 DMUS_PORTCAPS
*port_caps
, IDirectMusicPort
**port
);
80 typedef struct instrument_region
{
88 typedef struct instrument_articulation
{
89 CONNECTIONLIST connections_list
;
90 CONNECTION
*connections
;
91 } instrument_articulation
;
93 /*****************************************************************************
98 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
99 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
102 extern HRESULT
DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc
, LPVOID
* ret_iface
) DECLSPEC_HIDDEN
;
103 extern HRESULT
DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
104 extern HRESULT
DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
105 extern HRESULT
DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) DECLSPEC_HIDDEN
;
107 /*****************************************************************************
108 * IDirectMusic8Impl implementation structure
110 struct IDirectMusic8Impl
{
111 IDirectMusic8 IDirectMusic8_iface
;
113 IDirectSound
*dsound
;
114 IReferenceClock
*master_clock
;
115 IDirectMusicPort
**ports
;
117 port_info
*system_ports
;
118 int num_system_ports
;
121 /*****************************************************************************
122 * IDirectMusicBufferImpl implementation structure
124 struct IDirectMusicBufferImpl
{
125 /* IUnknown fields */
126 IDirectMusicBuffer IDirectMusicBuffer_iface
;
129 /* IDirectMusicBufferImpl fields */
134 REFERENCE_TIME start_time
;
137 /*****************************************************************************
138 * IDirectMusicDownloadedInstrumentImpl implementation structure
140 struct IDirectMusicDownloadedInstrumentImpl
{
141 /* IUnknown fields */
142 IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface
;
145 /* IDirectMusicDownloadedInstrumentImpl fields */
150 /*****************************************************************************
151 * IDirectMusicDownloadImpl implementation structure
153 struct IDirectMusicDownloadImpl
{
154 /* IUnknown fields */
155 IDirectMusicDownload IDirectMusicDownload_iface
;
158 /* IDirectMusicDownloadImpl fields */
161 /** Internal factory */
162 extern HRESULT
synth_port_create(IDirectMusic8Impl
*parent
, DMUS_PORTPARAMS
*port_params
,
163 DMUS_PORTCAPS
*port_caps
, IDirectMusicPort
**port
) DECLSPEC_HIDDEN
;
164 extern HRESULT
midi_out_port_create(IDirectMusic8Impl
*parent
, DMUS_PORTPARAMS
*port_params
,
165 DMUS_PORTCAPS
*port_caps
, IDirectMusicPort
**port
) DECLSPEC_HIDDEN
;
166 extern HRESULT
midi_in_port_create(IDirectMusic8Impl
*parent
, DMUS_PORTPARAMS
*port_params
,
167 DMUS_PORTCAPS
*port_caps
, IDirectMusicPort
**port
) DECLSPEC_HIDDEN
;
169 /*****************************************************************************
170 * IReferenceClockImpl implementation structure
172 struct IReferenceClockImpl
{
173 /* IUnknown fields */
174 IReferenceClock IReferenceClock_iface
;
177 /* IReferenceClockImpl fields */
178 REFERENCE_TIME rtTime
;
179 DMUS_CLOCKINFO pClockInfo
;
182 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY
{
183 struct list entry
; /* for listing elements */
184 IDirectMusicInstrument
* pInstrument
;
185 } DMUS_PRIVATE_INSTRUMENTENTRY
, *LPDMUS_PRIVATE_INSTRUMENTENTRY
;
187 typedef struct _DMUS_PRIVATE_POOLCUE
{
188 struct list entry
; /* for listing elements */
189 } DMUS_PRIVATE_POOLCUE
, *LPDMUS_PRIVATE_POOLCUE
;
191 /*****************************************************************************
192 * IDirectMusicInstrumentImpl implementation structure
194 struct IDirectMusicInstrumentImpl
{
195 /* IUnknown fields */
196 IDirectMusicInstrument IDirectMusicInstrument_iface
;
199 /* IDirectMusicInstrumentImpl fields */
200 LARGE_INTEGER liInstrumentPosition
; /* offset in a stream where instrument chunk can be found */
201 ULONG length
; /* Length of the instrument in the stream */
204 WCHAR wszName
[DMUS_MAX_NAME
];
205 /* instrument data */
207 instrument_region
*regions
;
208 ULONG nb_articulations
;
209 instrument_articulation
*articulations
;
212 static inline IDirectMusicInstrumentImpl
*impl_from_IDirectMusicInstrument(IDirectMusicInstrument
*iface
)
214 return CONTAINING_RECORD(iface
, IDirectMusicInstrumentImpl
, IDirectMusicInstrument_iface
);
218 extern HRESULT
IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument
*iface
, IStream
*stream
) DECLSPEC_HIDDEN
;
220 /**********************************************************************
221 * Dll lifetime tracking declaration for dmusic.dll
223 extern LONG DMUSIC_refCount DECLSPEC_HIDDEN
;
224 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount
); }
225 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount
); }
228 /*****************************************************************************
231 void dmusic_remove_port(IDirectMusic8Impl
*dmusic
, IDirectMusicPort
*port
) DECLSPEC_HIDDEN
;
233 /* for simpler reading */
234 typedef struct _DMUS_PRIVATE_CHUNK
{
235 FOURCC fccID
; /* FOURCC ID of the chunk */
236 DWORD dwSize
; /* size of the chunk */
237 } DMUS_PRIVATE_CHUNK
, *LPDMUS_PRIVATE_CHUNK
;
239 /* used for generic dumping (copied from ddraw) */
245 #define FE(x) { x, #x }
247 /* dwPatch from MIDILOCALE */
248 extern DWORD
MIDILOCALE2Patch (const MIDILOCALE
*pLocale
) DECLSPEC_HIDDEN
;
249 /* MIDILOCALE from dwPatch */
250 extern void Patch2MIDILOCALE (DWORD dwPatch
, LPMIDILOCALE pLocale
) DECLSPEC_HIDDEN
;
252 /* check whether the given DWORD is even (return 0) or odd (return 1) */
253 extern int even_or_odd (DWORD number
) DECLSPEC_HIDDEN
;
254 /* Dump whole DMUS_PORTPARAMS struct */
255 extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params
) DECLSPEC_HIDDEN
;
257 #endif /* __WINE_DMUSIC_PRIVATE_H */