3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "dmusic_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
26 LONG DMUSIC_refCount
= 0;
29 const IClassFactoryVtbl
*lpVtbl
;
32 /******************************************************************
33 * DirectMusic ClassFactory
35 static HRESULT WINAPI
DirectMusicCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
36 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid
));
38 if (ppobj
== NULL
) return E_POINTER
;
43 static ULONG WINAPI
DirectMusicCF_AddRef(LPCLASSFACTORY iface
) {
46 return 2; /* non-heap based object */
49 static ULONG WINAPI
DirectMusicCF_Release(LPCLASSFACTORY iface
) {
50 DMUSIC_UnlockModule();
52 return 1; /* non-heap based object */
55 static HRESULT WINAPI
DirectMusicCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
56 TRACE ("(%p, %s, %p)\n", pOuter
, debugstr_dmguid(riid
), ppobj
);
57 return DMUSIC_CreateDirectMusicImpl (riid
, (LPVOID
*) ppobj
, pOuter
);
60 static HRESULT WINAPI
DirectMusicCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
61 TRACE("(%d)\n", dolock
);
66 DMUSIC_UnlockModule();
71 static const IClassFactoryVtbl DirectMusicCF_Vtbl
= {
72 DirectMusicCF_QueryInterface
,
74 DirectMusicCF_Release
,
75 DirectMusicCF_CreateInstance
,
76 DirectMusicCF_LockServer
79 static IClassFactoryImpl DirectMusic_CF
= {&DirectMusicCF_Vtbl
};
81 /******************************************************************
82 * DirectMusicCollection ClassFactory
84 static HRESULT WINAPI
CollectionCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
85 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid
));
87 if (ppobj
== NULL
) return E_POINTER
;
92 static ULONG WINAPI
CollectionCF_AddRef(LPCLASSFACTORY iface
) {
95 return 2; /* non-heap based object */
98 static ULONG WINAPI
CollectionCF_Release(LPCLASSFACTORY iface
) {
99 DMUSIC_UnlockModule();
101 return 1; /* non-heap based object */
104 static HRESULT WINAPI
CollectionCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
105 TRACE ("(%p, %s, %p)\n", pOuter
, debugstr_dmguid(riid
), ppobj
);
106 return DMUSIC_CreateDirectMusicCollectionImpl (riid
, ppobj
, pOuter
);
109 static HRESULT WINAPI
CollectionCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
110 TRACE("(%d)\n", dolock
);
115 DMUSIC_UnlockModule();
120 static const IClassFactoryVtbl CollectionCF_Vtbl
= {
121 CollectionCF_QueryInterface
,
123 CollectionCF_Release
,
124 CollectionCF_CreateInstance
,
125 CollectionCF_LockServer
128 static IClassFactoryImpl Collection_CF
= {&CollectionCF_Vtbl
};
130 /******************************************************************
135 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
) {
136 if (fdwReason
== DLL_PROCESS_ATTACH
) {
137 DisableThreadLibraryCalls(hinstDLL
);
138 /* FIXME: Initialisation */
139 } else if (fdwReason
== DLL_PROCESS_DETACH
) {
147 /******************************************************************
148 * DllCanUnloadNow (DMUSIC.@)
152 HRESULT WINAPI
DllCanUnloadNow(void)
154 return DMUSIC_refCount
!= 0 ? S_FALSE
: S_OK
;
158 /******************************************************************
159 * DllGetClassObject (DMUSIC.@)
163 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
165 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
166 if (IsEqualCLSID (rclsid
, &CLSID_DirectMusic
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
167 *ppv
= (LPVOID
) &DirectMusic_CF
;
168 IClassFactory_AddRef((IClassFactory
*)*ppv
);
170 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicCollection
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
171 *ppv
= (LPVOID
) &Collection_CF
;
172 IClassFactory_AddRef((IClassFactory
*)*ppv
);
176 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
177 return CLASS_E_CLASSNOTAVAILABLE
;
181 /******************************************************************
186 /* dwPatch from MIDILOCALE */
187 DWORD
MIDILOCALE2Patch (LPMIDILOCALE pLocale
) {
189 if (!pLocale
) return 0;
190 dwPatch
|= (pLocale
->ulBank
& F_INSTRUMENT_DRUMS
); /* set drum bit */
191 dwPatch
|= ((pLocale
->ulBank
& 0x00007F7F) << 8); /* set MIDI bank location */
192 dwPatch
|= (pLocale
->ulInstrument
& 0x0000007F); /* set PC value */
196 /* MIDILOCALE from dwPatch */
197 void Patch2MIDILOCALE (DWORD dwPatch
, LPMIDILOCALE pLocale
) {
198 memset (pLocale
, 0, sizeof(MIDILOCALE
));
200 pLocale
->ulInstrument
= (dwPatch
& 0x7F); /* get PC value */
201 pLocale
->ulBank
= ((dwPatch
& 0x007F7F00) >> 8); /* get MIDI bank location */
202 pLocale
->ulBank
|= (dwPatch
& F_INSTRUMENT_DRUMS
); /* get drum bit */
205 /* check whether the given DWORD is even (return 0) or odd (return 1) */
206 int even_or_odd (DWORD number
) {
207 return (number
& 0x1); /* basically, check if bit 0 is set ;) */
210 /* FOURCC to string conversion for debug messages */
211 const char *debugstr_fourcc (DWORD fourcc
) {
212 if (!fourcc
) return "'null'";
213 return wine_dbg_sprintf ("\'%c%c%c%c\'",
214 (char)(fourcc
), (char)(fourcc
>> 8),
215 (char)(fourcc
>> 16), (char)(fourcc
>> 24));
218 /* DMUS_VERSION struct to string conversion for debug messages */
219 const char *debugstr_dmversion (const DMUS_VERSION
*version
) {
220 if (!version
) return "'null'";
221 return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
222 (int)((version
->dwVersionMS
& 0xFFFF0000) >> 8), (int)(version
->dwVersionMS
& 0x0000FFFF),
223 (int)((version
->dwVersionLS
& 0xFFFF0000) >> 8), (int)(version
->dwVersionLS
& 0x0000FFFF));
226 /* returns name of given GUID */
227 const char *debugstr_dmguid (const GUID
*id
) {
228 static const guid_info guids
[] = {
230 GE(CLSID_AudioVBScript
),
231 GE(CLSID_DirectMusic
),
232 GE(CLSID_DirectMusicAudioPath
),
233 GE(CLSID_DirectMusicAudioPathConfig
),
234 GE(CLSID_DirectMusicAuditionTrack
),
235 GE(CLSID_DirectMusicBand
),
236 GE(CLSID_DirectMusicBandTrack
),
237 GE(CLSID_DirectMusicChordMapTrack
),
238 GE(CLSID_DirectMusicChordMap
),
239 GE(CLSID_DirectMusicChordTrack
),
240 GE(CLSID_DirectMusicCollection
),
241 GE(CLSID_DirectMusicCommandTrack
),
242 GE(CLSID_DirectMusicComposer
),
243 GE(CLSID_DirectMusicContainer
),
244 GE(CLSID_DirectMusicGraph
),
245 GE(CLSID_DirectMusicLoader
),
246 GE(CLSID_DirectMusicLyricsTrack
),
247 GE(CLSID_DirectMusicMarkerTrack
),
248 GE(CLSID_DirectMusicMelodyFormulationTrack
),
249 GE(CLSID_DirectMusicMotifTrack
),
250 GE(CLSID_DirectMusicMuteTrack
),
251 GE(CLSID_DirectMusicParamControlTrack
),
252 GE(CLSID_DirectMusicPatternTrack
),
253 GE(CLSID_DirectMusicPerformance
),
254 GE(CLSID_DirectMusicScript
),
255 GE(CLSID_DirectMusicScriptAutoImpSegment
),
256 GE(CLSID_DirectMusicScriptAutoImpPerformance
),
257 GE(CLSID_DirectMusicScriptAutoImpSegmentState
),
258 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig
),
259 GE(CLSID_DirectMusicScriptAutoImpAudioPath
),
260 GE(CLSID_DirectMusicScriptAutoImpSong
),
261 GE(CLSID_DirectMusicScriptSourceCodeLoader
),
262 GE(CLSID_DirectMusicScriptTrack
),
263 GE(CLSID_DirectMusicSection
),
264 GE(CLSID_DirectMusicSegment
),
265 GE(CLSID_DirectMusicSegmentState
),
266 GE(CLSID_DirectMusicSegmentTriggerTrack
),
267 GE(CLSID_DirectMusicSegTriggerTrack
),
268 GE(CLSID_DirectMusicSeqTrack
),
269 GE(CLSID_DirectMusicSignPostTrack
),
270 GE(CLSID_DirectMusicSong
),
271 GE(CLSID_DirectMusicStyle
),
272 GE(CLSID_DirectMusicStyleTrack
),
273 GE(CLSID_DirectMusicSynth
),
274 GE(CLSID_DirectMusicSynthSink
),
275 GE(CLSID_DirectMusicSysExTrack
),
276 GE(CLSID_DirectMusicTemplate
),
277 GE(CLSID_DirectMusicTempoTrack
),
278 GE(CLSID_DirectMusicTimeSigTrack
),
279 GE(CLSID_DirectMusicWaveTrack
),
280 GE(CLSID_DirectSoundWave
),
282 GE(IID_IDirectMusic
),
283 GE(IID_IDirectMusic2
),
284 GE(IID_IDirectMusic8
),
285 GE(IID_IDirectMusicAudioPath
),
286 GE(IID_IDirectMusicBand
),
287 GE(IID_IDirectMusicBuffer
),
288 GE(IID_IDirectMusicChordMap
),
289 GE(IID_IDirectMusicCollection
),
290 GE(IID_IDirectMusicComposer
),
291 GE(IID_IDirectMusicContainer
),
292 GE(IID_IDirectMusicDownload
),
293 GE(IID_IDirectMusicDownloadedInstrument
),
294 GE(IID_IDirectMusicGetLoader
),
295 GE(IID_IDirectMusicGraph
),
296 GE(IID_IDirectMusicInstrument
),
297 GE(IID_IDirectMusicLoader
),
298 GE(IID_IDirectMusicLoader8
),
299 GE(IID_IDirectMusicObject
),
300 GE(IID_IDirectMusicPatternTrack
),
301 GE(IID_IDirectMusicPerformance
),
302 GE(IID_IDirectMusicPerformance2
),
303 GE(IID_IDirectMusicPerformance8
),
304 GE(IID_IDirectMusicPort
),
305 GE(IID_IDirectMusicPortDownload
),
306 GE(IID_IDirectMusicScript
),
307 GE(IID_IDirectMusicSegment
),
308 GE(IID_IDirectMusicSegment2
),
309 GE(IID_IDirectMusicSegment8
),
310 GE(IID_IDirectMusicSegmentState
),
311 GE(IID_IDirectMusicSegmentState8
),
312 GE(IID_IDirectMusicStyle
),
313 GE(IID_IDirectMusicStyle8
),
314 GE(IID_IDirectMusicSynth
),
315 GE(IID_IDirectMusicSynth8
),
316 GE(IID_IDirectMusicSynthSink
),
317 GE(IID_IDirectMusicThru
),
318 GE(IID_IDirectMusicTool
),
319 GE(IID_IDirectMusicTool8
),
320 GE(IID_IDirectMusicTrack
),
321 GE(IID_IDirectMusicTrack8
),
323 GE(IID_IPersistStream
),
325 GE(IID_IClassFactory
),
327 GE(GUID_DirectMusicAllTypes
),
328 GE(GUID_NOTIFICATION_CHORD
),
329 GE(GUID_NOTIFICATION_COMMAND
),
330 GE(GUID_NOTIFICATION_MEASUREANDBEAT
),
331 GE(GUID_NOTIFICATION_PERFORMANCE
),
332 GE(GUID_NOTIFICATION_RECOMPOSE
),
333 GE(GUID_NOTIFICATION_SEGMENT
),
336 GE(GUID_CommandParam
),
337 GE(GUID_CommandParam2
),
338 GE(GUID_CommandParamNext
),
339 GE(GUID_IDirectMusicBand
),
340 GE(GUID_IDirectMusicChordMap
),
341 GE(GUID_IDirectMusicStyle
),
343 GE(GUID_Play_Marker
),
344 GE(GUID_RhythmParam
),
346 GE(GUID_TimeSignature
),
347 GE(GUID_Valid_Start_Time
),
348 GE(GUID_Clear_All_Bands
),
349 GE(GUID_ConnectToDLSCollection
),
350 GE(GUID_Disable_Auto_Download
),
351 GE(GUID_DisableTempo
),
352 GE(GUID_DisableTimeSig
),
354 GE(GUID_DownloadToAudioPath
),
355 GE(GUID_Enable_Auto_Download
),
356 GE(GUID_EnableTempo
),
357 GE(GUID_EnableTimeSig
),
358 GE(GUID_IgnoreBankSelectForGM
),
359 GE(GUID_SeedVariations
),
360 GE(GUID_StandardMIDIFile
),
362 GE(GUID_UnloadFromAudioPath
),
364 GE(GUID_PerfMasterTempo
),
365 GE(GUID_PerfMasterVolume
),
366 GE(GUID_PerfMasterGrooveLevel
),
367 GE(GUID_PerfAutoDownload
),
368 GE(GUID_DefaultGMCollection
),
369 GE(GUID_Synth_Default
),
370 GE(GUID_Buffer_Reverb
),
371 GE(GUID_Buffer_EnvReverb
),
372 GE(GUID_Buffer_Stereo
),
373 GE(GUID_Buffer_3D_Dry
),
374 GE(GUID_Buffer_Mono
),
375 GE(GUID_DMUS_PROP_GM_Hardware
),
376 GE(GUID_DMUS_PROP_GS_Capable
),
377 GE(GUID_DMUS_PROP_GS_Hardware
),
378 GE(GUID_DMUS_PROP_DLS1
),
379 GE(GUID_DMUS_PROP_DLS2
),
380 GE(GUID_DMUS_PROP_Effects
),
381 GE(GUID_DMUS_PROP_INSTRUMENT2
),
382 GE(GUID_DMUS_PROP_LegacyCaps
),
383 GE(GUID_DMUS_PROP_MemorySize
),
384 GE(GUID_DMUS_PROP_SampleMemorySize
),
385 GE(GUID_DMUS_PROP_SamplePlaybackRate
),
386 GE(GUID_DMUS_PROP_SetSynthSink
),
387 GE(GUID_DMUS_PROP_SinkUsesDSound
),
388 GE(GUID_DMUS_PROP_SynthSink_DSOUND
),
389 GE(GUID_DMUS_PROP_SynthSink_WAVE
),
390 GE(GUID_DMUS_PROP_Volume
),
391 GE(GUID_DMUS_PROP_WavesReverb
),
392 GE(GUID_DMUS_PROP_WriteLatency
),
393 GE(GUID_DMUS_PROP_WritePeriod
),
394 GE(GUID_DMUS_PROP_XG_Capable
),
395 GE(GUID_DMUS_PROP_XG_Hardware
)
400 if (!id
) return "(null)";
402 for (i
= 0; i
< sizeof(guids
)/sizeof(guids
[0]); i
++) {
403 if (IsEqualGUID(id
, &guids
[i
].guid
))
404 return guids
[i
].name
;
406 /* if we didn't find it, act like standard debugstr_guid */
407 return debugstr_guid(id
);
410 /* returns name of given error code */
411 const char *debugstr_dmreturn (DWORD code
) {
412 static const flag_info codes
[] = {
415 FE(DMUS_S_PARTIALLOAD
),
416 FE(DMUS_S_PARTIALDOWNLOAD
),
420 FE(DMUS_S_STRING_TRUNCATED
),
421 FE(DMUS_S_LAST_TOOL
),
422 FE(DMUS_S_OVER_CHORD
),
423 FE(DMUS_S_UP_OCTAVE
),
424 FE(DMUS_S_DOWN_OCTAVE
),
425 FE(DMUS_S_NOBUFFERCONTROL
),
426 FE(DMUS_S_GARBAGE_COLLECTED
),
427 FE(DMUS_E_DRIVER_FAILED
),
428 FE(DMUS_E_PORTS_OPEN
),
429 FE(DMUS_E_DEVICE_IN_USE
),
430 FE(DMUS_E_INSUFFICIENTBUFFER
),
431 FE(DMUS_E_BUFFERNOTSET
),
432 FE(DMUS_E_BUFFERNOTAVAILABLE
),
433 FE(DMUS_E_NOTADLSCOL
),
434 FE(DMUS_E_INVALIDOFFSET
),
435 FE(DMUS_E_ALREADY_LOADED
),
436 FE(DMUS_E_INVALIDPOS
),
437 FE(DMUS_E_INVALIDPATCH
),
438 FE(DMUS_E_CANNOTSEEK
),
439 FE(DMUS_E_CANNOTWRITE
),
440 FE(DMUS_E_CHUNKNOTFOUND
),
441 FE(DMUS_E_INVALID_DOWNLOADID
),
442 FE(DMUS_E_NOT_DOWNLOADED_TO_PORT
),
443 FE(DMUS_E_ALREADY_DOWNLOADED
),
444 FE(DMUS_E_UNKNOWN_PROPERTY
),
445 FE(DMUS_E_SET_UNSUPPORTED
),
446 FE(DMUS_E_GET_UNSUPPORTED
),
448 FE(DMUS_E_BADARTICULATION
),
449 FE(DMUS_E_BADINSTRUMENT
),
450 FE(DMUS_E_BADWAVELINK
),
451 FE(DMUS_E_NOARTICULATION
),
454 FE(DMUS_E_BADOFFSETTABLE
),
455 FE(DMUS_E_UNKNOWNDOWNLOAD
),
456 FE(DMUS_E_NOSYNTHSINK
),
457 FE(DMUS_E_ALREADYOPEN
),
458 FE(DMUS_E_ALREADYCLOSED
),
459 FE(DMUS_E_SYNTHNOTCONFIGURED
),
460 FE(DMUS_E_SYNTHACTIVE
),
461 FE(DMUS_E_CANNOTREAD
),
462 FE(DMUS_E_DMUSIC_RELEASED
),
463 FE(DMUS_E_BUFFER_EMPTY
),
464 FE(DMUS_E_BUFFER_FULL
),
465 FE(DMUS_E_PORT_NOT_CAPTURE
),
466 FE(DMUS_E_PORT_NOT_RENDER
),
467 FE(DMUS_E_DSOUND_NOT_SET
),
468 FE(DMUS_E_ALREADY_ACTIVATED
),
469 FE(DMUS_E_INVALIDBUFFER
),
470 FE(DMUS_E_WAVEFORMATNOTSUPPORTED
),
471 FE(DMUS_E_SYNTHINACTIVE
),
472 FE(DMUS_E_DSOUND_ALREADY_SET
),
473 FE(DMUS_E_INVALID_EVENT
),
474 FE(DMUS_E_UNSUPPORTED_STREAM
),
475 FE(DMUS_E_ALREADY_INITED
),
476 FE(DMUS_E_INVALID_BAND
),
477 FE(DMUS_E_TRACK_HDR_NOT_FIRST_CK
),
478 FE(DMUS_E_TOOL_HDR_NOT_FIRST_CK
),
479 FE(DMUS_E_INVALID_TRACK_HDR
),
480 FE(DMUS_E_INVALID_TOOL_HDR
),
481 FE(DMUS_E_ALL_TOOLS_FAILED
),
482 FE(DMUS_E_ALL_TRACKS_FAILED
),
483 FE(DMUS_E_NOT_FOUND
),
485 FE(DMUS_E_TYPE_DISABLED
),
486 FE(DMUS_E_TYPE_UNSUPPORTED
),
487 FE(DMUS_E_TIME_PAST
),
488 FE(DMUS_E_TRACK_NOT_FOUND
),
489 FE(DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT
),
490 FE(DMUS_E_NO_MASTER_CLOCK
),
491 FE(DMUS_E_LOADER_NOCLASSID
),
492 FE(DMUS_E_LOADER_BADPATH
),
493 FE(DMUS_E_LOADER_FAILEDOPEN
),
494 FE(DMUS_E_LOADER_FORMATNOTSUPPORTED
),
495 FE(DMUS_E_LOADER_FAILEDCREATE
),
496 FE(DMUS_E_LOADER_OBJECTNOTFOUND
),
497 FE(DMUS_E_LOADER_NOFILENAME
),
498 FE(DMUS_E_INVALIDFILE
),
499 FE(DMUS_E_ALREADY_EXISTS
),
500 FE(DMUS_E_OUT_OF_RANGE
),
501 FE(DMUS_E_SEGMENT_INIT_FAILED
),
502 FE(DMUS_E_ALREADY_SENT
),
503 FE(DMUS_E_CANNOT_FREE
),
504 FE(DMUS_E_CANNOT_OPEN_PORT
),
505 FE(DMUS_E_CANNOT_CONVERT
),
506 FE(DMUS_E_DESCEND_CHUNK_FAIL
),
507 FE(DMUS_E_NOT_LOADED
),
508 FE(DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE
),
509 FE(DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE
),
510 FE(DMUS_E_SCRIPT_ERROR_IN_SCRIPT
),
511 FE(DMUS_E_SCRIPT_CANTLOAD_OLEAUT32
),
512 FE(DMUS_E_SCRIPT_LOADSCRIPT_ERROR
),
513 FE(DMUS_E_SCRIPT_INVALID_FILE
),
514 FE(DMUS_E_INVALID_SCRIPTTRACK
),
515 FE(DMUS_E_SCRIPT_VARIABLE_NOT_FOUND
),
516 FE(DMUS_E_SCRIPT_ROUTINE_NOT_FOUND
),
517 FE(DMUS_E_SCRIPT_CONTENT_READONLY
),
518 FE(DMUS_E_SCRIPT_NOT_A_REFERENCE
),
519 FE(DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED
),
520 FE(DMUS_E_INVALID_SEGMENTTRIGGERTRACK
),
521 FE(DMUS_E_INVALID_LYRICSTRACK
),
522 FE(DMUS_E_INVALID_PARAMCONTROLTRACK
),
523 FE(DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR
),
524 FE(DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR
),
525 FE(DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE
),
526 FE(DMUS_E_AUDIOPATHS_NOT_VALID
),
527 FE(DMUS_E_AUDIOPATHS_IN_USE
),
528 FE(DMUS_E_NO_AUDIOPATH_CONFIG
),
529 FE(DMUS_E_AUDIOPATH_INACTIVE
),
530 FE(DMUS_E_AUDIOPATH_NOBUFFER
),
531 FE(DMUS_E_AUDIOPATH_NOPORT
),
532 FE(DMUS_E_NO_AUDIOPATH
),
533 FE(DMUS_E_INVALIDCHUNK
),
534 FE(DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER
),
535 FE(DMUS_E_INVALID_CONTAINER_OBJECT
)
538 for (i
= 0; i
< sizeof(codes
)/sizeof(codes
[0]); i
++) {
539 if (code
== codes
[i
].val
)
540 return codes
[i
].name
;
542 /* if we didn't find it, return value */
543 return wine_dbg_sprintf("0x%08x", code
);
546 /* generic flag-dumping function */
547 const char* debugstr_flags (DWORD flags
, const flag_info
* names
, size_t num_names
){
548 char buffer
[128] = "", *ptr
= &buffer
[0];
549 unsigned int i
, size
= sizeof(buffer
);
551 for (i
=0; i
< num_names
; i
++)
553 if ((flags
& names
[i
].val
) || /* standard flag*/
554 ((!flags
) && (!names
[i
].val
))) { /* zero value only */
555 int cnt
= snprintf(ptr
, size
, "%s ", names
[i
].name
);
556 if (cnt
< 0 || cnt
>= size
) break;
562 return wine_dbg_sprintf("%s", buffer
);
565 /* dump DMUS_OBJ flags */
566 const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask
) {
567 static const flag_info flags
[] = {
571 FE(DMUS_OBJ_CATEGORY
),
572 FE(DMUS_OBJ_FILENAME
),
573 FE(DMUS_OBJ_FULLPATH
),
575 FE(DMUS_OBJ_VERSION
),
581 return debugstr_flags (flagmask
, flags
, sizeof(flags
)/sizeof(flags
[0]));
584 /* dump whole DMUS_OBJECTDESC struct */
585 const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc
) {
587 char buffer
[1024] = "", *ptr
= &buffer
[0];
589 ptr
+= sprintf(ptr
, "DMUS_OBJECTDESC (%p):\n", pDesc
);
590 ptr
+= sprintf(ptr
, " - dwSize = %d\n", pDesc
->dwSize
);
591 ptr
+= sprintf(ptr
, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc
->dwValidData
));
592 if (pDesc
->dwValidData
& DMUS_OBJ_CLASS
) ptr
+= sprintf(ptr
, " - guidClass = %s\n", debugstr_dmguid(&pDesc
->guidClass
));
593 if (pDesc
->dwValidData
& DMUS_OBJ_OBJECT
) ptr
+= sprintf(ptr
, " - guidObject = %s\n", debugstr_guid(&pDesc
->guidObject
));
594 if (pDesc
->dwValidData
& DMUS_OBJ_DATE
) ptr
+= sprintf(ptr
, " - ftDate = FIXME\n");
595 if (pDesc
->dwValidData
& DMUS_OBJ_VERSION
) ptr
+= sprintf(ptr
, " - vVersion = %s\n", debugstr_dmversion(&pDesc
->vVersion
));
596 if (pDesc
->dwValidData
& DMUS_OBJ_NAME
) ptr
+= sprintf(ptr
, " - wszName = %s\n", debugstr_w(pDesc
->wszName
));
597 if (pDesc
->dwValidData
& DMUS_OBJ_CATEGORY
) ptr
+= sprintf(ptr
, " - wszCategory = %s\n", debugstr_w(pDesc
->wszCategory
));
598 if (pDesc
->dwValidData
& DMUS_OBJ_FILENAME
) ptr
+= sprintf(ptr
, " - wszFileName = %s\n", debugstr_w(pDesc
->wszFileName
));
599 if (pDesc
->dwValidData
& DMUS_OBJ_MEMORY
) ptr
+= sprintf(ptr
, " - llMemLength = 0x%s\n - pbMemData = %p\n",
600 wine_dbgstr_longlong(pDesc
->llMemLength
), pDesc
->pbMemData
);
601 if (pDesc
->dwValidData
& DMUS_OBJ_STREAM
) ptr
+= sprintf(ptr
, " - pStream = %p", pDesc
->pStream
);
603 return wine_dbg_sprintf("%s", buffer
);
605 return wine_dbg_sprintf("(NULL)");