1c2c66affSColin Finck /*
2c2c66affSColin Finck * DirectMusic Private Include
3c2c66affSColin Finck *
4c2c66affSColin Finck * Copyright (C) 2003-2004 Rok Mandeljc
5c2c66affSColin Finck * Copyright (C) 2012 Christian Costa
6c2c66affSColin Finck *
7c2c66affSColin Finck * This program is free software; you can redistribute it and/or
8c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
9c2c66affSColin Finck * License as published by the Free Software Foundation; either
10c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
11c2c66affSColin Finck *
12c2c66affSColin Finck * This program is distributed in the hope that it will be useful,
13c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
14c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15c2c66affSColin Finck * Lesser General Public License for more details.
16c2c66affSColin Finck *
17c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
18c2c66affSColin Finck * License along with this program; if not, write to the Free Software
19c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20c2c66affSColin Finck */
21c2c66affSColin Finck
22c2c66affSColin Finck #ifndef __WINE_DMUSIC_PRIVATE_H
23c2c66affSColin Finck #define __WINE_DMUSIC_PRIVATE_H
24c2c66affSColin Finck
25c2c66affSColin Finck #include <stdarg.h>
26c2c66affSColin Finck
27c2c66affSColin Finck #define COBJMACROS
28c2c66affSColin Finck #define NONAMELESSUNION
29c2c66affSColin Finck #define NONAMELESSSTRUCT
30c2c66affSColin Finck
315d870f5bSAmine Khaldi #include "windef.h"
325d870f5bSAmine Khaldi #include "winbase.h"
335d870f5bSAmine Khaldi #include "winnt.h"
345d870f5bSAmine Khaldi #include "wingdi.h"
355d870f5bSAmine Khaldi #include "winuser.h"
36*c1cf2ac3SAmine Khaldi #ifdef __REACTOS__
37*c1cf2ac3SAmine Khaldi #include "winnls.h"
38*c1cf2ac3SAmine Khaldi #endif
39c2c66affSColin Finck
405d870f5bSAmine Khaldi #include "wine/debug.h"
415d870f5bSAmine Khaldi #include "wine/list.h"
425d870f5bSAmine Khaldi #include "winreg.h"
435d870f5bSAmine Khaldi #include "objbase.h"
44c2c66affSColin Finck
455d870f5bSAmine Khaldi #include "dmusici.h"
465d870f5bSAmine Khaldi #include "dmusicf.h"
475d870f5bSAmine Khaldi #include "dmusics.h"
485d870f5bSAmine Khaldi #include "dmksctrl.h"
49c2c66affSColin Finck
50c2c66affSColin Finck /*****************************************************************************
51c2c66affSColin Finck * Interfaces
52c2c66affSColin Finck */
53c2c66affSColin Finck typedef struct IDirectMusic8Impl IDirectMusic8Impl;
54c2c66affSColin Finck typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
55c2c66affSColin Finck typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
56c2c66affSColin Finck typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
57c2c66affSColin Finck typedef struct IReferenceClockImpl IReferenceClockImpl;
58c2c66affSColin Finck
59c2c66affSColin Finck typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
60c2c66affSColin Finck
61c2c66affSColin Finck /*****************************************************************************
62c2c66affSColin Finck * Some stuff to make my life easier :=)
63c2c66affSColin Finck */
64c2c66affSColin Finck
65c2c66affSColin Finck /* some sort of aux. midi channel: big fake at the moment; accepts only priority
66c2c66affSColin Finck changes... more coming soon */
67c2c66affSColin Finck typedef struct DMUSIC_PRIVATE_MCHANNEL_ {
68c2c66affSColin Finck DWORD priority;
69c2c66affSColin Finck } DMUSIC_PRIVATE_MCHANNEL, *LPDMUSIC_PRIVATE_MCHANNEL;
70c2c66affSColin Finck
71c2c66affSColin Finck /* some sort of aux. channel group: collection of 16 midi channels */
72c2c66affSColin Finck typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
73c2c66affSColin Finck DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
74c2c66affSColin Finck } DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
75c2c66affSColin Finck
76c2c66affSColin Finck typedef struct port_info {
77c2c66affSColin Finck DMUS_PORTCAPS caps;
78c2c66affSColin Finck HRESULT (*create)(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
79c2c66affSColin Finck DMUS_PORTCAPS *port_caps, IDirectMusicPort **port);
80c2c66affSColin Finck ULONG device;
81c2c66affSColin Finck } port_info;
82c2c66affSColin Finck
83c2c66affSColin Finck typedef struct instrument_region {
84c2c66affSColin Finck RGNHEADER header;
85c2c66affSColin Finck WAVELINK wave_link;
86c2c66affSColin Finck WSMPL wave_sample;
87c2c66affSColin Finck WLOOP wave_loop;
88c2c66affSColin Finck BOOL loop_present;
89c2c66affSColin Finck } instrument_region;
90c2c66affSColin Finck
91c2c66affSColin Finck typedef struct instrument_articulation {
92c2c66affSColin Finck CONNECTIONLIST connections_list;
93c2c66affSColin Finck CONNECTION *connections;
94c2c66affSColin Finck } instrument_articulation;
95c2c66affSColin Finck
96c2c66affSColin Finck /*****************************************************************************
97c2c66affSColin Finck * ClassFactory
98c2c66affSColin Finck */
99c2c66affSColin Finck
100c2c66affSColin Finck /* CLSID */
101c2c66affSColin Finck extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
102c2c66affSColin Finck extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
103c2c66affSColin Finck
104c2c66affSColin Finck /* Internal */
105c2c66affSColin Finck extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) DECLSPEC_HIDDEN;
106c2c66affSColin Finck extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
107c2c66affSColin Finck extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
108c2c66affSColin Finck extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
109c2c66affSColin Finck
110c2c66affSColin Finck /*****************************************************************************
111c2c66affSColin Finck * IDirectMusic8Impl implementation structure
112c2c66affSColin Finck */
113c2c66affSColin Finck struct IDirectMusic8Impl {
114c2c66affSColin Finck IDirectMusic8 IDirectMusic8_iface;
115c2c66affSColin Finck LONG ref;
116c2c66affSColin Finck IDirectSound *dsound;
117*c1cf2ac3SAmine Khaldi IReferenceClock *master_clock;
118c2c66affSColin Finck IDirectMusicPort **ports;
119c2c66affSColin Finck int num_ports;
120c2c66affSColin Finck port_info *system_ports;
121c2c66affSColin Finck int num_system_ports;
122c2c66affSColin Finck };
123c2c66affSColin Finck
124c2c66affSColin Finck /*****************************************************************************
125c2c66affSColin Finck * IDirectMusicBufferImpl implementation structure
126c2c66affSColin Finck */
127c2c66affSColin Finck struct IDirectMusicBufferImpl {
128c2c66affSColin Finck /* IUnknown fields */
129c2c66affSColin Finck IDirectMusicBuffer IDirectMusicBuffer_iface;
130c2c66affSColin Finck LONG ref;
131c2c66affSColin Finck
132c2c66affSColin Finck /* IDirectMusicBufferImpl fields */
133c2c66affSColin Finck GUID format;
134c2c66affSColin Finck DWORD size;
135c2c66affSColin Finck LPBYTE data;
136c2c66affSColin Finck DWORD write_pos;
137c2c66affSColin Finck REFERENCE_TIME start_time;
138c2c66affSColin Finck };
139c2c66affSColin Finck
140c2c66affSColin Finck /*****************************************************************************
141c2c66affSColin Finck * IDirectMusicDownloadedInstrumentImpl implementation structure
142c2c66affSColin Finck */
143c2c66affSColin Finck struct IDirectMusicDownloadedInstrumentImpl {
144c2c66affSColin Finck /* IUnknown fields */
145c2c66affSColin Finck IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface;
146c2c66affSColin Finck LONG ref;
147c2c66affSColin Finck
148c2c66affSColin Finck /* IDirectMusicDownloadedInstrumentImpl fields */
149c2c66affSColin Finck BOOL downloaded;
150c2c66affSColin Finck void *data;
151c2c66affSColin Finck };
152c2c66affSColin Finck
153c2c66affSColin Finck /*****************************************************************************
154c2c66affSColin Finck * IDirectMusicDownloadImpl implementation structure
155c2c66affSColin Finck */
156c2c66affSColin Finck struct IDirectMusicDownloadImpl {
157c2c66affSColin Finck /* IUnknown fields */
158c2c66affSColin Finck IDirectMusicDownload IDirectMusicDownload_iface;
159c2c66affSColin Finck LONG ref;
160c2c66affSColin Finck
161c2c66affSColin Finck /* IDirectMusicDownloadImpl fields */
162c2c66affSColin Finck };
163c2c66affSColin Finck
164c2c66affSColin Finck /** Internal factory */
165c2c66affSColin Finck extern HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
166c2c66affSColin Finck DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
167c2c66affSColin Finck extern HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
168c2c66affSColin Finck DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
169c2c66affSColin Finck extern HRESULT midi_in_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
170c2c66affSColin Finck DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
171c2c66affSColin Finck
172c2c66affSColin Finck /*****************************************************************************
173c2c66affSColin Finck * IReferenceClockImpl implementation structure
174c2c66affSColin Finck */
175c2c66affSColin Finck struct IReferenceClockImpl {
176c2c66affSColin Finck /* IUnknown fields */
177c2c66affSColin Finck IReferenceClock IReferenceClock_iface;
178c2c66affSColin Finck LONG ref;
179c2c66affSColin Finck
180c2c66affSColin Finck /* IReferenceClockImpl fields */
181c2c66affSColin Finck REFERENCE_TIME rtTime;
182c2c66affSColin Finck DMUS_CLOCKINFO pClockInfo;
183c2c66affSColin Finck };
184c2c66affSColin Finck
185c2c66affSColin Finck typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
186c2c66affSColin Finck struct list entry; /* for listing elements */
187c2c66affSColin Finck IDirectMusicInstrument* pInstrument;
188c2c66affSColin Finck } DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
189c2c66affSColin Finck
190c2c66affSColin Finck typedef struct _DMUS_PRIVATE_POOLCUE {
191c2c66affSColin Finck struct list entry; /* for listing elements */
192c2c66affSColin Finck } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
193c2c66affSColin Finck
194c2c66affSColin Finck /*****************************************************************************
195c2c66affSColin Finck * IDirectMusicInstrumentImpl implementation structure
196c2c66affSColin Finck */
197c2c66affSColin Finck struct IDirectMusicInstrumentImpl {
198c2c66affSColin Finck /* IUnknown fields */
199c2c66affSColin Finck IDirectMusicInstrument IDirectMusicInstrument_iface;
200c2c66affSColin Finck LONG ref;
201c2c66affSColin Finck
202c2c66affSColin Finck /* IDirectMusicInstrumentImpl fields */
203c2c66affSColin Finck LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
204c2c66affSColin Finck ULONG length; /* Length of the instrument in the stream */
205c2c66affSColin Finck GUID id;
206c2c66affSColin Finck INSTHEADER header;
207c2c66affSColin Finck WCHAR wszName[DMUS_MAX_NAME];
208c2c66affSColin Finck /* instrument data */
209c2c66affSColin Finck BOOL loaded;
210c2c66affSColin Finck instrument_region *regions;
211c2c66affSColin Finck ULONG nb_articulations;
212c2c66affSColin Finck instrument_articulation *articulations;
213c2c66affSColin Finck };
214c2c66affSColin Finck
impl_from_IDirectMusicInstrument(IDirectMusicInstrument * iface)215c2c66affSColin Finck static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
216c2c66affSColin Finck {
217c2c66affSColin Finck return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface);
218c2c66affSColin Finck }
219c2c66affSColin Finck
220c2c66affSColin Finck /* custom :) */
221c2c66affSColin Finck extern HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream) DECLSPEC_HIDDEN;
222c2c66affSColin Finck
223c2c66affSColin Finck /**********************************************************************
224c2c66affSColin Finck * Dll lifetime tracking declaration for dmusic.dll
225c2c66affSColin Finck */
226c2c66affSColin Finck extern LONG DMUSIC_refCount DECLSPEC_HIDDEN;
DMUSIC_LockModule(void)227c2c66affSColin Finck static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
DMUSIC_UnlockModule(void)228c2c66affSColin Finck static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
229c2c66affSColin Finck
230c2c66affSColin Finck
231c2c66affSColin Finck /*****************************************************************************
232c2c66affSColin Finck * Misc.
233c2c66affSColin Finck */
234c2c66affSColin Finck void dmusic_remove_port(IDirectMusic8Impl *dmusic, IDirectMusicPort *port) DECLSPEC_HIDDEN;
235c2c66affSColin Finck
236c2c66affSColin Finck /* for simpler reading */
237c2c66affSColin Finck typedef struct _DMUS_PRIVATE_CHUNK {
238c2c66affSColin Finck FOURCC fccID; /* FOURCC ID of the chunk */
239c2c66affSColin Finck DWORD dwSize; /* size of the chunk */
240c2c66affSColin Finck } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
241c2c66affSColin Finck
242c2c66affSColin Finck /* used for generic dumping (copied from ddraw) */
243c2c66affSColin Finck typedef struct {
244c2c66affSColin Finck DWORD val;
245c2c66affSColin Finck const char* name;
246c2c66affSColin Finck } flag_info;
247c2c66affSColin Finck
248c2c66affSColin Finck typedef struct {
249c2c66affSColin Finck const GUID *guid;
250c2c66affSColin Finck const char* name;
251c2c66affSColin Finck } guid_info;
252c2c66affSColin Finck
253c2c66affSColin Finck #define FE(x) { x, #x }
254c2c66affSColin Finck #define GE(x) { &x, #x }
255c2c66affSColin Finck
256c2c66affSColin Finck /* dwPatch from MIDILOCALE */
257c2c66affSColin Finck extern DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) DECLSPEC_HIDDEN;
258c2c66affSColin Finck /* MIDILOCALE from dwPatch */
259c2c66affSColin Finck extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale) DECLSPEC_HIDDEN;
260c2c66affSColin Finck
261c2c66affSColin Finck /* check whether the given DWORD is even (return 0) or odd (return 1) */
262c2c66affSColin Finck extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
263c2c66affSColin Finck /* FOURCC to string conversion for debug messages */
264c2c66affSColin Finck extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
265c2c66affSColin Finck /* returns name of given GUID */
266c2c66affSColin Finck extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
267c2c66affSColin Finck /* Dump whole DMUS_OBJECTDESC struct */
268c2c66affSColin Finck extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN;
269c2c66affSColin Finck /* Dump whole DMUS_PORTPARAMS struct */
270c2c66affSColin Finck extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) DECLSPEC_HIDDEN;
271c2c66affSColin Finck
272c2c66affSColin Finck #endif /* __WINE_DMUSIC_PRIVATE_H */
273