1 /* Debug and Helper Functions
3 * Copyright (C) 2004 Rok Mandeljc
4 * Copyright (C) 2004 Raphael Junqueira
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.
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.
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
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
44 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
46 /* check whether the given DWORD is even (return 0) or odd (return 1) */
47 int even_or_odd (DWORD number) {
48 return (number & 0x1); /* basically, check if bit 0 is set ;) */
51 /* figures out whether given FOURCC is valid DirectMusic form ID */
52 BOOL IS_VALID_DMFORM (FOURCC chunkID) {
53 if ((chunkID == DMUS_FOURCC_AUDIOPATH_FORM) || (chunkID == DMUS_FOURCC_BAND_FORM) || (chunkID == DMUS_FOURCC_CHORDMAP_FORM)
54 || (chunkID == DMUS_FOURCC_CONTAINER_FORM) || (chunkID == FOURCC_DLS) || (chunkID == DMUS_FOURCC_SCRIPT_FORM)
55 || (chunkID == DMUS_FOURCC_SEGMENT_FORM) || (chunkID == DMUS_FOURCC_STYLE_FORM) || (chunkID == DMUS_FOURCC_TOOLGRAPH_FORM)
56 || (chunkID == DMUS_FOURCC_TRACK_FORM) || (chunkID == mmioFOURCC('W','A','V','E'))) return TRUE;
60 /* generic flag-dumping function */
61 static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
62 static char buffer[128] = "", *ptr = &buffer[0];
63 unsigned int i, size = sizeof(buffer);
65 for (i=0; i < num_names; i++) {
66 if ((flags & names[i].val)) {
67 int cnt = snprintf(ptr, size, "%s ", names[i].name);
68 if (cnt < 0 || cnt >= size) break;
78 /* dump DMUS_OBJ flags */
79 static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
80 static const flag_info flags[] = {
84 FE(DMUS_OBJ_CATEGORY),
85 FE(DMUS_OBJ_FILENAME),
86 FE(DMUS_OBJ_FULLPATH),
94 return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
97 /* month number into month name (for debugstr_filetime) */
98 static const char *debugstr_month (DWORD dwMonth) {
100 case 1: return "January";
101 case 2: return "February";
102 case 3: return "March";
103 case 4: return "April";
104 case 5: return "May";
105 case 6: return "June";
106 case 7: return "July";
107 case 8: return "August";
108 case 9: return "September";
109 case 10: return "October";
110 case 11: return "November";
111 case 12: return "December";
112 default: return "Invalid";
116 /* FILETIME struct to string conversion for debug messages */
117 static const char *debugstr_filetime (const FILETIME *time) {
120 if (!time) return "'null'";
122 FileTimeToSystemTime (time, &sysTime);
124 return wine_dbg_sprintf ("\'%02i. %s %04i %02i:%02i:%02i\'",
125 sysTime.wDay, debugstr_month(sysTime.wMonth), sysTime.wYear,
126 sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
129 /* DMUS_VERSION struct to string conversion for debug messages */
130 static const char *debugstr_dmversion (const DMUS_VERSION *version) {
131 if (!version) return "'null'";
132 return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
133 HIWORD(version->dwVersionMS),LOWORD(version->dwVersionMS),
134 HIWORD(version->dwVersionLS), LOWORD(version->dwVersionLS));
137 /* dump whole DMUS_OBJECTDESC struct */
138 static const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
140 char buffer[1024] = "", *ptr = &buffer[0];
142 ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
143 ptr += sprintf(ptr, " - dwSize = 0x%08X\n", pDesc->dwSize);
144 ptr += sprintf(ptr, " - dwValidData = 0x%08X ( %s)\n", pDesc->dwValidData, debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
145 if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
146 if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
147 if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = %s\n", debugstr_filetime (&pDesc->ftDate));
148 if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
149 if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
150 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
151 if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
152 if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n",
153 wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
154 if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p\n", pDesc->pStream);
156 return wine_dbg_sprintf("%s", buffer);
162 HRESULT IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) {
164 switch (pChunk->fccID) {
165 case DMUS_FOURCC_GUID_CHUNK: {
166 TRACE_(dmfile)(": GUID chunk\n");
167 pDesc->dwValidData |= DMUS_OBJ_OBJECT;
168 IStream_Read (pStm, &pDesc->guidObject, pChunk->dwSize, NULL);
171 case DMUS_FOURCC_DATE_CHUNK: {
172 TRACE_(dmfile)(": file date chunk\n");
173 pDesc->dwValidData |= DMUS_OBJ_DATE;
174 IStream_Read (pStm, &pDesc->ftDate, pChunk->dwSize, NULL);
177 case DMUS_FOURCC_NAME_CHUNK: {
178 TRACE_(dmfile)(": name chunk\n");
179 pDesc->dwValidData |= DMUS_OBJ_NAME;
180 IStream_Read (pStm, &pDesc->wszName, pChunk->dwSize, NULL);
183 case DMUS_FOURCC_FILE_CHUNK: {
184 TRACE_(dmfile)(": file name chunk\n");
185 pDesc->dwValidData |= DMUS_OBJ_FILENAME;
186 IStream_Read (pStm, &pDesc->wszFileName, pChunk->dwSize, NULL);
189 case DMUS_FOURCC_VERSION_CHUNK: {
190 TRACE_(dmfile)(": version chunk\n");
191 pDesc->dwValidData |= DMUS_OBJ_VERSION;
192 IStream_Read (pStm, &pDesc->vVersion, pChunk->dwSize, NULL);
195 case DMUS_FOURCC_CATEGORY_CHUNK: {
196 TRACE_(dmfile)(": category chunk\n");
197 pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
198 IStream_Read (pStm, pDesc->wszCategory, pChunk->dwSize, NULL);
209 HRESULT IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) {
211 LARGE_INTEGER liMove; /* used when skipping chunks */
214 * don't ask me why, but M$ puts INFO elements in UNFO list sometimes
215 * (though strings seem to be valid unicode)
217 switch (pChunk->fccID) {
219 case mmioFOURCC('I','N','A','M'):
220 case DMUS_FOURCC_UNAM_CHUNK: {
221 TRACE_(dmfile)(": name chunk\n");
222 pDesc->dwValidData |= DMUS_OBJ_NAME;
223 IStream_Read (pStm, pDesc->wszName, pChunk->dwSize, NULL);
224 TRACE_(dmfile)(" - wszName: %s\n", debugstr_w(pDesc->wszName));
228 case mmioFOURCC('I','A','R','T'):
229 case DMUS_FOURCC_UART_CHUNK: {
230 TRACE_(dmfile)(": artist chunk (ignored)\n");
231 liMove.QuadPart = pChunk->dwSize;
232 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
235 case mmioFOURCC('I','C','O','P'):
236 case DMUS_FOURCC_UCOP_CHUNK: {
237 TRACE_(dmfile)(": copyright chunk (ignored)\n");
238 liMove.QuadPart = pChunk->dwSize;
239 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
242 case mmioFOURCC('I','S','B','J'):
243 case DMUS_FOURCC_USBJ_CHUNK: {
244 TRACE_(dmfile)(": subject chunk (ignored)\n");
245 liMove.QuadPart = pChunk->dwSize;
246 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
249 case mmioFOURCC('I','C','M','T'):
250 case DMUS_FOURCC_UCMT_CHUNK: {
251 TRACE_(dmfile)(": comment chunk (ignored)\n");
252 liMove.QuadPart = pChunk->dwSize;
253 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
264 HRESULT IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, IDirectMusicObject** ppObject) {
265 DMUS_PRIVATE_CHUNK Chunk;
266 DWORD ListSize[3], ListCount[3];
267 LARGE_INTEGER liMove; /* used when skipping chunks */
270 DMUS_IO_REFERENCE ref;
271 DMUS_OBJECTDESC ref_desc;
273 memset(&ref, 0, sizeof(ref));
274 memset(&ref_desc, 0, sizeof(ref_desc));
276 if (pChunk->fccID != DMUS_FOURCC_REF_LIST) {
277 ERR_(dmfile)(": %s chunk should be a REF list\n", debugstr_fourcc (pChunk->fccID));
281 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
285 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
286 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
287 TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
289 hr = IDirectMusicUtils_IPersistStream_ParseDescGeneric(&Chunk, pStm, &ref_desc);
290 if (FAILED(hr)) return hr;
293 switch (Chunk.fccID) {
294 case DMUS_FOURCC_REF_CHUNK: {
295 TRACE_(dmfile)(": Reference chunk\n");
296 if (Chunk.dwSize != sizeof(DMUS_IO_REFERENCE)) return E_FAIL;
297 IStream_Read (pStm, &ref, sizeof(DMUS_IO_REFERENCE), NULL);
298 TRACE_(dmfile)(" - guidClassID: %s\n", debugstr_dmguid(&ref.guidClassID));
299 TRACE_(dmfile)(" - dwValidData: %u\n", ref.dwValidData);
303 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
304 liMove.QuadPart = Chunk.dwSize;
305 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
310 TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
311 } while (ListCount[0] < ListSize[0]);
313 ref_desc.dwValidData |= DMUS_OBJ_CLASS;
314 memcpy(&ref_desc.guidClass, &ref.guidClassID, sizeof(ref.guidClassID));
316 TRACE_(dmfile)("** DM Reference Begin of Load ***\n");
317 TRACE_(dmfile)("With Desc:\n");
318 debugstr_DMUS_OBJECTDESC(&ref_desc);
321 LPDIRECTMUSICGETLOADER pGetLoader = NULL;
322 LPDIRECTMUSICLOADER pLoader = NULL;
324 IStream_QueryInterface (pStm, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader);
325 IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader);
326 IDirectMusicGetLoader_Release (pGetLoader);
328 hr = IDirectMusicLoader_GetObject (pLoader, &ref_desc, &IID_IDirectMusicObject, (LPVOID*)ppObject);
329 IDirectMusicLoader_Release (pLoader); /* release loader */
331 TRACE_(dmfile)("** DM Reference End of Load ***\n");
336 /* translate STREAM_SEEK flag to string */
337 const char *resolve_STREAM_SEEK (DWORD flag) {
339 case STREAM_SEEK_SET:
340 return "STREAM_SEEK_SET";
341 case STREAM_SEEK_CUR:
342 return "STREAM_SEEK_CUR";
343 case STREAM_SEEK_END:
344 return "STREAM_SEEK_END";
350 /* FOURCC to string conversion for debug messages */
351 const char *debugstr_fourcc (DWORD fourcc) {
352 if (!fourcc) return "'null'";
353 return wine_dbg_sprintf ("\'%c%c%c%c\'",
354 (char)(fourcc), (char)(fourcc >> 8),
355 (char)(fourcc >> 16), (char)(fourcc >> 24));
358 /* returns name of given GUID */
359 const char *debugstr_dmguid (const GUID *id) {
360 static const guid_info guids[] = {
362 GE(CLSID_AudioVBScript),
363 GE(CLSID_DirectMusic),
364 GE(CLSID_DirectMusicAudioPath),
365 GE(CLSID_DirectMusicAudioPathConfig),
366 GE(CLSID_DirectMusicAuditionTrack),
367 GE(CLSID_DirectMusicBand),
368 GE(CLSID_DirectMusicBandTrack),
369 GE(CLSID_DirectMusicChordMapTrack),
370 GE(CLSID_DirectMusicChordMap),
371 GE(CLSID_DirectMusicChordTrack),
372 GE(CLSID_DirectMusicCollection),
373 GE(CLSID_DirectMusicCommandTrack),
374 GE(CLSID_DirectMusicComposer),
375 GE(CLSID_DirectMusicContainer),
376 GE(CLSID_DirectMusicGraph),
377 GE(CLSID_DirectMusicLoader),
378 GE(CLSID_DirectMusicLyricsTrack),
379 GE(CLSID_DirectMusicMarkerTrack),
380 GE(CLSID_DirectMusicMelodyFormulationTrack),
381 GE(CLSID_DirectMusicMotifTrack),
382 GE(CLSID_DirectMusicMuteTrack),
383 GE(CLSID_DirectMusicParamControlTrack),
384 GE(CLSID_DirectMusicPatternTrack),
385 GE(CLSID_DirectMusicPerformance),
386 GE(CLSID_DirectMusicScript),
387 GE(CLSID_DirectMusicScriptAutoImpSegment),
388 GE(CLSID_DirectMusicScriptAutoImpPerformance),
389 GE(CLSID_DirectMusicScriptAutoImpSegmentState),
390 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
391 GE(CLSID_DirectMusicScriptAutoImpAudioPath),
392 GE(CLSID_DirectMusicScriptAutoImpSong),
393 GE(CLSID_DirectMusicScriptSourceCodeLoader),
394 GE(CLSID_DirectMusicScriptTrack),
395 GE(CLSID_DirectMusicSection),
396 GE(CLSID_DirectMusicSegment),
397 GE(CLSID_DirectMusicSegmentState),
398 GE(CLSID_DirectMusicSegmentTriggerTrack),
399 GE(CLSID_DirectMusicSegTriggerTrack),
400 GE(CLSID_DirectMusicSeqTrack),
401 GE(CLSID_DirectMusicSignPostTrack),
402 GE(CLSID_DirectMusicSong),
403 GE(CLSID_DirectMusicStyle),
404 GE(CLSID_DirectMusicStyleTrack),
405 GE(CLSID_DirectMusicSynth),
406 GE(CLSID_DirectMusicSynthSink),
407 GE(CLSID_DirectMusicSysExTrack),
408 GE(CLSID_DirectMusicTemplate),
409 GE(CLSID_DirectMusicTempoTrack),
410 GE(CLSID_DirectMusicTimeSigTrack),
411 GE(CLSID_DirectMusicWaveTrack),
412 GE(CLSID_DirectSoundWave),
414 GE(IID_IDirectMusic),
415 GE(IID_IDirectMusic2),
416 GE(IID_IDirectMusic8),
417 GE(IID_IDirectMusicAudioPath),
418 GE(IID_IDirectMusicBand),
419 GE(IID_IDirectMusicBuffer),
420 GE(IID_IDirectMusicChordMap),
421 GE(IID_IDirectMusicCollection),
422 GE(IID_IDirectMusicComposer),
423 GE(IID_IDirectMusicContainer),
424 GE(IID_IDirectMusicDownload),
425 GE(IID_IDirectMusicDownloadedInstrument),
426 GE(IID_IDirectMusicGetLoader),
427 GE(IID_IDirectMusicGraph),
428 GE(IID_IDirectMusicInstrument),
429 GE(IID_IDirectMusicLoader),
430 GE(IID_IDirectMusicLoader8),
431 GE(IID_IDirectMusicObject),
432 GE(IID_IDirectMusicPatternTrack),
433 GE(IID_IDirectMusicPerformance),
434 GE(IID_IDirectMusicPerformance2),
435 GE(IID_IDirectMusicPerformance8),
436 GE(IID_IDirectMusicPort),
437 GE(IID_IDirectMusicPortDownload),
438 GE(IID_IDirectMusicScript),
439 GE(IID_IDirectMusicSegment),
440 GE(IID_IDirectMusicSegment2),
441 GE(IID_IDirectMusicSegment8),
442 GE(IID_IDirectMusicSegmentState),
443 GE(IID_IDirectMusicSegmentState8),
444 GE(IID_IDirectMusicStyle),
445 GE(IID_IDirectMusicStyle8),
446 GE(IID_IDirectMusicSynth),
447 GE(IID_IDirectMusicSynth8),
448 GE(IID_IDirectMusicSynthSink),
449 GE(IID_IDirectMusicThru),
450 GE(IID_IDirectMusicTool),
451 GE(IID_IDirectMusicTool8),
452 GE(IID_IDirectMusicTrack),
453 GE(IID_IDirectMusicTrack8),
455 GE(IID_IPersistStream),
457 GE(IID_IClassFactory),
459 GE(GUID_DirectMusicAllTypes),
460 GE(GUID_NOTIFICATION_CHORD),
461 GE(GUID_NOTIFICATION_COMMAND),
462 GE(GUID_NOTIFICATION_MEASUREANDBEAT),
463 GE(GUID_NOTIFICATION_PERFORMANCE),
464 GE(GUID_NOTIFICATION_RECOMPOSE),
465 GE(GUID_NOTIFICATION_SEGMENT),
468 GE(GUID_CommandParam),
469 GE(GUID_CommandParam2),
470 GE(GUID_CommandParamNext),
471 GE(GUID_IDirectMusicBand),
472 GE(GUID_IDirectMusicChordMap),
473 GE(GUID_IDirectMusicStyle),
475 GE(GUID_Play_Marker),
476 GE(GUID_RhythmParam),
478 GE(GUID_TimeSignature),
479 GE(GUID_Valid_Start_Time),
480 GE(GUID_Clear_All_Bands),
481 GE(GUID_ConnectToDLSCollection),
482 GE(GUID_Disable_Auto_Download),
483 GE(GUID_DisableTempo),
484 GE(GUID_DisableTimeSig),
486 GE(GUID_DownloadToAudioPath),
487 GE(GUID_Enable_Auto_Download),
488 GE(GUID_EnableTempo),
489 GE(GUID_EnableTimeSig),
490 GE(GUID_IgnoreBankSelectForGM),
491 GE(GUID_SeedVariations),
492 GE(GUID_StandardMIDIFile),
494 GE(GUID_UnloadFromAudioPath),
496 GE(GUID_PerfMasterTempo),
497 GE(GUID_PerfMasterVolume),
498 GE(GUID_PerfMasterGrooveLevel),
499 GE(GUID_PerfAutoDownload),
500 GE(GUID_DefaultGMCollection),
501 GE(GUID_Synth_Default),
502 GE(GUID_Buffer_Reverb),
503 GE(GUID_Buffer_EnvReverb),
504 GE(GUID_Buffer_Stereo),
505 GE(GUID_Buffer_3D_Dry),
506 GE(GUID_Buffer_Mono),
507 GE(GUID_DMUS_PROP_GM_Hardware),
508 GE(GUID_DMUS_PROP_GS_Capable),
509 GE(GUID_DMUS_PROP_GS_Hardware),
510 GE(GUID_DMUS_PROP_DLS1),
511 GE(GUID_DMUS_PROP_DLS2),
512 GE(GUID_DMUS_PROP_Effects),
513 GE(GUID_DMUS_PROP_INSTRUMENT2),
514 GE(GUID_DMUS_PROP_LegacyCaps),
515 GE(GUID_DMUS_PROP_MemorySize),
516 GE(GUID_DMUS_PROP_SampleMemorySize),
517 GE(GUID_DMUS_PROP_SamplePlaybackRate),
518 GE(GUID_DMUS_PROP_SetSynthSink),
519 GE(GUID_DMUS_PROP_SinkUsesDSound),
520 GE(GUID_DMUS_PROP_SynthSink_DSOUND),
521 GE(GUID_DMUS_PROP_SynthSink_WAVE),
522 GE(GUID_DMUS_PROP_Volume),
523 GE(GUID_DMUS_PROP_WavesReverb),
524 GE(GUID_DMUS_PROP_WriteLatency),
525 GE(GUID_DMUS_PROP_WritePeriod),
526 GE(GUID_DMUS_PROP_XG_Capable),
527 GE(GUID_DMUS_PROP_XG_Hardware)
532 if (!id) return "(null)";
533 for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
534 if (IsEqualGUID(id, guids[i].guid))
535 return guids[i].name;
538 /* if we didn't find it, act like standard debugstr_guid */
539 return debugstr_guid(id);
542 /* returns name of given error code */
543 const char *debugstr_dmreturn (DWORD code) {
544 static const flag_info codes[] = {
547 FE(DMUS_S_PARTIALLOAD),
548 FE(DMUS_S_PARTIALDOWNLOAD),
552 FE(DMUS_S_STRING_TRUNCATED),
553 FE(DMUS_S_LAST_TOOL),
554 FE(DMUS_S_OVER_CHORD),
555 FE(DMUS_S_UP_OCTAVE),
556 FE(DMUS_S_DOWN_OCTAVE),
557 FE(DMUS_S_NOBUFFERCONTROL),
558 FE(DMUS_S_GARBAGE_COLLECTED),
562 FE(CLASS_E_NOAGGREGATION),
563 FE(CLASS_E_CLASSNOTAVAILABLE),
564 FE(REGDB_E_CLASSNOTREG),
568 FE(DMUS_E_DRIVER_FAILED),
569 FE(DMUS_E_PORTS_OPEN),
570 FE(DMUS_E_DEVICE_IN_USE),
571 FE(DMUS_E_INSUFFICIENTBUFFER),
572 FE(DMUS_E_BUFFERNOTSET),
573 FE(DMUS_E_BUFFERNOTAVAILABLE),
574 FE(DMUS_E_NOTADLSCOL),
575 FE(DMUS_E_INVALIDOFFSET),
576 FE(DMUS_E_ALREADY_LOADED),
577 FE(DMUS_E_INVALIDPOS),
578 FE(DMUS_E_INVALIDPATCH),
579 FE(DMUS_E_CANNOTSEEK),
580 FE(DMUS_E_CANNOTWRITE),
581 FE(DMUS_E_CHUNKNOTFOUND),
582 FE(DMUS_E_INVALID_DOWNLOADID),
583 FE(DMUS_E_NOT_DOWNLOADED_TO_PORT),
584 FE(DMUS_E_ALREADY_DOWNLOADED),
585 FE(DMUS_E_UNKNOWN_PROPERTY),
586 FE(DMUS_E_SET_UNSUPPORTED),
587 FE(DMUS_E_GET_UNSUPPORTED),
589 FE(DMUS_E_BADARTICULATION),
590 FE(DMUS_E_BADINSTRUMENT),
591 FE(DMUS_E_BADWAVELINK),
592 FE(DMUS_E_NOARTICULATION),
595 FE(DMUS_E_BADOFFSETTABLE),
596 FE(DMUS_E_UNKNOWNDOWNLOAD),
597 FE(DMUS_E_NOSYNTHSINK),
598 FE(DMUS_E_ALREADYOPEN),
599 FE(DMUS_E_ALREADYCLOSED),
600 FE(DMUS_E_SYNTHNOTCONFIGURED),
601 FE(DMUS_E_SYNTHACTIVE),
602 FE(DMUS_E_CANNOTREAD),
603 FE(DMUS_E_DMUSIC_RELEASED),
604 FE(DMUS_E_BUFFER_EMPTY),
605 FE(DMUS_E_BUFFER_FULL),
606 FE(DMUS_E_PORT_NOT_CAPTURE),
607 FE(DMUS_E_PORT_NOT_RENDER),
608 FE(DMUS_E_DSOUND_NOT_SET),
609 FE(DMUS_E_ALREADY_ACTIVATED),
610 FE(DMUS_E_INVALIDBUFFER),
611 FE(DMUS_E_WAVEFORMATNOTSUPPORTED),
612 FE(DMUS_E_SYNTHINACTIVE),
613 FE(DMUS_E_DSOUND_ALREADY_SET),
614 FE(DMUS_E_INVALID_EVENT),
615 FE(DMUS_E_UNSUPPORTED_STREAM),
616 FE(DMUS_E_ALREADY_INITED),
617 FE(DMUS_E_INVALID_BAND),
618 FE(DMUS_E_TRACK_HDR_NOT_FIRST_CK),
619 FE(DMUS_E_TOOL_HDR_NOT_FIRST_CK),
620 FE(DMUS_E_INVALID_TRACK_HDR),
621 FE(DMUS_E_INVALID_TOOL_HDR),
622 FE(DMUS_E_ALL_TOOLS_FAILED),
623 FE(DMUS_E_ALL_TRACKS_FAILED),
624 FE(DMUS_E_NOT_FOUND),
626 FE(DMUS_E_TYPE_DISABLED),
627 FE(DMUS_E_TYPE_UNSUPPORTED),
628 FE(DMUS_E_TIME_PAST),
629 FE(DMUS_E_TRACK_NOT_FOUND),
630 FE(DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT),
631 FE(DMUS_E_NO_MASTER_CLOCK),
632 FE(DMUS_E_LOADER_NOCLASSID),
633 FE(DMUS_E_LOADER_BADPATH),
634 FE(DMUS_E_LOADER_FAILEDOPEN),
635 FE(DMUS_E_LOADER_FORMATNOTSUPPORTED),
636 FE(DMUS_E_LOADER_FAILEDCREATE),
637 FE(DMUS_E_LOADER_OBJECTNOTFOUND),
638 FE(DMUS_E_LOADER_NOFILENAME),
639 FE(DMUS_E_INVALIDFILE),
640 FE(DMUS_E_ALREADY_EXISTS),
641 FE(DMUS_E_OUT_OF_RANGE),
642 FE(DMUS_E_SEGMENT_INIT_FAILED),
643 FE(DMUS_E_ALREADY_SENT),
644 FE(DMUS_E_CANNOT_FREE),
645 FE(DMUS_E_CANNOT_OPEN_PORT),
646 FE(DMUS_E_CANNOT_CONVERT),
647 FE(DMUS_E_DESCEND_CHUNK_FAIL),
648 FE(DMUS_E_NOT_LOADED),
649 FE(DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE),
650 FE(DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE),
651 FE(DMUS_E_SCRIPT_ERROR_IN_SCRIPT),
652 FE(DMUS_E_SCRIPT_CANTLOAD_OLEAUT32),
653 FE(DMUS_E_SCRIPT_LOADSCRIPT_ERROR),
654 FE(DMUS_E_SCRIPT_INVALID_FILE),
655 FE(DMUS_E_INVALID_SCRIPTTRACK),
656 FE(DMUS_E_SCRIPT_VARIABLE_NOT_FOUND),
657 FE(DMUS_E_SCRIPT_ROUTINE_NOT_FOUND),
658 FE(DMUS_E_SCRIPT_CONTENT_READONLY),
659 FE(DMUS_E_SCRIPT_NOT_A_REFERENCE),
660 FE(DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED),
661 FE(DMUS_E_INVALID_SEGMENTTRIGGERTRACK),
662 FE(DMUS_E_INVALID_LYRICSTRACK),
663 FE(DMUS_E_INVALID_PARAMCONTROLTRACK),
664 FE(DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR),
665 FE(DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR),
666 FE(DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE),
667 FE(DMUS_E_AUDIOPATHS_NOT_VALID),
668 FE(DMUS_E_AUDIOPATHS_IN_USE),
669 FE(DMUS_E_NO_AUDIOPATH_CONFIG),
670 FE(DMUS_E_AUDIOPATH_INACTIVE),
671 FE(DMUS_E_AUDIOPATH_NOBUFFER),
672 FE(DMUS_E_AUDIOPATH_NOPORT),
673 FE(DMUS_E_NO_AUDIOPATH),
674 FE(DMUS_E_INVALIDCHUNK),
675 FE(DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER),
676 FE(DMUS_E_INVALID_CONTAINER_OBJECT)
680 for (i = 0; i < sizeof(codes)/sizeof(codes[0]); i++) {
681 if (code == codes[i].val)
682 return codes[i].name;
685 /* if we didn't find it, return value */
686 return wine_dbg_sprintf("0x%08X", code);
690 /* dump DMUS_CONTAINER flags */
691 static const char *debugstr_DMUS_CONTAINER_FLAGS (DWORD flagmask) {
692 static const flag_info flags[] = {
693 FE(DMUS_CONTAINER_NOLOADS)
695 return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
698 /* dump DMUS_CONTAINED_OBJF flags */
699 static const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask) {
700 static const flag_info flags[] = {
701 FE(DMUS_CONTAINED_OBJF_KEEP)
703 return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
706 void debug_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
708 TRACE("DMUS_OBJECTDESC (%p):\n", pDesc);
709 TRACE(" - dwSize = %d\n", pDesc->dwSize);
710 TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
711 if (pDesc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(pDesc->wszName));
712 if (pDesc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
713 if (pDesc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
714 if (pDesc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = FIXME\n");
715 if (pDesc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
716 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
717 if (pDesc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
718 if (pDesc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = 0x%s\n - pbMemData = %p\n",
719 wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
720 if (pDesc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", pDesc->pStream);
726 const char *debugstr_DMUS_IO_CONTAINER_HEADER (LPDMUS_IO_CONTAINER_HEADER pHeader) {
728 char buffer[1024] = "", *ptr = &buffer[0];
730 ptr += sprintf(ptr, "DMUS_IO_CONTAINER_HEADER (%p):\n", pHeader);
731 ptr += sprintf(ptr, " - dwFlags = %s\n", debugstr_DMUS_CONTAINER_FLAGS(pHeader->dwFlags));
733 return wine_dbg_sprintf("%s", buffer);
739 const char *debugstr_DMUS_IO_CONTAINED_OBJECT_HEADER (LPDMUS_IO_CONTAINED_OBJECT_HEADER pHeader) {
741 char buffer[1024] = "", *ptr = &buffer[0];
743 ptr += sprintf(ptr, "DMUS_IO_CONTAINED_OBJECT_HEADER (%p):\n", pHeader);
744 ptr += sprintf(ptr, " - guidClassID = %s\n", debugstr_dmguid(&pHeader->guidClassID));
745 ptr += sprintf(ptr, " - dwFlags = %s\n", debugstr_DMUS_CONTAINED_OBJF_FLAGS (pHeader->dwFlags));
746 ptr += sprintf(ptr, " - ckid = %s\n", debugstr_fourcc (pHeader->ckid));
747 ptr += sprintf(ptr, " - fccType = %s\n", debugstr_fourcc (pHeader->fccType));
749 return wine_dbg_sprintf("%s", buffer);