Fix compilation.
[wine] / dlls / dmscript / dmscript_private.h
1 /* DirectMusicScript Private Include
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __WINE_DMSCRIPT_PRIVATE_H
21 #define __WINE_DMSCRIPT_PRIVATE_H
22
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <string.h>
26
27 #define COBJMACROS
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winnt.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34
35 #include "wine/debug.h"
36 #include "wine/list.h"
37 #include "wine/unicode.h"
38 #include "winreg.h"
39 #include "objbase.h"
40
41 #include "dmusici.h"
42 #include "dmusicf.h"
43 #include "dmusics.h"
44
45 /*****************************************************************************
46  * Interfaces
47  */
48 typedef struct IDirectMusicScriptImpl IDirectMusicScriptImpl;
49
50 typedef struct IDirectMusicScriptTrack IDirectMusicScriptTrack;
51
52 /*****************************************************************************
53  * Predeclare the interface implementation structures
54  */
55 extern IUnknownVtbl           DirectMusicScript_Unknown_Vtbl;
56 extern IDirectMusicScriptVtbl DirectMusicScript_Script_Vtbl;
57 extern IDirectMusicObjectVtbl DirectMusicScript_Object_Vtbl;
58 extern IPersistStreamVtbl     DirectMusicScript_PersistStream_Vtbl;
59
60 extern IUnknownVtbl           DirectMusicScriptTrack_Unknown_Vtbl;
61 extern IDirectMusicTrack8Vtbl DirectMusicScriptTrack_Track_Vtbl;
62 extern IPersistStreamVtbl     DirectMusicScriptTrack_PersistStream_Vtbl;
63
64 /*****************************************************************************
65  * ClassFactory
66  */
67 extern HRESULT WINAPI DMUSIC_CreateDirectMusicScriptImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
68
69 extern HRESULT WINAPI DMUSIC_CreateDirectMusicScriptTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
70
71 /*****************************************************************************
72  * IDirectMusicScriptImpl implementation structure
73  */
74 struct IDirectMusicScriptImpl {
75   /* IUnknown fields */
76   IUnknownVtbl *UnknownVtbl;
77   IDirectMusicScriptVtbl *ScriptVtbl;
78   IDirectMusicObjectVtbl *ObjectVtbl;
79   IPersistStreamVtbl *PersistStreamVtbl;
80   DWORD          ref;
81
82   /* IDirectMusicScriptImpl fields */
83   IDirectMusicPerformance* pPerformance;
84   LPDMUS_OBJECTDESC pDesc;
85   DMUS_IO_SCRIPT_HEADER* pHeader;
86   DMUS_IO_VERSION* pVersion;
87   WCHAR* pwzLanguage;
88   WCHAR* pwzSource;
89 };
90
91 /* IUnknown: */
92 extern HRESULT WINAPI IDirectMusicScriptImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj);
93 extern ULONG WINAPI   IDirectMusicScriptImpl_IUnknown_AddRef (LPUNKNOWN iface);
94 extern ULONG WINAPI   IDirectMusicScriptImpl_IUnknown_Release (LPUNKNOWN iface);
95 /* IDirectMusicScript: */
96 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_QueryInterface (LPDIRECTMUSICSCRIPT iface, REFIID riid, LPVOID *ppobj);
97 extern ULONG WINAPI   IDirectMusicScriptImpl_IDirectMusicScript_AddRef (LPDIRECTMUSICSCRIPT iface);
98 extern ULONG WINAPI   IDirectMusicScriptImpl_IDirectMusicScript_Release (LPDIRECTMUSICSCRIPT iface);
99 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_Init (LPDIRECTMUSICSCRIPT iface, IDirectMusicPerformance* pPerformance, DMUS_SCRIPT_ERRORINFO* pErrorInfo);
100 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_CallRoutine (LPDIRECTMUSICSCRIPT iface, WCHAR* pwszRoutineName, DMUS_SCRIPT_ERRORINFO* pErrorInfo);
101 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_SetVariableVariant (LPDIRECTMUSICSCRIPT iface, WCHAR* pwszVariableName, VARIANT varValue, BOOL fSetRef, DMUS_SCRIPT_ERRORINFO* pErrorInfo);
102 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_GetVariableVariant (LPDIRECTMUSICSCRIPT iface, WCHAR* pwszVariableName, VARIANT* pvarValue, DMUS_SCRIPT_ERRORINFO* pErrorInfo);
103 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_SetVariableNumber (LPDIRECTMUSICSCRIPT iface, WCHAR* pwszVariableName, LONG lValue, DMUS_SCRIPT_ERRORINFO* pErrorInfo);
104 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_GetVariableNumber (LPDIRECTMUSICSCRIPT iface, WCHAR* pwszVariableName, LONG* plValue, DMUS_SCRIPT_ERRORINFO* pErrorInfo);
105 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_SetVariableObject (LPDIRECTMUSICSCRIPT iface, WCHAR* pwszVariableName, IUnknown* punkValue, DMUS_SCRIPT_ERRORINFO* pErrorInfo);
106 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_GetVariableObject (LPDIRECTMUSICSCRIPT iface, WCHAR* pwszVariableName, REFIID riid, LPVOID* ppv, DMUS_SCRIPT_ERRORINFO* pErrorInfo);
107 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_EnumRoutine (LPDIRECTMUSICSCRIPT iface, DWORD dwIndex, WCHAR* pwszName);
108 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicScript_EnumVariable (LPDIRECTMUSICSCRIPT iface, DWORD dwIndex, WCHAR* pwszName);
109 /* IDirectMusicObject: */
110 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj);
111 extern ULONG WINAPI   IDirectMusicScriptImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface);
112 extern ULONG WINAPI   IDirectMusicScriptImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface);
113 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc);
114 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc);
115 extern HRESULT WINAPI IDirectMusicScriptImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc);
116 /* IPersistStream: */
117 extern HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject);
118 extern ULONG WINAPI   IDirectMusicScriptImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface);
119 extern ULONG WINAPI   IDirectMusicScriptImpl_IPersistStream_Release (LPPERSISTSTREAM iface);
120 extern HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID);
121 extern HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface);
122 extern HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm);
123 extern HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty);
124 extern HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize);
125
126 /*****************************************************************************
127  * IDirectMusicScriptTrack implementation structure
128  */
129 struct IDirectMusicScriptTrack {
130   /* IUnknown fields */
131   IUnknownVtbl *UnknownVtbl;
132   IDirectMusicTrack8Vtbl *TrackVtbl;
133   IPersistStreamVtbl *PersistStreamVtbl;
134   DWORD          ref;
135
136   /* IDirectMusicScriptTrack fields */
137   LPDMUS_OBJECTDESC pDesc;
138 };
139
140 /* IUnknown: */
141 extern HRESULT WINAPI IDirectMusicScriptTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj);
142 extern ULONG WINAPI   IDirectMusicScriptTrack_IUnknown_AddRef (LPUNKNOWN iface);
143 extern ULONG WINAPI   IDirectMusicScriptTrack_IUnknown_Release (LPUNKNOWN iface);
144 /* IDirectMusicTrack(8): */
145 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj);
146 extern ULONG WINAPI   IDirectMusicScriptTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface);
147 extern ULONG WINAPI   IDirectMusicScriptTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface);
148 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment);
149 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags);
150 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData);
151 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID);
152 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam);
153 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam);
154 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType);
155 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType);
156 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType);
157 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack);
158 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID);
159 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags);
160 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags);
161 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack);
162 extern HRESULT WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack);
163 /* IPersistStream: */
164 extern HRESULT WINAPI IDirectMusicScriptTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject);
165 extern ULONG WINAPI   IDirectMusicScriptTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface);
166 extern ULONG WINAPI   IDirectMusicScriptTrack_IPersistStream_Release (LPPERSISTSTREAM iface);
167 extern HRESULT WINAPI IDirectMusicScriptTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID);
168 extern HRESULT WINAPI IDirectMusicScriptTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface);
169 extern HRESULT WINAPI IDirectMusicScriptTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm);
170 extern HRESULT WINAPI IDirectMusicScriptTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty);
171 extern HRESULT WINAPI IDirectMusicScriptTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize);
172
173
174 /*****************************************************************************
175  * Misc.
176  */
177 /* for simpler reading */
178 typedef struct _DMUS_PRIVATE_CHUNK {
179         FOURCC fccID; /* FOURCC ID of the chunk */
180         DWORD dwSize; /* size of the chunk */
181 } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
182
183 /* used for generic dumping (copied from ddraw) */
184 typedef struct {
185     DWORD val;
186     const char* name;
187 } flag_info;
188
189 typedef struct {
190     const GUID *guid;
191     const char* name;
192 } guid_info;
193
194 /* used for initialising structs (primarily for DMUS_OBJECTDESC) */
195 #define DM_STRUCT_INIT(x)                               \
196         do {                                                            \
197                 memset((x), 0, sizeof(*(x)));   \
198                 (x)->dwSize = sizeof(*x);               \
199         } while (0)
200
201 #define FE(x) { x, #x } 
202 #define GE(x) { &x, #x }
203
204 #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
205
206 /* check whether the given DWORD is even (return 0) or odd (return 1) */
207 extern int even_or_odd (DWORD number);
208 /* FOURCC to string conversion for debug messages */
209 extern const char *debugstr_fourcc (DWORD fourcc);
210 /* DMUS_VERSION struct to string conversion for debug messages */
211 extern const char *debugstr_dmversion (LPDMUS_VERSION version);
212 /* returns name of given GUID */
213 extern const char *debugstr_dmguid (const GUID *id);
214 /* returns name of given error code */
215 extern const char *debugstr_dmreturn (DWORD code);
216 /* generic flags-dumping function */
217 extern const char *debugstr_flags (DWORD flags, const flag_info* names, size_t num_names);
218 extern const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask);
219 /* dump whole DMUS_OBJECTDESC struct */
220 extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc);
221
222 #endif  /* __WINE_DMSCRIPT_PRIVATE_H */