libwine: Do not restrict base address of main thread on 64 bit mac os.
[wine.git] / dlls / dmusic / dmusic_private.h
blobf9839edfdaea8722acc0c05d66374501600f8dd8
1 /*
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
25 #include <stdarg.h>
27 #define COBJMACROS
28 #define NONAMELESSUNION
29 #define NONAMELESSSTRUCT
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winnt.h"
34 #include "wingdi.h"
35 #include "winuser.h"
37 #include "wine/debug.h"
38 #include "wine/list.h"
39 #include "wine/unicode.h"
40 #include "winreg.h"
41 #include "objbase.h"
43 #include "dmusici.h"
44 #include "dmusicf.h"
45 #include "dmusics.h"
46 #include "dmksctrl.h"
48 /*****************************************************************************
49 * Interfaces
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_ {
66 DWORD priority;
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 {
75 DMUS_PORTCAPS caps;
76 HRESULT (*create)(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
77 DMUS_PORTCAPS *port_caps, IDirectMusicPort **port);
78 ULONG device;
79 } port_info;
81 typedef struct instrument_region {
82 RGNHEADER header;
83 WAVELINK wave_link;
84 WSMPL wave_sample;
85 WLOOP wave_loop;
86 BOOL loop_present;
87 } instrument_region;
89 typedef struct instrument_articulation {
90 CONNECTIONLIST connections_list;
91 CONNECTION *connections;
92 } instrument_articulation;
94 /*****************************************************************************
95 * ClassFactory
98 /* CLSID */
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;
102 /* Internal */
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;
113 LONG ref;
114 IDirectSound *dsound;
115 IReferenceClockImpl *master_clock;
116 IDirectMusicPort **ports;
117 int num_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;
128 LONG ref;
130 /* IDirectMusicBufferImpl fields */
131 GUID format;
132 DWORD size;
133 LPBYTE data;
134 DWORD write_pos;
135 REFERENCE_TIME start_time;
138 /*****************************************************************************
139 * IDirectMusicDownloadedInstrumentImpl implementation structure
141 struct IDirectMusicDownloadedInstrumentImpl {
142 /* IUnknown fields */
143 IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface;
144 LONG ref;
146 /* IDirectMusicDownloadedInstrumentImpl fields */
147 BOOL downloaded;
148 void *data;
151 /*****************************************************************************
152 * IDirectMusicDownloadImpl implementation structure
154 struct IDirectMusicDownloadImpl {
155 /* IUnknown fields */
156 IDirectMusicDownload IDirectMusicDownload_iface;
157 LONG ref;
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;
176 LONG ref;
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;
198 LONG ref;
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 */
203 GUID id;
204 INSTHEADER header;
205 WCHAR wszName[DMUS_MAX_NAME];
206 /* instrument data */
207 BOOL loaded;
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);
218 /* custom :) */
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 /*****************************************************************************
230 * Misc.
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) */
241 typedef struct {
242 DWORD val;
243 const char* name;
244 } flag_info;
246 typedef struct {
247 const GUID *guid;
248 const char* name;
249 } guid_info;
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 */