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.
22 #include "dmusic_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
26 LONG DMUSIC_refCount
= 0;
29 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 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 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.1)
152 HRESULT WINAPI
DMUSIC_DllCanUnloadNow(void) {
153 return DMUSIC_refCount
!= 0 ? S_FALSE
: S_OK
;
157 /******************************************************************
158 * DllGetClassObject (DMUSIC.2)
162 HRESULT WINAPI
DMUSIC_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
) {
163 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
164 if (IsEqualCLSID (rclsid
, &CLSID_DirectMusic
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
165 *ppv
= (LPVOID
) &DirectMusic_CF
;
166 IClassFactory_AddRef((IClassFactory
*)*ppv
);
168 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicCollection
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
169 *ppv
= (LPVOID
) &Collection_CF
;
170 IClassFactory_AddRef((IClassFactory
*)*ppv
);
174 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
175 return CLASS_E_CLASSNOTAVAILABLE
;
179 /******************************************************************
184 /* dwPatch from MIDILOCALE */
185 DWORD
MIDILOCALE2Patch (LPMIDILOCALE pLocale
) {
187 if (!pLocale
) return 0;
188 dwPatch
|= (pLocale
->ulBank
& F_INSTRUMENT_DRUMS
); /* set drum bit */
189 dwPatch
|= ((pLocale
->ulBank
& 0x00007F7F) << 8); /* set MIDI bank location */
190 dwPatch
|= (pLocale
->ulInstrument
& 0x0000007F); /* set PC value */
194 /* MIDILOCALE from dwPatch */
195 void Patch2MIDILOCALE (DWORD dwPatch
, LPMIDILOCALE pLocale
) {
196 memset (pLocale
, 0, sizeof(MIDILOCALE
));
198 pLocale
->ulInstrument
= (dwPatch
& 0x7F); /* get PC value */
199 pLocale
->ulBank
= ((dwPatch
& 0x007F7F00) >> 8); /* get MIDI bank location */
200 pLocale
->ulBank
|= (dwPatch
& F_INSTRUMENT_DRUMS
); /* get drum bit */
203 /* check whether the given DWORD is even (return 0) or odd (return 1) */
204 int even_or_odd (DWORD number
) {
205 return (number
& 0x1); /* basically, check if bit 0 is set ;) */
208 /* FOURCC to string conversion for debug messages */
209 const char *debugstr_fourcc (DWORD fourcc
) {
210 if (!fourcc
) return "'null'";
211 return wine_dbg_sprintf ("\'%c%c%c%c\'",
212 (char)(fourcc
), (char)(fourcc
>> 8),
213 (char)(fourcc
>> 16), (char)(fourcc
>> 24));
216 /* DMUS_VERSION struct to string conversion for debug messages */
217 const char *debugstr_dmversion (LPDMUS_VERSION version
) {
218 if (!version
) return "'null'";
219 return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
220 (int)((version
->dwVersionMS
&& 0xFFFF0000) >> 8), (int)(version
->dwVersionMS
&& 0x0000FFFF),
221 (int)((version
->dwVersionLS
&& 0xFFFF0000) >> 8), (int)(version
->dwVersionLS
&& 0x0000FFFF));
224 /* returns name of given GUID */
225 const char *debugstr_dmguid (const GUID
*id
) {
226 static const guid_info guids
[] = {
228 GE(CLSID_AudioVBScript
),
229 GE(CLSID_DirectMusic
),
230 GE(CLSID_DirectMusicAudioPath
),
231 GE(CLSID_DirectMusicAudioPathConfig
),
232 GE(CLSID_DirectMusicAuditionTrack
),
233 GE(CLSID_DirectMusicBand
),
234 GE(CLSID_DirectMusicBandTrack
),
235 GE(CLSID_DirectMusicChordMapTrack
),
236 GE(CLSID_DirectMusicChordMap
),
237 GE(CLSID_DirectMusicChordTrack
),
238 GE(CLSID_DirectMusicCollection
),
239 GE(CLSID_DirectMusicCommandTrack
),
240 GE(CLSID_DirectMusicComposer
),
241 GE(CLSID_DirectMusicContainer
),
242 GE(CLSID_DirectMusicGraph
),
243 GE(CLSID_DirectMusicLoader
),
244 GE(CLSID_DirectMusicLyricsTrack
),
245 GE(CLSID_DirectMusicMarkerTrack
),
246 GE(CLSID_DirectMusicMelodyFormulationTrack
),
247 GE(CLSID_DirectMusicMotifTrack
),
248 GE(CLSID_DirectMusicMuteTrack
),
249 GE(CLSID_DirectMusicParamControlTrack
),
250 GE(CLSID_DirectMusicPatternTrack
),
251 GE(CLSID_DirectMusicPerformance
),
252 GE(CLSID_DirectMusicScript
),
253 GE(CLSID_DirectMusicScriptAutoImpSegment
),
254 GE(CLSID_DirectMusicScriptAutoImpPerformance
),
255 GE(CLSID_DirectMusicScriptAutoImpSegmentState
),
256 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig
),
257 GE(CLSID_DirectMusicScriptAutoImpAudioPath
),
258 GE(CLSID_DirectMusicScriptAutoImpSong
),
259 GE(CLSID_DirectMusicScriptSourceCodeLoader
),
260 GE(CLSID_DirectMusicScriptTrack
),
261 GE(CLSID_DirectMusicSection
),
262 GE(CLSID_DirectMusicSegment
),
263 GE(CLSID_DirectMusicSegmentState
),
264 GE(CLSID_DirectMusicSegmentTriggerTrack
),
265 GE(CLSID_DirectMusicSegTriggerTrack
),
266 GE(CLSID_DirectMusicSeqTrack
),
267 GE(CLSID_DirectMusicSignPostTrack
),
268 GE(CLSID_DirectMusicSong
),
269 GE(CLSID_DirectMusicStyle
),
270 GE(CLSID_DirectMusicStyleTrack
),
271 GE(CLSID_DirectMusicSynth
),
272 GE(CLSID_DirectMusicSynthSink
),
273 GE(CLSID_DirectMusicSysExTrack
),
274 GE(CLSID_DirectMusicTemplate
),
275 GE(CLSID_DirectMusicTempoTrack
),
276 GE(CLSID_DirectMusicTimeSigTrack
),
277 GE(CLSID_DirectMusicWaveTrack
),
278 GE(CLSID_DirectSoundWave
),
280 GE(IID_IDirectMusic
),
281 GE(IID_IDirectMusic2
),
282 GE(IID_IDirectMusic8
),
283 GE(IID_IDirectMusicAudioPath
),
284 GE(IID_IDirectMusicBand
),
285 GE(IID_IDirectMusicBuffer
),
286 GE(IID_IDirectMusicChordMap
),
287 GE(IID_IDirectMusicCollection
),
288 GE(IID_IDirectMusicComposer
),
289 GE(IID_IDirectMusicContainer
),
290 GE(IID_IDirectMusicDownload
),
291 GE(IID_IDirectMusicDownloadedInstrument
),
292 GE(IID_IDirectMusicGetLoader
),
293 GE(IID_IDirectMusicGraph
),
294 GE(IID_IDirectMusicInstrument
),
295 GE(IID_IDirectMusicLoader
),
296 GE(IID_IDirectMusicLoader8
),
297 GE(IID_IDirectMusicObject
),
298 GE(IID_IDirectMusicPatternTrack
),
299 GE(IID_IDirectMusicPerformance
),
300 GE(IID_IDirectMusicPerformance2
),
301 GE(IID_IDirectMusicPerformance8
),
302 GE(IID_IDirectMusicPort
),
303 GE(IID_IDirectMusicPortDownload
),
304 GE(IID_IDirectMusicScript
),
305 GE(IID_IDirectMusicSegment
),
306 GE(IID_IDirectMusicSegment2
),
307 GE(IID_IDirectMusicSegment8
),
308 GE(IID_IDirectMusicSegmentState
),
309 GE(IID_IDirectMusicSegmentState8
),
310 GE(IID_IDirectMusicStyle
),
311 GE(IID_IDirectMusicStyle8
),
312 GE(IID_IDirectMusicSynth
),
313 GE(IID_IDirectMusicSynth8
),
314 GE(IID_IDirectMusicSynthSink
),
315 GE(IID_IDirectMusicThru
),
316 GE(IID_IDirectMusicTool
),
317 GE(IID_IDirectMusicTool8
),
318 GE(IID_IDirectMusicTrack
),
319 GE(IID_IDirectMusicTrack8
),
321 GE(IID_IPersistStream
),
323 GE(IID_IClassFactory
),
325 GE(GUID_DirectMusicAllTypes
),
326 GE(GUID_NOTIFICATION_CHORD
),
327 GE(GUID_NOTIFICATION_COMMAND
),
328 GE(GUID_NOTIFICATION_MEASUREANDBEAT
),
329 GE(GUID_NOTIFICATION_PERFORMANCE
),
330 GE(GUID_NOTIFICATION_RECOMPOSE
),
331 GE(GUID_NOTIFICATION_SEGMENT
),
334 GE(GUID_CommandParam
),
335 GE(GUID_CommandParam2
),
336 GE(GUID_CommandParamNext
),
337 GE(GUID_IDirectMusicBand
),
338 GE(GUID_IDirectMusicChordMap
),
339 GE(GUID_IDirectMusicStyle
),
341 GE(GUID_Play_Marker
),
342 GE(GUID_RhythmParam
),
344 GE(GUID_TimeSignature
),
345 GE(GUID_Valid_Start_Time
),
346 GE(GUID_Clear_All_Bands
),
347 GE(GUID_ConnectToDLSCollection
),
348 GE(GUID_Disable_Auto_Download
),
349 GE(GUID_DisableTempo
),
350 GE(GUID_DisableTimeSig
),
352 GE(GUID_DownloadToAudioPath
),
353 GE(GUID_Enable_Auto_Download
),
354 GE(GUID_EnableTempo
),
355 GE(GUID_EnableTimeSig
),
356 GE(GUID_IgnoreBankSelectForGM
),
357 GE(GUID_SeedVariations
),
358 GE(GUID_StandardMIDIFile
),
360 GE(GUID_UnloadFromAudioPath
),
362 GE(GUID_PerfMasterTempo
),
363 GE(GUID_PerfMasterVolume
),
364 GE(GUID_PerfMasterGrooveLevel
),
365 GE(GUID_PerfAutoDownload
),
366 GE(GUID_DefaultGMCollection
),
367 GE(GUID_Synth_Default
),
368 GE(GUID_Buffer_Reverb
),
369 GE(GUID_Buffer_EnvReverb
),
370 GE(GUID_Buffer_Stereo
),
371 GE(GUID_Buffer_3D_Dry
),
372 GE(GUID_Buffer_Mono
),
373 GE(GUID_DMUS_PROP_GM_Hardware
),
374 GE(GUID_DMUS_PROP_GS_Capable
),
375 GE(GUID_DMUS_PROP_GS_Hardware
),
376 GE(GUID_DMUS_PROP_DLS1
),
377 GE(GUID_DMUS_PROP_DLS2
),
378 GE(GUID_DMUS_PROP_Effects
),
379 GE(GUID_DMUS_PROP_INSTRUMENT2
),
380 GE(GUID_DMUS_PROP_LegacyCaps
),
381 GE(GUID_DMUS_PROP_MemorySize
),
382 GE(GUID_DMUS_PROP_SampleMemorySize
),
383 GE(GUID_DMUS_PROP_SamplePlaybackRate
),
384 GE(GUID_DMUS_PROP_SetSynthSink
),
385 GE(GUID_DMUS_PROP_SinkUsesDSound
),
386 GE(GUID_DMUS_PROP_SynthSink_DSOUND
),
387 GE(GUID_DMUS_PROP_SynthSink_WAVE
),
388 GE(GUID_DMUS_PROP_Volume
),
389 GE(GUID_DMUS_PROP_WavesReverb
),
390 GE(GUID_DMUS_PROP_WriteLatency
),
391 GE(GUID_DMUS_PROP_WritePeriod
),
392 GE(GUID_DMUS_PROP_XG_Capable
),
393 GE(GUID_DMUS_PROP_XG_Hardware
)
398 if (!id
) return "(null)";
400 for (i
= 0; i
< sizeof(guids
)/sizeof(guids
[0]); i
++) {
401 if (IsEqualGUID(id
, &guids
[i
].guid
))
402 return guids
[i
].name
;
404 /* if we didn't find it, act like standard debugstr_guid */
405 return debugstr_guid(id
);
408 /* returns name of given error code */
409 const char *debugstr_dmreturn (DWORD code
) {
410 static const flag_info codes
[] = {
413 FE(DMUS_S_PARTIALLOAD
),
414 FE(DMUS_S_PARTIALDOWNLOAD
),
418 FE(DMUS_S_STRING_TRUNCATED
),
419 FE(DMUS_S_LAST_TOOL
),
420 FE(DMUS_S_OVER_CHORD
),
421 FE(DMUS_S_UP_OCTAVE
),
422 FE(DMUS_S_DOWN_OCTAVE
),
423 FE(DMUS_S_NOBUFFERCONTROL
),
424 FE(DMUS_S_GARBAGE_COLLECTED
),
425 FE(DMUS_E_DRIVER_FAILED
),
426 FE(DMUS_E_PORTS_OPEN
),
427 FE(DMUS_E_DEVICE_IN_USE
),
428 FE(DMUS_E_INSUFFICIENTBUFFER
),
429 FE(DMUS_E_BUFFERNOTSET
),
430 FE(DMUS_E_BUFFERNOTAVAILABLE
),
431 FE(DMUS_E_NOTADLSCOL
),
432 FE(DMUS_E_INVALIDOFFSET
),
433 FE(DMUS_E_ALREADY_LOADED
),
434 FE(DMUS_E_INVALIDPOS
),
435 FE(DMUS_E_INVALIDPATCH
),
436 FE(DMUS_E_CANNOTSEEK
),
437 FE(DMUS_E_CANNOTWRITE
),
438 FE(DMUS_E_CHUNKNOTFOUND
),
439 FE(DMUS_E_INVALID_DOWNLOADID
),
440 FE(DMUS_E_NOT_DOWNLOADED_TO_PORT
),
441 FE(DMUS_E_ALREADY_DOWNLOADED
),
442 FE(DMUS_E_UNKNOWN_PROPERTY
),
443 FE(DMUS_E_SET_UNSUPPORTED
),
444 FE(DMUS_E_GET_UNSUPPORTED
),
446 FE(DMUS_E_BADARTICULATION
),
447 FE(DMUS_E_BADINSTRUMENT
),
448 FE(DMUS_E_BADWAVELINK
),
449 FE(DMUS_E_NOARTICULATION
),
452 FE(DMUS_E_BADOFFSETTABLE
),
453 FE(DMUS_E_UNKNOWNDOWNLOAD
),
454 FE(DMUS_E_NOSYNTHSINK
),
455 FE(DMUS_E_ALREADYOPEN
),
456 FE(DMUS_E_ALREADYCLOSED
),
457 FE(DMUS_E_SYNTHNOTCONFIGURED
),
458 FE(DMUS_E_SYNTHACTIVE
),
459 FE(DMUS_E_CANNOTREAD
),
460 FE(DMUS_E_DMUSIC_RELEASED
),
461 FE(DMUS_E_BUFFER_EMPTY
),
462 FE(DMUS_E_BUFFER_FULL
),
463 FE(DMUS_E_PORT_NOT_CAPTURE
),
464 FE(DMUS_E_PORT_NOT_RENDER
),
465 FE(DMUS_E_DSOUND_NOT_SET
),
466 FE(DMUS_E_ALREADY_ACTIVATED
),
467 FE(DMUS_E_INVALIDBUFFER
),
468 FE(DMUS_E_WAVEFORMATNOTSUPPORTED
),
469 FE(DMUS_E_SYNTHINACTIVE
),
470 FE(DMUS_E_DSOUND_ALREADY_SET
),
471 FE(DMUS_E_INVALID_EVENT
),
472 FE(DMUS_E_UNSUPPORTED_STREAM
),
473 FE(DMUS_E_ALREADY_INITED
),
474 FE(DMUS_E_INVALID_BAND
),
475 FE(DMUS_E_TRACK_HDR_NOT_FIRST_CK
),
476 FE(DMUS_E_TOOL_HDR_NOT_FIRST_CK
),
477 FE(DMUS_E_INVALID_TRACK_HDR
),
478 FE(DMUS_E_INVALID_TOOL_HDR
),
479 FE(DMUS_E_ALL_TOOLS_FAILED
),
480 FE(DMUS_E_ALL_TRACKS_FAILED
),
481 FE(DMUS_E_NOT_FOUND
),
483 FE(DMUS_E_TYPE_DISABLED
),
484 FE(DMUS_E_TYPE_UNSUPPORTED
),
485 FE(DMUS_E_TIME_PAST
),
486 FE(DMUS_E_TRACK_NOT_FOUND
),
487 FE(DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT
),
488 FE(DMUS_E_NO_MASTER_CLOCK
),
489 FE(DMUS_E_LOADER_NOCLASSID
),
490 FE(DMUS_E_LOADER_BADPATH
),
491 FE(DMUS_E_LOADER_FAILEDOPEN
),
492 FE(DMUS_E_LOADER_FORMATNOTSUPPORTED
),
493 FE(DMUS_E_LOADER_FAILEDCREATE
),
494 FE(DMUS_E_LOADER_OBJECTNOTFOUND
),
495 FE(DMUS_E_LOADER_NOFILENAME
),
496 FE(DMUS_E_INVALIDFILE
),
497 FE(DMUS_E_ALREADY_EXISTS
),
498 FE(DMUS_E_OUT_OF_RANGE
),
499 FE(DMUS_E_SEGMENT_INIT_FAILED
),
500 FE(DMUS_E_ALREADY_SENT
),
501 FE(DMUS_E_CANNOT_FREE
),
502 FE(DMUS_E_CANNOT_OPEN_PORT
),
503 FE(DMUS_E_CANNOT_CONVERT
),
504 FE(DMUS_E_DESCEND_CHUNK_FAIL
),
505 FE(DMUS_E_NOT_LOADED
),
506 FE(DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE
),
507 FE(DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE
),
508 FE(DMUS_E_SCRIPT_ERROR_IN_SCRIPT
),
509 FE(DMUS_E_SCRIPT_CANTLOAD_OLEAUT32
),
510 FE(DMUS_E_SCRIPT_LOADSCRIPT_ERROR
),
511 FE(DMUS_E_SCRIPT_INVALID_FILE
),
512 FE(DMUS_E_INVALID_SCRIPTTRACK
),
513 FE(DMUS_E_SCRIPT_VARIABLE_NOT_FOUND
),
514 FE(DMUS_E_SCRIPT_ROUTINE_NOT_FOUND
),
515 FE(DMUS_E_SCRIPT_CONTENT_READONLY
),
516 FE(DMUS_E_SCRIPT_NOT_A_REFERENCE
),
517 FE(DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED
),
518 FE(DMUS_E_INVALID_SEGMENTTRIGGERTRACK
),
519 FE(DMUS_E_INVALID_LYRICSTRACK
),
520 FE(DMUS_E_INVALID_PARAMCONTROLTRACK
),
521 FE(DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR
),
522 FE(DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR
),
523 FE(DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE
),
524 FE(DMUS_E_AUDIOPATHS_NOT_VALID
),
525 FE(DMUS_E_AUDIOPATHS_IN_USE
),
526 FE(DMUS_E_NO_AUDIOPATH_CONFIG
),
527 FE(DMUS_E_AUDIOPATH_INACTIVE
),
528 FE(DMUS_E_AUDIOPATH_NOBUFFER
),
529 FE(DMUS_E_AUDIOPATH_NOPORT
),
530 FE(DMUS_E_NO_AUDIOPATH
),
531 FE(DMUS_E_INVALIDCHUNK
),
532 FE(DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER
),
533 FE(DMUS_E_INVALID_CONTAINER_OBJECT
)
536 for (i
= 0; i
< sizeof(codes
)/sizeof(codes
[0]); i
++) {
537 if (code
== codes
[i
].val
)
538 return codes
[i
].name
;
540 /* if we didn't find it, return value */
541 return wine_dbg_sprintf("0x%08lx", code
);
544 /* generic flag-dumping function */
545 const char* debugstr_flags (DWORD flags
, const flag_info
* names
, size_t num_names
){
546 char buffer
[128] = "", *ptr
= &buffer
[0];
547 unsigned int i
, size
= sizeof(buffer
);
549 for (i
=0; i
< num_names
; i
++)
551 if ((flags
& names
[i
].val
) || /* standard flag*/
552 ((!flags
) && (!names
[i
].val
))) { /* zero value only */
553 int cnt
= snprintf(ptr
, size
, "%s ", names
[i
].name
);
554 if (cnt
< 0 || cnt
>= size
) break;
560 return wine_dbg_sprintf("%s", buffer
);
563 /* dump DMUS_OBJ flags */
564 const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask
) {
565 static const flag_info flags
[] = {
569 FE(DMUS_OBJ_CATEGORY
),
570 FE(DMUS_OBJ_FILENAME
),
571 FE(DMUS_OBJ_FULLPATH
),
573 FE(DMUS_OBJ_VERSION
),
579 return debugstr_flags (flagmask
, flags
, sizeof(flags
)/sizeof(flags
[0]));
582 /* dump whole DMUS_OBJECTDESC struct */
583 const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc
) {
585 char buffer
[1024] = "", *ptr
= &buffer
[0];
587 ptr
+= sprintf(ptr
, "DMUS_OBJECTDESC (%p):\n", pDesc
);
588 ptr
+= sprintf(ptr
, " - dwSize = %ld\n", pDesc
->dwSize
);
589 ptr
+= sprintf(ptr
, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc
->dwValidData
));
590 if (pDesc
->dwValidData
& DMUS_OBJ_CLASS
) ptr
+= sprintf(ptr
, " - guidClass = %s\n", debugstr_dmguid(&pDesc
->guidClass
));
591 if (pDesc
->dwValidData
& DMUS_OBJ_OBJECT
) ptr
+= sprintf(ptr
, " - guidObject = %s\n", debugstr_guid(&pDesc
->guidObject
));
592 if (pDesc
->dwValidData
& DMUS_OBJ_DATE
) ptr
+= sprintf(ptr
, " - ftDate = FIXME\n");
593 if (pDesc
->dwValidData
& DMUS_OBJ_VERSION
) ptr
+= sprintf(ptr
, " - vVersion = %s\n", debugstr_dmversion(&pDesc
->vVersion
));
594 if (pDesc
->dwValidData
& DMUS_OBJ_NAME
) ptr
+= sprintf(ptr
, " - wszName = %s\n", debugstr_w(pDesc
->wszName
));
595 if (pDesc
->dwValidData
& DMUS_OBJ_CATEGORY
) ptr
+= sprintf(ptr
, " - wszCategory = %s\n", debugstr_w(pDesc
->wszCategory
));
596 if (pDesc
->dwValidData
& DMUS_OBJ_FILENAME
) ptr
+= sprintf(ptr
, " - wszFileName = %s\n", debugstr_w(pDesc
->wszFileName
));
597 if (pDesc
->dwValidData
& DMUS_OBJ_MEMORY
) ptr
+= sprintf(ptr
, " - llMemLength = %lli\n - pbMemData = %p\n", pDesc
->llMemLength
, pDesc
->pbMemData
);
598 if (pDesc
->dwValidData
& DMUS_OBJ_STREAM
) ptr
+= sprintf(ptr
, " - pStream = %p", pDesc
->pStream
);
600 return wine_dbg_sprintf("%s", buffer
);
602 return wine_dbg_sprintf("(NULL)");