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 HRESULT
IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_CHUNK
* pChunk
, IStream
* pStm
, LPDMUS_OBJECTDESC pDesc
) {
62 switch (pChunk
->fccID
) {
63 case DMUS_FOURCC_GUID_CHUNK
: {
64 TRACE_(dmfile
)(": GUID chunk\n");
65 pDesc
->dwValidData
|= DMUS_OBJ_OBJECT
;
66 IStream_Read (pStm
, &pDesc
->guidObject
, pChunk
->dwSize
, NULL
);
69 case DMUS_FOURCC_DATE_CHUNK
: {
70 TRACE_(dmfile
)(": file date chunk\n");
71 pDesc
->dwValidData
|= DMUS_OBJ_DATE
;
72 IStream_Read (pStm
, &pDesc
->ftDate
, pChunk
->dwSize
, NULL
);
75 case DMUS_FOURCC_NAME_CHUNK
: {
76 TRACE_(dmfile
)(": name chunk\n");
77 pDesc
->dwValidData
|= DMUS_OBJ_NAME
;
78 IStream_Read (pStm
, pDesc
->wszName
, pChunk
->dwSize
, NULL
);
81 case DMUS_FOURCC_FILE_CHUNK
: {
82 TRACE_(dmfile
)(": file name chunk\n");
83 pDesc
->dwValidData
|= DMUS_OBJ_FILENAME
;
84 IStream_Read (pStm
, pDesc
->wszFileName
, pChunk
->dwSize
, NULL
);
87 case DMUS_FOURCC_VERSION_CHUNK
: {
88 TRACE_(dmfile
)(": version chunk\n");
89 pDesc
->dwValidData
|= DMUS_OBJ_VERSION
;
90 IStream_Read (pStm
, &pDesc
->vVersion
, pChunk
->dwSize
, NULL
);
93 case DMUS_FOURCC_CATEGORY_CHUNK
: {
94 TRACE_(dmfile
)(": category chunk\n");
95 pDesc
->dwValidData
|= DMUS_OBJ_CATEGORY
;
96 IStream_Read (pStm
, pDesc
->wszCategory
, pChunk
->dwSize
, NULL
);
107 HRESULT
IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK
* pChunk
, IStream
* pStm
, LPDMUS_OBJECTDESC pDesc
) {
109 LARGE_INTEGER liMove
; /* used when skipping chunks */
112 * don't ask me why, but M$ puts INFO elements in UNFO list sometimes
113 * (though strings seem to be valid unicode)
115 switch (pChunk
->fccID
) {
117 case mmioFOURCC('I','N','A','M'):
118 case DMUS_FOURCC_UNAM_CHUNK
: {
119 TRACE_(dmfile
)(": name chunk\n");
120 pDesc
->dwValidData
|= DMUS_OBJ_NAME
;
121 IStream_Read (pStm
, pDesc
->wszName
, pChunk
->dwSize
, NULL
);
122 TRACE_(dmfile
)(" - wszName: %s\n", debugstr_w(pDesc
->wszName
));
126 case mmioFOURCC('I','A','R','T'):
127 case DMUS_FOURCC_UART_CHUNK
: {
128 TRACE_(dmfile
)(": artist chunk (ignored)\n");
129 liMove
.QuadPart
= pChunk
->dwSize
;
130 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
133 case mmioFOURCC('I','C','O','P'):
134 case DMUS_FOURCC_UCOP_CHUNK
: {
135 TRACE_(dmfile
)(": copyright chunk (ignored)\n");
136 liMove
.QuadPart
= pChunk
->dwSize
;
137 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
140 case mmioFOURCC('I','S','B','J'):
141 case DMUS_FOURCC_USBJ_CHUNK
: {
142 TRACE_(dmfile
)(": subject chunk (ignored)\n");
143 liMove
.QuadPart
= pChunk
->dwSize
;
144 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
147 case mmioFOURCC('I','C','M','T'):
148 case DMUS_FOURCC_UCMT_CHUNK
: {
149 TRACE_(dmfile
)(": comment chunk (ignored)\n");
150 liMove
.QuadPart
= pChunk
->dwSize
;
151 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
162 HRESULT
IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface
, DMUS_PRIVATE_CHUNK
* pChunk
, IStream
* pStm
, IDirectMusicObject
** ppObject
) {
163 DMUS_PRIVATE_CHUNK Chunk
;
164 DWORD ListSize
[3], ListCount
[3];
165 LARGE_INTEGER liMove
; /* used when skipping chunks */
168 DMUS_IO_REFERENCE ref
;
169 DMUS_OBJECTDESC ref_desc
;
171 memset(&ref
, 0, sizeof(ref
));
172 memset(&ref_desc
, 0, sizeof(ref_desc
));
174 if (pChunk
->fccID
!= DMUS_FOURCC_REF_LIST
) {
175 ERR_(dmfile
)(": %s chunk should be a REF list\n", debugstr_fourcc (pChunk
->fccID
));
179 ListSize
[0] = pChunk
->dwSize
- sizeof(FOURCC
);
183 IStream_Read (pStm
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
184 ListCount
[0] += sizeof(FOURCC
) + sizeof(DWORD
) + Chunk
.dwSize
;
185 TRACE_(dmfile
)(": %s chunk (size = %d)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
187 hr
= IDirectMusicUtils_IPersistStream_ParseDescGeneric(&Chunk
, pStm
, &ref_desc
);
188 if (FAILED(hr
)) return hr
;
191 switch (Chunk
.fccID
) {
192 case DMUS_FOURCC_REF_CHUNK
: {
193 TRACE_(dmfile
)(": Reference chunk\n");
194 if (Chunk
.dwSize
!= sizeof(DMUS_IO_REFERENCE
)) return E_FAIL
;
195 IStream_Read (pStm
, &ref
, sizeof(DMUS_IO_REFERENCE
), NULL
);
196 TRACE_(dmfile
)(" - guidClassID: %s\n", debugstr_dmguid(&ref
.guidClassID
));
197 TRACE_(dmfile
)(" - dwValidData: %u\n", ref
.dwValidData
);
201 TRACE_(dmfile
)(": unknown chunk (irrevelant & skipping)\n");
202 liMove
.QuadPart
= Chunk
.dwSize
;
203 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
208 TRACE_(dmfile
)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount
[0], ListSize
[0]);
209 } while (ListCount
[0] < ListSize
[0]);
211 ref_desc
.dwValidData
|= DMUS_OBJ_CLASS
;
212 ref_desc
.guidClass
= ref
.guidClassID
;
214 TRACE_(dmfile
)("** DM Reference Begin of Load ***\n");
215 TRACE_(dmfile
)("With Desc:\n");
216 debugstr_DMUS_OBJECTDESC(&ref_desc
);
219 LPDIRECTMUSICGETLOADER pGetLoader
= NULL
;
220 LPDIRECTMUSICLOADER pLoader
= NULL
;
222 IStream_QueryInterface (pStm
, &IID_IDirectMusicGetLoader
, (LPVOID
*)&pGetLoader
);
223 IDirectMusicGetLoader_GetLoader (pGetLoader
, &pLoader
);
224 IDirectMusicGetLoader_Release (pGetLoader
);
226 hr
= IDirectMusicLoader_GetObject (pLoader
, &ref_desc
, &IID_IDirectMusicObject
, (LPVOID
*)ppObject
);
227 IDirectMusicLoader_Release (pLoader
); /* release loader */
229 TRACE_(dmfile
)("** DM Reference End of Load ***\n");
234 /* translate STREAM_SEEK flag to string */
235 const char *resolve_STREAM_SEEK (DWORD flag
) {
237 case STREAM_SEEK_SET
:
238 return wine_dbg_sprintf ("STREAM_SEEK_SET");
239 case STREAM_SEEK_CUR
:
240 return wine_dbg_sprintf ("STREAM_SEEK_CUR");
241 case STREAM_SEEK_END
:
242 return wine_dbg_sprintf ("STREAM_SEEK_END");
244 return wine_dbg_sprintf ("()");
248 /* FOURCC to string conversion for debug messages */
249 const char *debugstr_fourcc (DWORD fourcc
) {
250 if (!fourcc
) return "'null'";
251 return wine_dbg_sprintf ("\'%c%c%c%c\'",
252 (char)(fourcc
), (char)(fourcc
>> 8),
253 (char)(fourcc
>> 16), (char)(fourcc
>> 24));
256 /* DMUS_VERSION struct to string conversion for debug messages */
257 static const char *debugstr_dmversion (const DMUS_VERSION
*version
) {
258 if (!version
) return "'null'";
259 return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
260 HIWORD(version
->dwVersionMS
),LOWORD(version
->dwVersionMS
),
261 HIWORD(version
->dwVersionLS
), LOWORD(version
->dwVersionLS
));
264 /* month number into month name (for debugstr_filetime) */
265 static const char *debugstr_month (DWORD dwMonth
) {
267 case 1: return "January";
268 case 2: return "February";
269 case 3: return "March";
270 case 4: return "April";
271 case 5: return "May";
272 case 6: return "June";
273 case 7: return "July";
274 case 8: return "August";
275 case 9: return "September";
276 case 10: return "October";
277 case 11: return "November";
278 case 12: return "December";
279 default: return "Invalid";
283 /* FILETIME struct to string conversion for debug messages */
284 static const char *debugstr_filetime (const FILETIME
*time
) {
287 if (!time
) return "'null'";
289 FileTimeToSystemTime (time
, &sysTime
);
291 return wine_dbg_sprintf ("\'%02i. %s %04i %02i:%02i:%02i\'",
292 sysTime
.wDay
, debugstr_month(sysTime
.wMonth
), sysTime
.wYear
,
293 sysTime
.wHour
, sysTime
.wMinute
, sysTime
.wSecond
);
296 /* returns name of given GUID */
297 const char *debugstr_dmguid (const GUID
*id
) {
298 static const guid_info guids
[] = {
300 GE(CLSID_AudioVBScript
),
301 GE(CLSID_DirectMusic
),
302 GE(CLSID_DirectMusicAudioPath
),
303 GE(CLSID_DirectMusicAudioPathConfig
),
304 GE(CLSID_DirectMusicAuditionTrack
),
305 GE(CLSID_DirectMusicBand
),
306 GE(CLSID_DirectMusicBandTrack
),
307 GE(CLSID_DirectMusicChordMapTrack
),
308 GE(CLSID_DirectMusicChordMap
),
309 GE(CLSID_DirectMusicChordTrack
),
310 GE(CLSID_DirectMusicCollection
),
311 GE(CLSID_DirectMusicCommandTrack
),
312 GE(CLSID_DirectMusicComposer
),
313 GE(CLSID_DirectMusicContainer
),
314 GE(CLSID_DirectMusicGraph
),
315 GE(CLSID_DirectMusicLoader
),
316 GE(CLSID_DirectMusicLyricsTrack
),
317 GE(CLSID_DirectMusicMarkerTrack
),
318 GE(CLSID_DirectMusicMelodyFormulationTrack
),
319 GE(CLSID_DirectMusicMotifTrack
),
320 GE(CLSID_DirectMusicMuteTrack
),
321 GE(CLSID_DirectMusicParamControlTrack
),
322 GE(CLSID_DirectMusicPatternTrack
),
323 GE(CLSID_DirectMusicPerformance
),
324 GE(CLSID_DirectMusicScript
),
325 GE(CLSID_DirectMusicScriptAutoImpSegment
),
326 GE(CLSID_DirectMusicScriptAutoImpPerformance
),
327 GE(CLSID_DirectMusicScriptAutoImpSegmentState
),
328 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig
),
329 GE(CLSID_DirectMusicScriptAutoImpAudioPath
),
330 GE(CLSID_DirectMusicScriptAutoImpSong
),
331 GE(CLSID_DirectMusicScriptSourceCodeLoader
),
332 GE(CLSID_DirectMusicScriptTrack
),
333 GE(CLSID_DirectMusicSection
),
334 GE(CLSID_DirectMusicSegment
),
335 GE(CLSID_DirectMusicSegmentState
),
336 GE(CLSID_DirectMusicSegmentTriggerTrack
),
337 GE(CLSID_DirectMusicSegTriggerTrack
),
338 GE(CLSID_DirectMusicSeqTrack
),
339 GE(CLSID_DirectMusicSignPostTrack
),
340 GE(CLSID_DirectMusicSong
),
341 GE(CLSID_DirectMusicStyle
),
342 GE(CLSID_DirectMusicStyleTrack
),
343 GE(CLSID_DirectMusicSynth
),
344 GE(CLSID_DirectMusicSynthSink
),
345 GE(CLSID_DirectMusicSysExTrack
),
346 GE(CLSID_DirectMusicTemplate
),
347 GE(CLSID_DirectMusicTempoTrack
),
348 GE(CLSID_DirectMusicTimeSigTrack
),
349 GE(CLSID_DirectMusicWaveTrack
),
350 GE(CLSID_DirectSoundWave
),
352 GE(IID_IDirectMusic
),
353 GE(IID_IDirectMusic2
),
354 GE(IID_IDirectMusic8
),
355 GE(IID_IDirectMusicAudioPath
),
356 GE(IID_IDirectMusicBand
),
357 GE(IID_IDirectMusicBuffer
),
358 GE(IID_IDirectMusicChordMap
),
359 GE(IID_IDirectMusicCollection
),
360 GE(IID_IDirectMusicComposer
),
361 GE(IID_IDirectMusicContainer
),
362 GE(IID_IDirectMusicDownload
),
363 GE(IID_IDirectMusicDownloadedInstrument
),
364 GE(IID_IDirectMusicGetLoader
),
365 GE(IID_IDirectMusicGraph
),
366 GE(IID_IDirectMusicInstrument
),
367 GE(IID_IDirectMusicLoader
),
368 GE(IID_IDirectMusicLoader8
),
369 GE(IID_IDirectMusicObject
),
370 GE(IID_IDirectMusicPatternTrack
),
371 GE(IID_IDirectMusicPerformance
),
372 GE(IID_IDirectMusicPerformance2
),
373 GE(IID_IDirectMusicPerformance8
),
374 GE(IID_IDirectMusicPort
),
375 GE(IID_IDirectMusicPortDownload
),
376 GE(IID_IDirectMusicScript
),
377 GE(IID_IDirectMusicSegment
),
378 GE(IID_IDirectMusicSegment2
),
379 GE(IID_IDirectMusicSegment8
),
380 GE(IID_IDirectMusicSegmentState
),
381 GE(IID_IDirectMusicSegmentState8
),
382 GE(IID_IDirectMusicStyle
),
383 GE(IID_IDirectMusicStyle8
),
384 GE(IID_IDirectMusicSynth
),
385 GE(IID_IDirectMusicSynth8
),
386 GE(IID_IDirectMusicSynthSink
),
387 GE(IID_IDirectMusicThru
),
388 GE(IID_IDirectMusicTool
),
389 GE(IID_IDirectMusicTool8
),
390 GE(IID_IDirectMusicTrack
),
391 GE(IID_IDirectMusicTrack8
),
393 GE(IID_IPersistStream
),
395 GE(IID_IClassFactory
),
397 GE(GUID_DirectMusicAllTypes
),
398 GE(GUID_NOTIFICATION_CHORD
),
399 GE(GUID_NOTIFICATION_COMMAND
),
400 GE(GUID_NOTIFICATION_MEASUREANDBEAT
),
401 GE(GUID_NOTIFICATION_PERFORMANCE
),
402 GE(GUID_NOTIFICATION_RECOMPOSE
),
403 GE(GUID_NOTIFICATION_SEGMENT
),
406 GE(GUID_CommandParam
),
407 GE(GUID_CommandParam2
),
408 GE(GUID_CommandParamNext
),
409 GE(GUID_IDirectMusicBand
),
410 GE(GUID_IDirectMusicChordMap
),
411 GE(GUID_IDirectMusicStyle
),
413 GE(GUID_Play_Marker
),
414 GE(GUID_RhythmParam
),
416 GE(GUID_TimeSignature
),
417 GE(GUID_Valid_Start_Time
),
418 GE(GUID_Clear_All_Bands
),
419 GE(GUID_ConnectToDLSCollection
),
420 GE(GUID_Disable_Auto_Download
),
421 GE(GUID_DisableTempo
),
422 GE(GUID_DisableTimeSig
),
424 GE(GUID_DownloadToAudioPath
),
425 GE(GUID_Enable_Auto_Download
),
426 GE(GUID_EnableTempo
),
427 GE(GUID_EnableTimeSig
),
428 GE(GUID_IgnoreBankSelectForGM
),
429 GE(GUID_SeedVariations
),
430 GE(GUID_StandardMIDIFile
),
432 GE(GUID_UnloadFromAudioPath
),
434 GE(GUID_PerfMasterTempo
),
435 GE(GUID_PerfMasterVolume
),
436 GE(GUID_PerfMasterGrooveLevel
),
437 GE(GUID_PerfAutoDownload
),
438 GE(GUID_DefaultGMCollection
),
439 GE(GUID_Synth_Default
),
440 GE(GUID_Buffer_Reverb
),
441 GE(GUID_Buffer_EnvReverb
),
442 GE(GUID_Buffer_Stereo
),
443 GE(GUID_Buffer_3D_Dry
),
444 GE(GUID_Buffer_Mono
),
445 GE(GUID_DMUS_PROP_GM_Hardware
),
446 GE(GUID_DMUS_PROP_GS_Capable
),
447 GE(GUID_DMUS_PROP_GS_Hardware
),
448 GE(GUID_DMUS_PROP_DLS1
),
449 GE(GUID_DMUS_PROP_DLS2
),
450 GE(GUID_DMUS_PROP_Effects
),
451 GE(GUID_DMUS_PROP_INSTRUMENT2
),
452 GE(GUID_DMUS_PROP_LegacyCaps
),
453 GE(GUID_DMUS_PROP_MemorySize
),
454 GE(GUID_DMUS_PROP_SampleMemorySize
),
455 GE(GUID_DMUS_PROP_SamplePlaybackRate
),
456 GE(GUID_DMUS_PROP_SetSynthSink
),
457 GE(GUID_DMUS_PROP_SinkUsesDSound
),
458 GE(GUID_DMUS_PROP_SynthSink_DSOUND
),
459 GE(GUID_DMUS_PROP_SynthSink_WAVE
),
460 GE(GUID_DMUS_PROP_Volume
),
461 GE(GUID_DMUS_PROP_WavesReverb
),
462 GE(GUID_DMUS_PROP_WriteLatency
),
463 GE(GUID_DMUS_PROP_WritePeriod
),
464 GE(GUID_DMUS_PROP_XG_Capable
),
465 GE(GUID_DMUS_PROP_XG_Hardware
)
470 if (!id
) return "(null)";
471 for (i
= 0; i
< sizeof(guids
)/sizeof(guids
[0]); i
++) {
472 if (IsEqualGUID(id
, guids
[i
].guid
))
473 return guids
[i
].name
;
476 /* if we didn't find it, act like standard debugstr_guid */
477 return debugstr_guid(id
);
480 /* returns name of given error code */
481 const char *debugstr_dmreturn (DWORD code
) {
482 static const flag_info codes
[] = {
485 FE(DMUS_S_PARTIALLOAD
),
486 FE(DMUS_S_PARTIALDOWNLOAD
),
490 FE(DMUS_S_STRING_TRUNCATED
),
491 FE(DMUS_S_LAST_TOOL
),
492 FE(DMUS_S_OVER_CHORD
),
493 FE(DMUS_S_UP_OCTAVE
),
494 FE(DMUS_S_DOWN_OCTAVE
),
495 FE(DMUS_S_NOBUFFERCONTROL
),
496 FE(DMUS_S_GARBAGE_COLLECTED
),
500 FE(CLASS_E_NOAGGREGATION
),
501 FE(CLASS_E_CLASSNOTAVAILABLE
),
502 FE(REGDB_E_CLASSNOTREG
),
506 FE(DMUS_E_DRIVER_FAILED
),
507 FE(DMUS_E_PORTS_OPEN
),
508 FE(DMUS_E_DEVICE_IN_USE
),
509 FE(DMUS_E_INSUFFICIENTBUFFER
),
510 FE(DMUS_E_BUFFERNOTSET
),
511 FE(DMUS_E_BUFFERNOTAVAILABLE
),
512 FE(DMUS_E_NOTADLSCOL
),
513 FE(DMUS_E_INVALIDOFFSET
),
514 FE(DMUS_E_ALREADY_LOADED
),
515 FE(DMUS_E_INVALIDPOS
),
516 FE(DMUS_E_INVALIDPATCH
),
517 FE(DMUS_E_CANNOTSEEK
),
518 FE(DMUS_E_CANNOTWRITE
),
519 FE(DMUS_E_CHUNKNOTFOUND
),
520 FE(DMUS_E_INVALID_DOWNLOADID
),
521 FE(DMUS_E_NOT_DOWNLOADED_TO_PORT
),
522 FE(DMUS_E_ALREADY_DOWNLOADED
),
523 FE(DMUS_E_UNKNOWN_PROPERTY
),
524 FE(DMUS_E_SET_UNSUPPORTED
),
525 FE(DMUS_E_GET_UNSUPPORTED
),
527 FE(DMUS_E_BADARTICULATION
),
528 FE(DMUS_E_BADINSTRUMENT
),
529 FE(DMUS_E_BADWAVELINK
),
530 FE(DMUS_E_NOARTICULATION
),
533 FE(DMUS_E_BADOFFSETTABLE
),
534 FE(DMUS_E_UNKNOWNDOWNLOAD
),
535 FE(DMUS_E_NOSYNTHSINK
),
536 FE(DMUS_E_ALREADYOPEN
),
537 FE(DMUS_E_ALREADYCLOSED
),
538 FE(DMUS_E_SYNTHNOTCONFIGURED
),
539 FE(DMUS_E_SYNTHACTIVE
),
540 FE(DMUS_E_CANNOTREAD
),
541 FE(DMUS_E_DMUSIC_RELEASED
),
542 FE(DMUS_E_BUFFER_EMPTY
),
543 FE(DMUS_E_BUFFER_FULL
),
544 FE(DMUS_E_PORT_NOT_CAPTURE
),
545 FE(DMUS_E_PORT_NOT_RENDER
),
546 FE(DMUS_E_DSOUND_NOT_SET
),
547 FE(DMUS_E_ALREADY_ACTIVATED
),
548 FE(DMUS_E_INVALIDBUFFER
),
549 FE(DMUS_E_WAVEFORMATNOTSUPPORTED
),
550 FE(DMUS_E_SYNTHINACTIVE
),
551 FE(DMUS_E_DSOUND_ALREADY_SET
),
552 FE(DMUS_E_INVALID_EVENT
),
553 FE(DMUS_E_UNSUPPORTED_STREAM
),
554 FE(DMUS_E_ALREADY_INITED
),
555 FE(DMUS_E_INVALID_BAND
),
556 FE(DMUS_E_TRACK_HDR_NOT_FIRST_CK
),
557 FE(DMUS_E_TOOL_HDR_NOT_FIRST_CK
),
558 FE(DMUS_E_INVALID_TRACK_HDR
),
559 FE(DMUS_E_INVALID_TOOL_HDR
),
560 FE(DMUS_E_ALL_TOOLS_FAILED
),
561 FE(DMUS_E_ALL_TRACKS_FAILED
),
562 FE(DMUS_E_NOT_FOUND
),
564 FE(DMUS_E_TYPE_DISABLED
),
565 FE(DMUS_E_TYPE_UNSUPPORTED
),
566 FE(DMUS_E_TIME_PAST
),
567 FE(DMUS_E_TRACK_NOT_FOUND
),
568 FE(DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT
),
569 FE(DMUS_E_NO_MASTER_CLOCK
),
570 FE(DMUS_E_LOADER_NOCLASSID
),
571 FE(DMUS_E_LOADER_BADPATH
),
572 FE(DMUS_E_LOADER_FAILEDOPEN
),
573 FE(DMUS_E_LOADER_FORMATNOTSUPPORTED
),
574 FE(DMUS_E_LOADER_FAILEDCREATE
),
575 FE(DMUS_E_LOADER_OBJECTNOTFOUND
),
576 FE(DMUS_E_LOADER_NOFILENAME
),
577 FE(DMUS_E_INVALIDFILE
),
578 FE(DMUS_E_ALREADY_EXISTS
),
579 FE(DMUS_E_OUT_OF_RANGE
),
580 FE(DMUS_E_SEGMENT_INIT_FAILED
),
581 FE(DMUS_E_ALREADY_SENT
),
582 FE(DMUS_E_CANNOT_FREE
),
583 FE(DMUS_E_CANNOT_OPEN_PORT
),
584 FE(DMUS_E_CANNOT_CONVERT
),
585 FE(DMUS_E_DESCEND_CHUNK_FAIL
),
586 FE(DMUS_E_NOT_LOADED
),
587 FE(DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE
),
588 FE(DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE
),
589 FE(DMUS_E_SCRIPT_ERROR_IN_SCRIPT
),
590 FE(DMUS_E_SCRIPT_CANTLOAD_OLEAUT32
),
591 FE(DMUS_E_SCRIPT_LOADSCRIPT_ERROR
),
592 FE(DMUS_E_SCRIPT_INVALID_FILE
),
593 FE(DMUS_E_INVALID_SCRIPTTRACK
),
594 FE(DMUS_E_SCRIPT_VARIABLE_NOT_FOUND
),
595 FE(DMUS_E_SCRIPT_ROUTINE_NOT_FOUND
),
596 FE(DMUS_E_SCRIPT_CONTENT_READONLY
),
597 FE(DMUS_E_SCRIPT_NOT_A_REFERENCE
),
598 FE(DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED
),
599 FE(DMUS_E_INVALID_SEGMENTTRIGGERTRACK
),
600 FE(DMUS_E_INVALID_LYRICSTRACK
),
601 FE(DMUS_E_INVALID_PARAMCONTROLTRACK
),
602 FE(DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR
),
603 FE(DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR
),
604 FE(DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE
),
605 FE(DMUS_E_AUDIOPATHS_NOT_VALID
),
606 FE(DMUS_E_AUDIOPATHS_IN_USE
),
607 FE(DMUS_E_NO_AUDIOPATH_CONFIG
),
608 FE(DMUS_E_AUDIOPATH_INACTIVE
),
609 FE(DMUS_E_AUDIOPATH_NOBUFFER
),
610 FE(DMUS_E_AUDIOPATH_NOPORT
),
611 FE(DMUS_E_NO_AUDIOPATH
),
612 FE(DMUS_E_INVALIDCHUNK
),
613 FE(DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER
),
614 FE(DMUS_E_INVALID_CONTAINER_OBJECT
)
618 for (i
= 0; i
< sizeof(codes
)/sizeof(codes
[0]); i
++) {
619 if (code
== codes
[i
].val
)
620 return codes
[i
].name
;
623 /* if we didn't find it, return value */
624 return wine_dbg_sprintf("0x%08X", code
);
628 /* generic flag-dumping function */
629 const char* debugstr_flags (DWORD flags
, const flag_info
* names
, size_t num_names
){
630 static char buffer
[128] = "", *ptr
= &buffer
[0];
631 unsigned int i
, size
= sizeof(buffer
);
633 for (i
=0; i
< num_names
; i
++) {
634 if ((flags
& names
[i
].val
)) {
635 int cnt
= snprintf(ptr
, size
, "%s ", names
[i
].name
);
636 if (cnt
< 0 || cnt
>= size
) break;
646 /* dump DMUS_OBJ flags */
647 static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask
) {
648 static const flag_info flags
[] = {
652 FE(DMUS_OBJ_CATEGORY
),
653 FE(DMUS_OBJ_FILENAME
),
654 FE(DMUS_OBJ_FULLPATH
),
656 FE(DMUS_OBJ_VERSION
),
662 return debugstr_flags (flagmask
, flags
, sizeof(flags
)/sizeof(flags
[0]));
665 /* dump DMUS_CONTAINER flags */
666 static const char *debugstr_DMUS_CONTAINER_FLAGS (DWORD flagmask
) {
667 static const flag_info flags
[] = {
668 FE(DMUS_CONTAINER_NOLOADS
)
670 return debugstr_flags (flagmask
, flags
, sizeof(flags
)/sizeof(flags
[0]));
673 /* dump DMUS_CONTAINED_OBJF flags */
674 static const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask
) {
675 static const flag_info flags
[] = {
676 FE(DMUS_CONTAINED_OBJF_KEEP
)
678 return debugstr_flags (flagmask
, flags
, sizeof(flags
)/sizeof(flags
[0]));
681 const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc
) {
683 char buffer
[1024], *ptr
= buffer
;
685 ptr
+= sprintf(ptr
, "DMUS_OBJECTDESC (%p):\n", pDesc
);
686 ptr
+= sprintf(ptr
, " - dwSize = 0x%08X\n", pDesc
->dwSize
);
687 ptr
+= sprintf(ptr
, " - dwValidData = 0x%08X ( %s)\n", pDesc
->dwValidData
, debugstr_DMUS_OBJ_FLAGS (pDesc
->dwValidData
));
688 if (pDesc
->dwValidData
& DMUS_OBJ_CLASS
) ptr
+= sprintf(ptr
, " - guidClass = %s\n", debugstr_dmguid(&pDesc
->guidClass
));
689 if (pDesc
->dwValidData
& DMUS_OBJ_OBJECT
) ptr
+= sprintf(ptr
, " - guidObject = %s\n", debugstr_guid(&pDesc
->guidObject
));
690 if (pDesc
->dwValidData
& DMUS_OBJ_DATE
) ptr
+= sprintf(ptr
, " - ftDate = %s\n", debugstr_filetime (&pDesc
->ftDate
));
691 if (pDesc
->dwValidData
& DMUS_OBJ_VERSION
) ptr
+= sprintf(ptr
, " - vVersion = %s\n", debugstr_dmversion(&pDesc
->vVersion
));
692 if (pDesc
->dwValidData
& DMUS_OBJ_NAME
) ptr
+= sprintf(ptr
, " - wszName = %s\n", debugstr_w(pDesc
->wszName
));
693 if (pDesc
->dwValidData
& DMUS_OBJ_CATEGORY
) ptr
+= sprintf(ptr
, " - wszCategory = %s\n", debugstr_w(pDesc
->wszCategory
));
694 if (pDesc
->dwValidData
& DMUS_OBJ_FILENAME
) ptr
+= sprintf(ptr
, " - wszFileName = %s\n", debugstr_w(pDesc
->wszFileName
));
695 if (pDesc
->dwValidData
& DMUS_OBJ_MEMORY
) ptr
+= sprintf(ptr
, " - llMemLength = 0x%s\n - pbMemData = %p\n",
696 wine_dbgstr_longlong(pDesc
->llMemLength
), pDesc
->pbMemData
);
697 if (pDesc
->dwValidData
& DMUS_OBJ_STREAM
) ptr
+= sprintf(ptr
, " - pStream = %p\n", pDesc
->pStream
);
699 return wine_dbg_sprintf("%s", buffer
);
701 return wine_dbg_sprintf("(NULL)");
705 void debug_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc
) {
707 TRACE("DMUS_OBJECTDESC (%p):\n", pDesc
);
708 TRACE(" - dwSize = %d\n", pDesc
->dwSize
);
709 TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc
->dwValidData
));
710 if (pDesc
->dwValidData
& DMUS_OBJ_NAME
) TRACE(" - wszName = %s\n", debugstr_w(pDesc
->wszName
));
711 if (pDesc
->dwValidData
& DMUS_OBJ_CLASS
) TRACE(" - guidClass = %s\n", debugstr_dmguid(&pDesc
->guidClass
));
712 if (pDesc
->dwValidData
& DMUS_OBJ_OBJECT
) TRACE(" - guidObject = %s\n", debugstr_guid(&pDesc
->guidObject
));
713 if (pDesc
->dwValidData
& DMUS_OBJ_DATE
) TRACE(" - ftDate = FIXME\n");
714 if (pDesc
->dwValidData
& DMUS_OBJ_VERSION
) TRACE(" - vVersion = %s\n", debugstr_dmversion(&pDesc
->vVersion
));
715 if (pDesc
->dwValidData
& DMUS_OBJ_CATEGORY
) TRACE(" - wszCategory = %s\n", debugstr_w(pDesc
->wszCategory
));
716 if (pDesc
->dwValidData
& DMUS_OBJ_FILENAME
) TRACE(" - wszFileName = %s\n", debugstr_w(pDesc
->wszFileName
));
717 if (pDesc
->dwValidData
& DMUS_OBJ_MEMORY
) TRACE(" - llMemLength = 0x%s\n - pbMemData = %p\n",
718 wine_dbgstr_longlong(pDesc
->llMemLength
), pDesc
->pbMemData
);
719 if (pDesc
->dwValidData
& DMUS_OBJ_STREAM
) TRACE(" - pStream = %p\n", pDesc
->pStream
);
725 const char *debugstr_DMUS_IO_CONTAINER_HEADER (LPDMUS_IO_CONTAINER_HEADER pHeader
) {
727 char buffer
[1024], *ptr
= buffer
;
729 ptr
+= sprintf(ptr
, "DMUS_IO_CONTAINER_HEADER (%p):\n", pHeader
);
730 ptr
+= sprintf(ptr
, " - dwFlags = %s\n", debugstr_DMUS_CONTAINER_FLAGS(pHeader
->dwFlags
));
732 return wine_dbg_sprintf("%s", buffer
);
734 return wine_dbg_sprintf("(NULL)");
738 const char *debugstr_DMUS_IO_CONTAINED_OBJECT_HEADER (LPDMUS_IO_CONTAINED_OBJECT_HEADER pHeader
) {
740 char buffer
[1024], *ptr
= buffer
;
742 ptr
+= sprintf(ptr
, "DMUS_IO_CONTAINED_OBJECT_HEADER (%p):\n", pHeader
);
743 ptr
+= sprintf(ptr
, " - guidClassID = %s\n", debugstr_dmguid(&pHeader
->guidClassID
));
744 ptr
+= sprintf(ptr
, " - dwFlags = %s\n", debugstr_DMUS_CONTAINED_OBJF_FLAGS (pHeader
->dwFlags
));
745 ptr
+= sprintf(ptr
, " - ckid = %s\n", debugstr_fourcc (pHeader
->ckid
));
746 ptr
+= sprintf(ptr
, " - fccType = %s\n", debugstr_fourcc (pHeader
->fccType
));
748 return wine_dbg_sprintf("%s", buffer
);
750 return wine_dbg_sprintf("(NULL)");