wined3d: Remove an obsolete comment.
[wine] / dlls / dmband / dmutils.c
1 /* Debug and Helper Functions
2  *
3  * Copyright (C) 2004 Rok Mandeljc
4  * Copyright (C) 2004 Raphael Junqueira
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #define COBJMACROS
22
23 #include "config.h"
24 #include "wine/port.h"
25
26 #include <stdio.h>
27 #include <stdarg.h>
28 #include <string.h>
29
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winnt.h"
33 #include "wingdi.h"
34 #include "winuser.h"
35
36 #include "wine/debug.h"
37 #include "wine/unicode.h"
38 #include "objbase.h"
39
40 #include "dmusici.h"
41 #include "dmusicf.h"
42 #include "dmusics.h"
43
44 #include "dmutils.h"
45
46 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
47 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
48
49 /* generic flag-dumping function */
50 static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
51         static char buffer[128] = "", *ptr = &buffer[0];
52         unsigned int i;
53         int size = sizeof(buffer);
54
55         for (i=0; i < num_names; i++) {
56                 if ((flags & names[i].val)) {
57                         int cnt = snprintf(ptr, size, "%s ", names[i].name);
58                         if (cnt < 0 || cnt >= size) break;
59                         size -= cnt;
60                         ptr += cnt;
61                 }
62         }
63
64         ptr = &buffer[0];
65         return ptr;
66 }
67
68 /* dump DMUS_OBJ flags */
69 static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
70     static const flag_info flags[] = {
71             FE(DMUS_OBJ_OBJECT),
72             FE(DMUS_OBJ_CLASS),
73             FE(DMUS_OBJ_NAME),
74             FE(DMUS_OBJ_CATEGORY),
75             FE(DMUS_OBJ_FILENAME),
76             FE(DMUS_OBJ_FULLPATH),
77             FE(DMUS_OBJ_URL),
78             FE(DMUS_OBJ_VERSION),
79             FE(DMUS_OBJ_DATE),
80             FE(DMUS_OBJ_LOADED),
81             FE(DMUS_OBJ_MEMORY),
82             FE(DMUS_OBJ_STREAM)
83         };
84     return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
85 }
86
87 /* month number into month name (for debugstr_filetime) */
88 static const char *debugstr_month (DWORD dwMonth) {
89         switch (dwMonth) {
90                 case 1: return "January";
91                 case 2: return "February";
92                 case 3: return "March";
93                 case 4: return "April";
94                 case 5: return "May";
95                 case 6: return "June";
96                 case 7: return "July";
97                 case 8: return "August";
98                 case 9: return "September";
99                 case 10: return "October";
100                 case 11: return "November";
101                 case 12: return "December";
102                 default: return "Invalid";
103         }
104 }
105
106 /* FILETIME struct to string conversion for debug messages */
107 static const char *debugstr_filetime (const FILETIME *time) {
108         SYSTEMTIME sysTime;
109
110         if (!time) return "'null'";
111
112         FileTimeToSystemTime (time, &sysTime);
113
114         return wine_dbg_sprintf ("\'%02i. %s %04i %02i:%02i:%02i\'",
115                 sysTime.wDay, debugstr_month(sysTime.wMonth), sysTime.wYear,
116                 sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
117 }
118
119 /* DMUS_VERSION struct to string conversion for debug messages */
120 static const char *debugstr_dmversion (const DMUS_VERSION *version) {
121         if (!version) return "'null'";
122         return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
123                 HIWORD(version->dwVersionMS),LOWORD(version->dwVersionMS),
124                 HIWORD(version->dwVersionLS), LOWORD(version->dwVersionLS));
125 }
126
127 /* dump whole DMUS_OBJECTDESC struct */
128 static const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
129         if (pDesc) {
130                 char buffer[1024] = "", *ptr = &buffer[0];
131
132                 ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
133                 ptr += sprintf(ptr, " - dwSize = 0x%08X\n", pDesc->dwSize);
134                 ptr += sprintf(ptr, " - dwValidData = 0x%08X ( %s)\n", pDesc->dwValidData, debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
135                 if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
136                 if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
137                 if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = %s\n", debugstr_filetime (&pDesc->ftDate));
138                 if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
139                 if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
140                 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
141                 if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
142                 if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n  - pbMemData = %p\n",
143                                                                      wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
144                 if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p\n", pDesc->pStream);
145
146                 return wine_dbg_sprintf("%s", buffer);
147         } else {
148                 return "(NULL)";
149         }
150 }
151
152 HRESULT IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) {
153
154   switch (pChunk->fccID) {
155   case DMUS_FOURCC_GUID_CHUNK: {
156     TRACE_(dmfile)(": GUID chunk\n");
157     pDesc->dwValidData |= DMUS_OBJ_OBJECT;
158     IStream_Read (pStm, &pDesc->guidObject, pChunk->dwSize, NULL);
159     break;
160   }
161   case DMUS_FOURCC_DATE_CHUNK: {
162     TRACE_(dmfile)(": file date chunk\n");
163     pDesc->dwValidData |= DMUS_OBJ_DATE;
164     IStream_Read (pStm, &pDesc->ftDate, pChunk->dwSize, NULL);
165     break;
166   }
167   case DMUS_FOURCC_NAME_CHUNK: {
168     TRACE_(dmfile)(": name chunk\n");
169     pDesc->dwValidData |= DMUS_OBJ_NAME;
170     IStream_Read (pStm, pDesc->wszName, pChunk->dwSize, NULL);
171     break;
172   }
173   case DMUS_FOURCC_FILE_CHUNK: {
174     TRACE_(dmfile)(": file name chunk\n");
175     pDesc->dwValidData |= DMUS_OBJ_FILENAME;
176     IStream_Read (pStm, pDesc->wszFileName, pChunk->dwSize, NULL);
177     break;
178   }
179   case DMUS_FOURCC_VERSION_CHUNK: {
180     TRACE_(dmfile)(": version chunk\n");
181     pDesc->dwValidData |= DMUS_OBJ_VERSION;
182     IStream_Read (pStm, &pDesc->vVersion, pChunk->dwSize, NULL);
183     break;
184   }
185   case DMUS_FOURCC_CATEGORY_CHUNK: {
186     TRACE_(dmfile)(": category chunk\n");
187     pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
188     IStream_Read (pStm, pDesc->wszCategory, pChunk->dwSize, NULL);
189     break;
190   }
191   default:
192     /* not handled */
193     return S_FALSE;
194   }
195
196   return S_OK;
197 }
198
199 HRESULT IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) {
200
201   LARGE_INTEGER liMove; /* used when skipping chunks */
202
203   /**
204    * don't ask me why, but M$ puts INFO elements in UNFO list sometimes
205    * (though strings seem to be valid unicode) 
206    */
207   switch (pChunk->fccID) {
208
209   case mmioFOURCC('I','N','A','M'):
210   case DMUS_FOURCC_UNAM_CHUNK: {
211     TRACE_(dmfile)(": name chunk\n");
212     pDesc->dwValidData |= DMUS_OBJ_NAME;
213     IStream_Read (pStm, pDesc->wszName, pChunk->dwSize, NULL);
214     TRACE_(dmfile)(" - wszName: %s\n", debugstr_w(pDesc->wszName));
215     break;
216   }
217
218   case mmioFOURCC('I','A','R','T'):
219   case DMUS_FOURCC_UART_CHUNK: {
220     TRACE_(dmfile)(": artist chunk (ignored)\n");
221     liMove.QuadPart = pChunk->dwSize;
222     IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
223     break;
224   }
225   case mmioFOURCC('I','C','O','P'):
226   case DMUS_FOURCC_UCOP_CHUNK: {
227     TRACE_(dmfile)(": copyright chunk (ignored)\n");
228     liMove.QuadPart = pChunk->dwSize;
229     IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
230     break;
231   }
232   case mmioFOURCC('I','S','B','J'):
233   case DMUS_FOURCC_USBJ_CHUNK: {
234     TRACE_(dmfile)(": subject chunk (ignored)\n");
235     liMove.QuadPart = pChunk->dwSize;
236     IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
237     break;
238   }
239   case mmioFOURCC('I','C','M','T'):
240   case DMUS_FOURCC_UCMT_CHUNK: {
241     TRACE_(dmfile)(": comment chunk (ignored)\n");
242     liMove.QuadPart = pChunk->dwSize;
243     IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
244     break;
245   }
246   default:
247     /* not handled */
248     return S_FALSE;
249   }
250
251   return S_OK;
252 }
253
254 HRESULT IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, IDirectMusicObject** ppObject) {
255   DMUS_PRIVATE_CHUNK Chunk;
256   DWORD ListSize[3], ListCount[3];
257   LARGE_INTEGER liMove; /* used when skipping chunks */
258   HRESULT hr;
259
260   DMUS_IO_REFERENCE ref;
261   DMUS_OBJECTDESC ref_desc;
262
263   memset(&ref, 0, sizeof(ref));
264   memset(&ref_desc, 0, sizeof(ref_desc));
265
266   if (pChunk->fccID != DMUS_FOURCC_REF_LIST) {
267     ERR_(dmfile)(": %s chunk should be a REF list\n", debugstr_fourcc (pChunk->fccID));
268     return E_FAIL;
269   }
270
271   ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
272   ListCount[0] = 0;
273
274   do {
275     IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
276     ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
277     TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
278
279     hr = IDirectMusicUtils_IPersistStream_ParseDescGeneric(&Chunk, pStm, &ref_desc);
280     if (FAILED(hr)) return hr;
281     
282     if (hr == S_FALSE) {
283       switch (Chunk.fccID) { 
284       case DMUS_FOURCC_REF_CHUNK: {
285         TRACE_(dmfile)(": Reference chunk\n");
286         if (Chunk.dwSize != sizeof(DMUS_IO_REFERENCE)) return E_FAIL;
287         IStream_Read (pStm, &ref, sizeof(DMUS_IO_REFERENCE), NULL);
288         TRACE_(dmfile)(" - guidClassID: %s\n", debugstr_dmguid(&ref.guidClassID));
289         TRACE_(dmfile)(" - dwValidData: %u\n", ref.dwValidData);
290         break;
291       } 
292       default: {
293         TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
294         liMove.QuadPart = Chunk.dwSize;
295         IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
296         break;                                          
297       }
298       }
299     }
300     TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
301   } while (ListCount[0] < ListSize[0]);
302
303   ref_desc.dwValidData |= DMUS_OBJ_CLASS;
304   ref_desc.guidClass = ref.guidClassID;
305
306   TRACE_(dmfile)("** DM Reference Begin of Load ***\n");
307   TRACE_(dmfile)("With Desc:\n");
308   debugstr_DMUS_OBJECTDESC(&ref_desc);
309
310   {
311     LPDIRECTMUSICGETLOADER pGetLoader = NULL;
312     LPDIRECTMUSICLOADER pLoader = NULL;
313
314     IStream_QueryInterface (pStm, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader);
315     IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader);
316     IDirectMusicGetLoader_Release (pGetLoader);
317   
318     hr = IDirectMusicLoader_GetObject (pLoader, &ref_desc, &IID_IDirectMusicObject, (LPVOID*)ppObject);
319     IDirectMusicLoader_Release (pLoader); /* release loader */
320   }
321   TRACE_(dmfile)("** DM Reference End of Load ***\n");
322
323   return S_OK;
324 }
325
326 /* FOURCC to string conversion for debug messages */
327 const char *debugstr_fourcc (DWORD fourcc) {
328     if (!fourcc) return "'null'";
329     return wine_dbg_sprintf ("\'%c%c%c%c\'",
330                 (char)(fourcc), (char)(fourcc >> 8),
331         (char)(fourcc >> 16), (char)(fourcc >> 24));
332 }
333
334 /* returns name of given GUID */
335 const char *debugstr_dmguid (const GUID *id) {
336         static const guid_info guids[] = {
337                 /* CLSIDs */
338                 GE(CLSID_AudioVBScript),
339                 GE(CLSID_DirectMusic),
340                 GE(CLSID_DirectMusicAudioPath),
341                 GE(CLSID_DirectMusicAudioPathConfig),
342                 GE(CLSID_DirectMusicAuditionTrack),
343                 GE(CLSID_DirectMusicBand),
344                 GE(CLSID_DirectMusicBandTrack),
345                 GE(CLSID_DirectMusicChordMapTrack),
346                 GE(CLSID_DirectMusicChordMap),
347                 GE(CLSID_DirectMusicChordTrack),
348                 GE(CLSID_DirectMusicCollection),
349                 GE(CLSID_DirectMusicCommandTrack),
350                 GE(CLSID_DirectMusicComposer),
351                 GE(CLSID_DirectMusicContainer),
352                 GE(CLSID_DirectMusicGraph),
353                 GE(CLSID_DirectMusicLoader),
354                 GE(CLSID_DirectMusicLyricsTrack),
355                 GE(CLSID_DirectMusicMarkerTrack),
356                 GE(CLSID_DirectMusicMelodyFormulationTrack),
357                 GE(CLSID_DirectMusicMotifTrack),
358                 GE(CLSID_DirectMusicMuteTrack),
359                 GE(CLSID_DirectMusicParamControlTrack),
360                 GE(CLSID_DirectMusicPatternTrack),
361                 GE(CLSID_DirectMusicPerformance),
362                 GE(CLSID_DirectMusicScript),
363                 GE(CLSID_DirectMusicScriptAutoImpSegment),
364                 GE(CLSID_DirectMusicScriptAutoImpPerformance),
365                 GE(CLSID_DirectMusicScriptAutoImpSegmentState),
366                 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
367                 GE(CLSID_DirectMusicScriptAutoImpAudioPath),
368                 GE(CLSID_DirectMusicScriptAutoImpSong),
369                 GE(CLSID_DirectMusicScriptSourceCodeLoader),
370                 GE(CLSID_DirectMusicScriptTrack),
371                 GE(CLSID_DirectMusicSection),
372                 GE(CLSID_DirectMusicSegment),
373                 GE(CLSID_DirectMusicSegmentState),
374                 GE(CLSID_DirectMusicSegmentTriggerTrack),
375                 GE(CLSID_DirectMusicSegTriggerTrack),
376                 GE(CLSID_DirectMusicSeqTrack),
377                 GE(CLSID_DirectMusicSignPostTrack),
378                 GE(CLSID_DirectMusicSong),
379                 GE(CLSID_DirectMusicStyle),
380                 GE(CLSID_DirectMusicStyleTrack),
381                 GE(CLSID_DirectMusicSynth),
382                 GE(CLSID_DirectMusicSynthSink),
383                 GE(CLSID_DirectMusicSysExTrack),
384                 GE(CLSID_DirectMusicTemplate),
385                 GE(CLSID_DirectMusicTempoTrack),
386                 GE(CLSID_DirectMusicTimeSigTrack),
387                 GE(CLSID_DirectMusicWaveTrack),
388                 GE(CLSID_DirectSoundWave),
389                 /* IIDs */
390                 GE(IID_IDirectMusic),
391                 GE(IID_IDirectMusic2),
392                 GE(IID_IDirectMusic8),
393                 GE(IID_IDirectMusicAudioPath),
394                 GE(IID_IDirectMusicBand),
395                 GE(IID_IDirectMusicBuffer),
396                 GE(IID_IDirectMusicChordMap),
397                 GE(IID_IDirectMusicCollection),
398                 GE(IID_IDirectMusicComposer),
399                 GE(IID_IDirectMusicContainer),
400                 GE(IID_IDirectMusicDownload),
401                 GE(IID_IDirectMusicDownloadedInstrument),
402                 GE(IID_IDirectMusicGetLoader),
403                 GE(IID_IDirectMusicGraph),
404                 GE(IID_IDirectMusicInstrument),
405                 GE(IID_IDirectMusicLoader),
406                 GE(IID_IDirectMusicLoader8),
407                 GE(IID_IDirectMusicObject),
408                 GE(IID_IDirectMusicPatternTrack),
409                 GE(IID_IDirectMusicPerformance),
410                 GE(IID_IDirectMusicPerformance2),
411                 GE(IID_IDirectMusicPerformance8),
412                 GE(IID_IDirectMusicPort),
413                 GE(IID_IDirectMusicPortDownload),
414                 GE(IID_IDirectMusicScript),
415                 GE(IID_IDirectMusicSegment),
416                 GE(IID_IDirectMusicSegment2),
417                 GE(IID_IDirectMusicSegment8),
418                 GE(IID_IDirectMusicSegmentState),
419                 GE(IID_IDirectMusicSegmentState8),
420                 GE(IID_IDirectMusicStyle),
421                 GE(IID_IDirectMusicStyle8),
422                 GE(IID_IDirectMusicSynth),
423                 GE(IID_IDirectMusicSynth8),
424                 GE(IID_IDirectMusicSynthSink),
425                 GE(IID_IDirectMusicThru),
426                 GE(IID_IDirectMusicTool),
427                 GE(IID_IDirectMusicTool8),
428                 GE(IID_IDirectMusicTrack),
429                 GE(IID_IDirectMusicTrack8),
430                 GE(IID_IUnknown),
431                 GE(IID_IPersistStream),
432                 GE(IID_IStream),
433                 GE(IID_IClassFactory),
434                 /* GUIDs */
435                 GE(GUID_DirectMusicAllTypes),
436                 GE(GUID_NOTIFICATION_CHORD),
437                 GE(GUID_NOTIFICATION_COMMAND),
438                 GE(GUID_NOTIFICATION_MEASUREANDBEAT),
439                 GE(GUID_NOTIFICATION_PERFORMANCE),
440                 GE(GUID_NOTIFICATION_RECOMPOSE),
441                 GE(GUID_NOTIFICATION_SEGMENT),
442                 GE(GUID_BandParam),
443                 GE(GUID_ChordParam),
444                 GE(GUID_CommandParam),
445                 GE(GUID_CommandParam2),
446                 GE(GUID_CommandParamNext),
447                 GE(GUID_IDirectMusicBand),
448                 GE(GUID_IDirectMusicChordMap),
449                 GE(GUID_IDirectMusicStyle),
450                 GE(GUID_MuteParam),
451                 GE(GUID_Play_Marker),
452                 GE(GUID_RhythmParam),
453                 GE(GUID_TempoParam),
454                 GE(GUID_TimeSignature),
455                 GE(GUID_Valid_Start_Time),
456                 GE(GUID_Clear_All_Bands),
457                 GE(GUID_ConnectToDLSCollection),
458                 GE(GUID_Disable_Auto_Download),
459                 GE(GUID_DisableTempo),
460                 GE(GUID_DisableTimeSig),
461                 GE(GUID_Download),
462                 GE(GUID_DownloadToAudioPath),
463                 GE(GUID_Enable_Auto_Download),
464                 GE(GUID_EnableTempo),
465                 GE(GUID_EnableTimeSig),
466                 GE(GUID_IgnoreBankSelectForGM),
467                 GE(GUID_SeedVariations),
468                 GE(GUID_StandardMIDIFile),
469                 GE(GUID_Unload),
470                 GE(GUID_UnloadFromAudioPath),
471                 GE(GUID_Variations),
472                 GE(GUID_PerfMasterTempo),
473                 GE(GUID_PerfMasterVolume),
474                 GE(GUID_PerfMasterGrooveLevel),
475                 GE(GUID_PerfAutoDownload),
476                 GE(GUID_DefaultGMCollection),
477                 GE(GUID_Synth_Default),
478                 GE(GUID_Buffer_Reverb),
479                 GE(GUID_Buffer_EnvReverb),
480                 GE(GUID_Buffer_Stereo),
481                 GE(GUID_Buffer_3D_Dry),
482                 GE(GUID_Buffer_Mono),
483                 GE(GUID_DMUS_PROP_GM_Hardware),
484                 GE(GUID_DMUS_PROP_GS_Capable),
485                 GE(GUID_DMUS_PROP_GS_Hardware),
486                 GE(GUID_DMUS_PROP_DLS1),
487                 GE(GUID_DMUS_PROP_DLS2),
488                 GE(GUID_DMUS_PROP_Effects),
489                 GE(GUID_DMUS_PROP_INSTRUMENT2),
490                 GE(GUID_DMUS_PROP_LegacyCaps),
491                 GE(GUID_DMUS_PROP_MemorySize),
492                 GE(GUID_DMUS_PROP_SampleMemorySize),
493                 GE(GUID_DMUS_PROP_SamplePlaybackRate),
494                 GE(GUID_DMUS_PROP_SetSynthSink),
495                 GE(GUID_DMUS_PROP_SinkUsesDSound),
496                 GE(GUID_DMUS_PROP_SynthSink_DSOUND),
497                 GE(GUID_DMUS_PROP_SynthSink_WAVE),
498                 GE(GUID_DMUS_PROP_Volume),
499                 GE(GUID_DMUS_PROP_WavesReverb),
500                 GE(GUID_DMUS_PROP_WriteLatency),
501                 GE(GUID_DMUS_PROP_WritePeriod),
502                 GE(GUID_DMUS_PROP_XG_Capable),
503                 GE(GUID_DMUS_PROP_XG_Hardware)
504         };
505
506         unsigned int i;
507
508         if (!id) return "(null)";
509         for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
510                 if (IsEqualGUID(id, guids[i].guid))
511                         return guids[i].name;
512         }
513         
514         /* if we didn't find it, act like standard debugstr_guid */     
515         return debugstr_guid(id);
516 }       
517
518
519 void debug_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
520         if (pDesc) {
521                 TRACE("DMUS_OBJECTDESC (%p):\n", pDesc);
522                 TRACE(" - dwSize = %d\n", pDesc->dwSize);
523                 TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
524                 if (pDesc->dwValidData & DMUS_OBJ_NAME)     TRACE(" - wszName = %s\n", debugstr_w(pDesc->wszName));
525                 if (pDesc->dwValidData & DMUS_OBJ_CLASS)    TRACE(" - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
526                 if (pDesc->dwValidData & DMUS_OBJ_OBJECT)   TRACE(" - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
527                 if (pDesc->dwValidData & DMUS_OBJ_DATE)     TRACE(" - ftDate = FIXME\n");
528                 if (pDesc->dwValidData & DMUS_OBJ_VERSION)  TRACE(" - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
529                 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
530                 if (pDesc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
531                 if (pDesc->dwValidData & DMUS_OBJ_MEMORY)   TRACE(" - llMemLength = 0x%s\n  - pbMemData = %p\n",
532                                                                 wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
533                 if (pDesc->dwValidData & DMUS_OBJ_STREAM)   TRACE(" - pStream = %p\n", pDesc->pStream);
534         } else {
535                 TRACE("(NULL)\n");
536         }
537 }