wined3d: Replace wined3d_surface_update_desc() with wined3d_texture_update_desc().
[wine.git] / dlls / dmusic / dmusic_private.h
blob9ac05d6b29602793da1900ba52d39685f61d790a
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
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winnt.h"
32 #include "wingdi.h"
33 #include "winuser.h"
35 #include "wine/debug.h"
36 #include "wine/list.h"
37 #include "wine/unicode.h"
38 #include "winreg.h"
39 #include "objbase.h"
41 #include "dmusici.h"
42 #include "dmusicf.h"
43 #include "dmusics.h"
45 /*****************************************************************************
46 * Interfaces
48 typedef struct IDirectMusic8Impl IDirectMusic8Impl;
49 typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
50 typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
51 typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
52 typedef struct IReferenceClockImpl IReferenceClockImpl;
54 typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
56 typedef struct SynthPortImpl SynthPortImpl;
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_ {
65 DWORD priority;
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 {
74 DMUS_PORTCAPS caps;
75 HRESULT (*create)(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device);
76 ULONG device;
77 } port_info;
79 typedef struct instrument_region {
80 RGNHEADER header;
81 WAVELINK wave_link;
82 WSMPL wave_sample;
83 WLOOP wave_loop;
84 BOOL loop_present;
85 } instrument_region;
87 typedef struct instrument_articulation {
88 CONNECTIONLIST connections_list;
89 CONNECTION *connections;
90 } instrument_articulation;
92 /*****************************************************************************
93 * ClassFactory
96 /* CLSID */
97 extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
98 extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
100 /* Internal */
101 extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) DECLSPEC_HIDDEN;
102 extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
103 extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
104 extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
106 /*****************************************************************************
107 * IDirectMusic8Impl implementation structure
109 struct IDirectMusic8Impl {
110 /* IUnknown fields */
111 IDirectMusic8 IDirectMusic8_iface;
112 LONG ref;
114 /* IDirectMusicImpl fields */
115 IReferenceClockImpl* pMasterClock;
116 IDirectMusicPort** ppPorts;
117 int nrofports;
118 port_info* system_ports;
119 int nb_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 /*****************************************************************************
163 * SynthPortImpl implementation structure
165 struct SynthPortImpl {
166 /* IUnknown fields */
167 IDirectMusicPort IDirectMusicPort_iface;
168 IDirectMusicPortDownload IDirectMusicPortDownload_iface;
169 IDirectMusicThru IDirectMusicThru_iface;
170 LONG ref;
172 /* IDirectMusicPort fields */
173 IDirectSound* pDirectSound;
174 IReferenceClock* pLatencyClock;
175 IDirectMusicSynth* synth;
176 IDirectMusicSynthSink* synth_sink;
177 BOOL fActive;
178 DMUS_PORTCAPS caps;
179 DMUS_PORTPARAMS params;
180 int nrofgroups;
181 DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
184 /** Internal factory */
185 extern HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
186 extern HRESULT DMUSIC_CreateMidiOutPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
187 extern HRESULT DMUSIC_CreateMidiInPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
189 /*****************************************************************************
190 * IReferenceClockImpl implementation structure
192 struct IReferenceClockImpl {
193 /* IUnknown fields */
194 IReferenceClock IReferenceClock_iface;
195 LONG ref;
197 /* IReferenceClockImpl fields */
198 REFERENCE_TIME rtTime;
199 DMUS_CLOCKINFO pClockInfo;
202 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
203 struct list entry; /* for listing elements */
204 IDirectMusicInstrument* pInstrument;
205 } DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
207 typedef struct _DMUS_PRIVATE_POOLCUE {
208 struct list entry; /* for listing elements */
209 } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
211 /*****************************************************************************
212 * IDirectMusicInstrumentImpl implementation structure
214 struct IDirectMusicInstrumentImpl {
215 /* IUnknown fields */
216 IDirectMusicInstrument IDirectMusicInstrument_iface;
217 LONG ref;
219 /* IDirectMusicInstrumentImpl fields */
220 LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
221 ULONG length; /* Length of the instrument in the stream */
222 GUID id;
223 INSTHEADER header;
224 WCHAR wszName[DMUS_MAX_NAME];
225 /* instrument data */
226 BOOL loaded;
227 instrument_region *regions;
228 ULONG nb_articulations;
229 instrument_articulation *articulations;
232 static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
234 return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface);
237 /* custom :) */
238 extern HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream) DECLSPEC_HIDDEN;
240 /**********************************************************************
241 * Dll lifetime tracking declaration for dmusic.dll
243 extern LONG DMUSIC_refCount DECLSPEC_HIDDEN;
244 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
245 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
248 /*****************************************************************************
249 * Misc.
251 /* my custom ICOM stuff */
252 #define ICOM_NAME_MULTI(impl,field,iface,name) impl* const name=(impl*)((char*)(iface) - offsetof(impl,field))
253 #define ICOM_THIS_MULTI(impl,field,iface) ICOM_NAME_MULTI(impl,field,iface,This)
255 /* for simpler reading */
256 typedef struct _DMUS_PRIVATE_CHUNK {
257 FOURCC fccID; /* FOURCC ID of the chunk */
258 DWORD dwSize; /* size of the chunk */
259 } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
261 /* used for generic dumping (copied from ddraw) */
262 typedef struct {
263 DWORD val;
264 const char* name;
265 } flag_info;
267 typedef struct {
268 const GUID *guid;
269 const char* name;
270 } guid_info;
272 #define FE(x) { x, #x }
273 #define GE(x) { &x, #x }
275 /* dwPatch from MIDILOCALE */
276 extern DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) DECLSPEC_HIDDEN;
277 /* MIDILOCALE from dwPatch */
278 extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale) DECLSPEC_HIDDEN;
280 /* check whether the given DWORD is even (return 0) or odd (return 1) */
281 extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
282 /* FOURCC to string conversion for debug messages */
283 extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
284 /* returns name of given GUID */
285 extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
286 /* Dump whole DMUS_OBJECTDESC struct */
287 extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN;
288 /* Dump whole DMUS_PORTPARAMS struct */
289 extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) DECLSPEC_HIDDEN;
291 #endif /* __WINE_DMUSIC_PRIVATE_H */