1 /* DirectMusic Wave Private Include
3 * Copyright (C) 2003-2004 Rok Mandeljc
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.
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.
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.
20 #ifndef __WINE_DSWAVE_PRIVATE_H
21 #define __WINE_DSWAVE_PRIVATE_H
31 #include "wine/debug.h"
32 #include "wine/list.h"
33 #include "wine/unicode.h"
40 /*****************************************************************************
43 typedef struct IDirectMusicWaveImpl IDirectMusicWaveImpl
;
46 /*****************************************************************************
47 * Predeclare the interface implementation structures
49 extern ICOM_VTABLE(IUnknown
) DirectMusicWave_Unknown_Vtbl
;
50 extern ICOM_VTABLE(IDirectMusicObject
) DirectMusicWave_Object_Vtbl
;
51 extern ICOM_VTABLE(IPersistStream
) DirectMusicWave_PersistStream_Vtbl
;
54 /*****************************************************************************
57 extern HRESULT WINAPI
DMUSIC_CreateDirectMusicWaveImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
);
60 /*****************************************************************************
61 * IDirectMusicWaveImpl implementation structure
63 struct IDirectMusicWaveImpl
{
65 ICOM_VTABLE(IUnknown
) *UnknownVtbl
;
66 ICOM_VTABLE(IDirectMusicObject
) *ObjectVtbl
;
67 ICOM_VTABLE(IPersistStream
) *PersistStreamVtbl
;
70 /* IDirectMusicWaveImpl fields */
71 LPDMUS_OBJECTDESC pDesc
;
76 extern HRESULT WINAPI
IDirectMusicWaveImpl_IUnknown_QueryInterface (LPUNKNOWN iface
, REFIID riid
, LPVOID
*ppobj
);
77 extern ULONG WINAPI
IDirectMusicWaveImpl_IUnknown_AddRef (LPUNKNOWN iface
);
78 extern ULONG WINAPI
IDirectMusicWaveImpl_IUnknown_Release (LPUNKNOWN iface
);
79 /* IDirectMusicObject: */
80 extern HRESULT WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface
, REFIID riid
, LPVOID
*ppobj
);
81 extern ULONG WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface
);
82 extern ULONG WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface
);
83 extern HRESULT WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
);
84 extern HRESULT WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
);
85 extern HRESULT WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface
, LPSTREAM pStream
, LPDMUS_OBJECTDESC pDesc
);
87 extern HRESULT WINAPI
IDirectMusicWaveImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, void** ppvObject
);
88 extern ULONG WINAPI
IDirectMusicWaveImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface
);
89 extern ULONG WINAPI
IDirectMusicWaveImpl_IPersistStream_Release (LPPERSISTSTREAM iface
);
90 extern HRESULT WINAPI
IDirectMusicWaveImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
);
91 extern HRESULT WINAPI
IDirectMusicWaveImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface
);
92 extern HRESULT WINAPI
IDirectMusicWaveImpl_IPersistStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
);
93 extern HRESULT WINAPI
IDirectMusicWaveImpl_IPersistStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
);
94 extern HRESULT WINAPI
IDirectMusicWaveImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
);
97 /*****************************************************************************
100 /* for simpler reading */
101 typedef struct _DMUS_PRIVATE_CHUNK
{
102 FOURCC fccID
; /* FOURCC ID of the chunk */
103 DWORD dwSize
; /* size of the chunk */
104 } DMUS_PRIVATE_CHUNK
, *LPDMUS_PRIVATE_CHUNK
;
106 /* check whether the given DWORD is even (return 0) or odd (return 1) */
107 static inline int even_or_odd (DWORD number
) {
108 return (number
& 0x1); /* basically, check if bit 0 is set ;) */
111 /* FOURCC to string conversion for debug messages */
112 static inline const char *debugstr_fourcc (DWORD fourcc
) {
113 if (!fourcc
) return "'null'";
114 return wine_dbg_sprintf ("\'%c%c%c%c\'",
115 (char)(fourcc
), (char)(fourcc
>> 8),
116 (char)(fourcc
>> 16), (char)(fourcc
>> 24));
119 /* DMUS_VERSION struct to string conversion for debug messages */
120 static inline const char *debugstr_dmversion (LPDMUS_VERSION version
) {
121 if (!version
) return "'null'";
122 return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
123 (int)((version
->dwVersionMS
&& 0xFFFF0000) >> 8), (int)(version
->dwVersionMS
&& 0x0000FFFF),
124 (int)((version
->dwVersionLS
&& 0xFFFF0000) >> 8), (int)(version
->dwVersionLS
&& 0x0000FFFF));
127 /* used for initialising structs (primarily for DMUS_OBJECTDESC) */
128 #define DM_STRUCT_INIT(x) \
130 memset((x), 0, sizeof(*(x))); \
131 (x)->dwSize = sizeof(*x); \
135 /* used for generic dumping (copied from ddraw) */
141 #define FE(x) { x, #x }
142 #define DMUSIC_dump_flags(flags,names,num_names) DMUSIC_dump_flags_(flags, names, num_names, 1)
144 /* generic dump function */
145 static inline void DMUSIC_dump_flags_ (DWORD flags
, const flag_info
* names
, size_t num_names
, int newline
) {
148 for (i
=0; i
< num_names
; i
++) {
149 if ((flags
& names
[i
].val
) || /* standard flag value */
150 ((!flags
) && (!names
[i
].val
))) /* zero value only */
151 DPRINTF("%s ", names
[i
].name
);
154 if (newline
) DPRINTF("\n");
157 static inline void DMUSIC_dump_DMUS_OBJ_FLAGS (DWORD flagmask
) {
158 static const flag_info flags
[] = {
162 FE(DMUS_OBJ_CATEGORY
),
163 FE(DMUS_OBJ_FILENAME
),
164 FE(DMUS_OBJ_FULLPATH
),
166 FE(DMUS_OBJ_VERSION
),
172 DMUSIC_dump_flags(flagmask
, flags
, sizeof(flags
)/sizeof(flags
[0]));
175 static inline void DMUSIC_dump_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc
) {
177 DPRINTF("DMUS_OBJECTDESC (%p)\n", pDesc
);
178 DPRINTF(" - dwSize = %ld\n", pDesc
->dwSize
);
179 DPRINTF(" - dwValidData = ");
180 DMUSIC_dump_DMUS_OBJ_FLAGS (pDesc
->dwValidData
);
181 if (pDesc
->dwValidData
& DMUS_OBJ_CLASS
) DPRINTF(" - guidClass = %s\n", debugstr_guid(&pDesc
->guidClass
));
182 if (pDesc
->dwValidData
& DMUS_OBJ_OBJECT
) DPRINTF(" - guidObject = %s\n", debugstr_guid(&pDesc
->guidObject
));
183 if (pDesc
->dwValidData
& DMUS_OBJ_DATE
) DPRINTF(" - ftDate = FIXME\n");
184 if (pDesc
->dwValidData
& DMUS_OBJ_VERSION
) DPRINTF(" - vVersion = %s\n", debugstr_dmversion(&pDesc
->vVersion
));
185 if (pDesc
->dwValidData
& DMUS_OBJ_NAME
) DPRINTF(" - wszName = %s\n", debugstr_w(pDesc
->wszName
));
186 if (pDesc
->dwValidData
& DMUS_OBJ_CATEGORY
) DPRINTF(" - wszCategory = %s\n", debugstr_w(pDesc
->wszCategory
));
187 if (pDesc
->dwValidData
& DMUS_OBJ_FILENAME
) DPRINTF(" - wszFileName = %s\n", debugstr_w(pDesc
->wszFileName
));
188 if (pDesc
->dwValidData
& DMUS_OBJ_MEMORY
) DPRINTF(" - llMemLength = %lli\n - pbMemData = %p\n", pDesc
->llMemLength
, pDesc
->pbMemData
);
189 if (pDesc
->dwValidData
& DMUS_OBJ_STREAM
) DPRINTF(" - pStream = %p\n", pDesc
->pStream
);
195 #endif /* __WINE_DSWAVE_PRIVATE_H */