dpnet/tests: A spelling fix in a variable name.
[wine.git] / dlls / dmusic / dmusic_private.h
blobcfe03fc59240518127ef2db91c1af7db8d591a9b
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"
44 #include "dmksctrl.h"
46 /*****************************************************************************
47 * Interfaces
49 typedef struct IDirectMusic8Impl IDirectMusic8Impl;
50 typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
51 typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
52 typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
53 typedef struct IReferenceClockImpl IReferenceClockImpl;
55 typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
57 /*****************************************************************************
58 * Some stuff to make my life easier :=)
61 /* some sort of aux. midi channel: big fake at the moment; accepts only priority
62 changes... more coming soon */
63 typedef struct DMUSIC_PRIVATE_MCHANNEL_ {
64 DWORD priority;
65 } DMUSIC_PRIVATE_MCHANNEL, *LPDMUSIC_PRIVATE_MCHANNEL;
67 /* some sort of aux. channel group: collection of 16 midi channels */
68 typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
69 DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
70 } DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
72 typedef struct port_info {
73 DMUS_PORTCAPS caps;
74 HRESULT (*create)(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device);
75 ULONG device;
76 } port_info;
78 typedef struct instrument_region {
79 RGNHEADER header;
80 WAVELINK wave_link;
81 WSMPL wave_sample;
82 WLOOP wave_loop;
83 BOOL loop_present;
84 } instrument_region;
86 typedef struct instrument_articulation {
87 CONNECTIONLIST connections_list;
88 CONNECTION *connections;
89 } instrument_articulation;
91 /*****************************************************************************
92 * ClassFactory
95 /* CLSID */
96 extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
97 extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
99 /* Internal */
100 extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) DECLSPEC_HIDDEN;
101 extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
102 extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
103 extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
105 /*****************************************************************************
106 * IDirectMusic8Impl implementation structure
108 struct IDirectMusic8Impl {
109 /* IUnknown fields */
110 IDirectMusic8 IDirectMusic8_iface;
111 LONG ref;
113 /* IDirectMusicImpl fields */
114 IReferenceClockImpl* pMasterClock;
115 IDirectMusicPort** ppPorts;
116 int nrofports;
117 port_info* system_ports;
118 int nb_system_ports;
121 /*****************************************************************************
122 * IDirectMusicBufferImpl implementation structure
124 struct IDirectMusicBufferImpl {
125 /* IUnknown fields */
126 IDirectMusicBuffer IDirectMusicBuffer_iface;
127 LONG ref;
129 /* IDirectMusicBufferImpl fields */
130 GUID format;
131 DWORD size;
132 LPBYTE data;
133 DWORD write_pos;
134 REFERENCE_TIME start_time;
137 /*****************************************************************************
138 * IDirectMusicDownloadedInstrumentImpl implementation structure
140 struct IDirectMusicDownloadedInstrumentImpl {
141 /* IUnknown fields */
142 IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface;
143 LONG ref;
145 /* IDirectMusicDownloadedInstrumentImpl fields */
146 BOOL downloaded;
147 void *data;
150 /*****************************************************************************
151 * IDirectMusicDownloadImpl implementation structure
153 struct IDirectMusicDownloadImpl {
154 /* IUnknown fields */
155 IDirectMusicDownload IDirectMusicDownload_iface;
156 LONG ref;
158 /* IDirectMusicDownloadImpl fields */
161 /** Internal factory */
162 extern HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
163 extern HRESULT DMUSIC_CreateMidiOutPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
164 extern HRESULT DMUSIC_CreateMidiInPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
166 /*****************************************************************************
167 * IReferenceClockImpl implementation structure
169 struct IReferenceClockImpl {
170 /* IUnknown fields */
171 IReferenceClock IReferenceClock_iface;
172 LONG ref;
174 /* IReferenceClockImpl fields */
175 REFERENCE_TIME rtTime;
176 DMUS_CLOCKINFO pClockInfo;
179 typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
180 struct list entry; /* for listing elements */
181 IDirectMusicInstrument* pInstrument;
182 } DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
184 typedef struct _DMUS_PRIVATE_POOLCUE {
185 struct list entry; /* for listing elements */
186 } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
188 /*****************************************************************************
189 * IDirectMusicInstrumentImpl implementation structure
191 struct IDirectMusicInstrumentImpl {
192 /* IUnknown fields */
193 IDirectMusicInstrument IDirectMusicInstrument_iface;
194 LONG ref;
196 /* IDirectMusicInstrumentImpl fields */
197 LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
198 ULONG length; /* Length of the instrument in the stream */
199 GUID id;
200 INSTHEADER header;
201 WCHAR wszName[DMUS_MAX_NAME];
202 /* instrument data */
203 BOOL loaded;
204 instrument_region *regions;
205 ULONG nb_articulations;
206 instrument_articulation *articulations;
209 static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
211 return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface);
214 /* custom :) */
215 extern HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream) DECLSPEC_HIDDEN;
217 /**********************************************************************
218 * Dll lifetime tracking declaration for dmusic.dll
220 extern LONG DMUSIC_refCount DECLSPEC_HIDDEN;
221 static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
222 static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
225 /*****************************************************************************
226 * Misc.
228 /* for simpler reading */
229 typedef struct _DMUS_PRIVATE_CHUNK {
230 FOURCC fccID; /* FOURCC ID of the chunk */
231 DWORD dwSize; /* size of the chunk */
232 } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
234 /* used for generic dumping (copied from ddraw) */
235 typedef struct {
236 DWORD val;
237 const char* name;
238 } flag_info;
240 typedef struct {
241 const GUID *guid;
242 const char* name;
243 } guid_info;
245 #define FE(x) { x, #x }
246 #define GE(x) { &x, #x }
248 /* dwPatch from MIDILOCALE */
249 extern DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) DECLSPEC_HIDDEN;
250 /* MIDILOCALE from dwPatch */
251 extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale) DECLSPEC_HIDDEN;
253 /* check whether the given DWORD is even (return 0) or odd (return 1) */
254 extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
255 /* FOURCC to string conversion for debug messages */
256 extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
257 /* returns name of given GUID */
258 extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
259 /* Dump whole DMUS_OBJECTDESC struct */
260 extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN;
261 /* Dump whole DMUS_PORTPARAMS struct */
262 extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) DECLSPEC_HIDDEN;
264 #endif /* __WINE_DMUSIC_PRIVATE_H */