3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2002 TransGaming Technologies, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Most thread locking is complete. There may be a few race
23 * conditions still lurking.
25 * Tested with a Soundblaster clone, a Gravis UltraSound Classic,
26 * and a Turtle Beach Tropez+.
29 * Implement SetCooperativeLevel properly (need to address focus issues)
30 * Implement DirectSound3DBuffers (stubs in place)
31 * Use hardware 3D support if available
32 * Add critical section locking inside Release and AddRef methods
33 * Handle static buffers - put those in hardware, non-static not in hardware
34 * Hardware DuplicateSoundBuffer
35 * Proper volume calculation, and setting volume in HEL primary buffer
36 * Optimize WINMM and negotiate fragment size, decrease DS_HEL_MARGIN
42 #define NONAMELESSSTRUCT
43 #define NONAMELESSUNION
52 #include "wine/debug.h"
55 #include "dsound_private.h"
58 WINE_DEFAULT_DEBUG_CHANNEL(dsound);
60 /* these are eligible for tuning... they must be high on slow machines... */
61 /* some stuff may get more responsive with lower values though... */
62 #define DS_EMULDRIVER 0 /* some games (Quake 2, UT) refuse to accept
63 emulated dsound devices. set to 0 ! */
64 #define DS_HEL_MARGIN 5 /* HEL only: number of waveOut fragments ahead to mix in new buffers
65 * (keep this close or equal to DS_HEL_QUEUE for best results) */
66 #define DS_HEL_QUEUE 5 /* HEL only: number of waveOut fragments ahead to queue to driver
67 * (this will affect HEL sound reliability and latency) */
69 #define DS_SND_QUEUE_MAX 28 /* max number of fragments to prebuffer */
70 #define DS_SND_QUEUE_MIN 12 /* min number of fragments to prebuffer */
72 DirectSoundDevice* DSOUND_renderer[MAXWAVEDRIVERS];
73 GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
74 GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
76 HRESULT mmErr(UINT err)
79 case MMSYSERR_NOERROR:
81 case MMSYSERR_ALLOCATED:
82 return DSERR_ALLOCATED;
84 case MMSYSERR_INVALHANDLE:
85 case WAVERR_STILLPLAYING:
86 return DSERR_GENERIC; /* FIXME */
87 case MMSYSERR_NODRIVER:
88 return DSERR_NODRIVER;
90 return DSERR_OUTOFMEMORY;
91 case MMSYSERR_INVALPARAM:
92 case WAVERR_BADFORMAT:
93 case WAVERR_UNPREPARED:
94 return DSERR_INVALIDPARAM;
95 case MMSYSERR_NOTSUPPORTED:
96 return DSERR_UNSUPPORTED;
98 FIXME("Unknown MMSYS error %d\n",err);
103 int ds_emuldriver = DS_EMULDRIVER;
104 int ds_hel_margin = DS_HEL_MARGIN;
105 int ds_hel_queue = DS_HEL_QUEUE;
106 int ds_snd_queue_max = DS_SND_QUEUE_MAX;
107 int ds_snd_queue_min = DS_SND_QUEUE_MIN;
108 int ds_hw_accel = DS_HW_ACCEL_FULL;
109 int ds_default_playback = 0;
110 int ds_default_capture = 0;
113 * Get a config key from either the app-specific or the default config
116 inline static DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
117 char *buffer, DWORD size )
119 if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size )) return 0;
120 if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size )) return 0;
121 return ERROR_FILE_NOT_FOUND;
126 * Setup the dsound options.
129 void setup_dsound_options(void)
131 char buffer[MAX_PATH+16];
132 HKEY hkey, appkey = 0;
135 buffer[MAX_PATH]='\0';
137 /* @@ Wine registry key: HKCU\Software\Wine\DirectSound */
138 if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\DirectSound", &hkey )) hkey = 0;
140 len = GetModuleFileNameA( 0, buffer, MAX_PATH );
141 if (len && len < MAX_PATH)
144 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectSound */
145 if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey ))
147 char *p, *appname = buffer;
148 if ((p = strrchr( appname, '/' ))) appname = p + 1;
149 if ((p = strrchr( appname, '\\' ))) appname = p + 1;
150 strcat( appname, "\\DirectSound" );
151 TRACE("appname = [%s] \n",appname);
152 if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
153 RegCloseKey( tmpkey );
159 if (!get_config_key( hkey, appkey, "EmulDriver", buffer, MAX_PATH ))
160 ds_emuldriver = strcmp(buffer, "N");
162 if (!get_config_key( hkey, appkey, "HELmargin", buffer, MAX_PATH ))
163 ds_hel_margin = atoi(buffer);
165 if (!get_config_key( hkey, appkey, "HELqueue", buffer, MAX_PATH ))
166 ds_hel_queue = atoi(buffer);
168 if (!get_config_key( hkey, appkey, "SndQueueMax", buffer, MAX_PATH ))
169 ds_snd_queue_max = atoi(buffer);
171 if (!get_config_key( hkey, appkey, "SndQueueMin", buffer, MAX_PATH ))
172 ds_snd_queue_min = atoi(buffer);
174 if (!get_config_key( hkey, appkey, "HardwareAcceleration", buffer, MAX_PATH )) {
175 if (strcmp(buffer, "Full") == 0)
176 ds_hw_accel = DS_HW_ACCEL_FULL;
177 else if (strcmp(buffer, "Standard") == 0)
178 ds_hw_accel = DS_HW_ACCEL_STANDARD;
179 else if (strcmp(buffer, "Basic") == 0)
180 ds_hw_accel = DS_HW_ACCEL_BASIC;
181 else if (strcmp(buffer, "Emulation") == 0)
182 ds_hw_accel = DS_HW_ACCEL_EMULATION;
185 if (!get_config_key( hkey, appkey, "DefaultPlayback", buffer, MAX_PATH ))
186 ds_default_playback = atoi(buffer);
188 if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH ))
189 ds_default_capture = atoi(buffer);
191 if (appkey) RegCloseKey( appkey );
192 if (hkey) RegCloseKey( hkey );
194 if (ds_emuldriver != DS_EMULDRIVER )
195 WARN("ds_emuldriver = %d (default=%d)\n",ds_emuldriver, DS_EMULDRIVER);
196 if (ds_hel_margin != DS_HEL_MARGIN )
197 WARN("ds_hel_margin = %d (default=%d)\n",ds_hel_margin, DS_HEL_MARGIN );
198 if (ds_hel_queue != DS_HEL_QUEUE )
199 WARN("ds_hel_queue = %d (default=%d)\n",ds_hel_queue, DS_HEL_QUEUE );
200 if (ds_snd_queue_max != DS_SND_QUEUE_MAX)
201 WARN("ds_snd_queue_max = %d (default=%d)\n",ds_snd_queue_max ,DS_SND_QUEUE_MAX);
202 if (ds_snd_queue_min != DS_SND_QUEUE_MIN)
203 WARN("ds_snd_queue_min = %d (default=%d)\n",ds_snd_queue_min ,DS_SND_QUEUE_MIN);
204 if (ds_hw_accel != DS_HW_ACCEL_FULL)
205 WARN("ds_hw_accel = %s (default=Full)\n",
206 ds_hw_accel==DS_HW_ACCEL_FULL ? "Full" :
207 ds_hw_accel==DS_HW_ACCEL_STANDARD ? "Standard" :
208 ds_hw_accel==DS_HW_ACCEL_BASIC ? "Basic" :
209 ds_hw_accel==DS_HW_ACCEL_EMULATION ? "Emulation" :
211 if (ds_default_playback != 0)
212 WARN("ds_default_playback = %d (default=0)\n",ds_default_playback);
213 if (ds_default_capture != 0)
214 WARN("ds_default_capture = %d (default=0)\n",ds_default_playback);
217 const char * get_device_id(LPCGUID pGuid)
219 if (IsEqualGUID(&DSDEVID_DefaultPlayback, pGuid))
220 return "DSDEVID_DefaultPlayback";
221 else if (IsEqualGUID(&DSDEVID_DefaultVoicePlayback, pGuid))
222 return "DSDEVID_DefaultVoicePlayback";
223 else if (IsEqualGUID(&DSDEVID_DefaultCapture, pGuid))
224 return "DSDEVID_DefaultCapture";
225 else if (IsEqualGUID(&DSDEVID_DefaultVoiceCapture, pGuid))
226 return "DSDEVID_DefaultVoiceCapture";
227 return debugstr_guid(pGuid);
230 /***************************************************************************
231 * GetDeviceID [DSOUND.9]
233 * Retrieves unique identifier of default device specified
236 * pGuidSrc [I] Address of device GUID.
237 * pGuidDest [O] Address to receive unique device GUID.
241 * Failure: DSERR_INVALIDPARAM
244 * pGuidSrc is a valid device GUID or DSDEVID_DefaultPlayback,
245 * DSDEVID_DefaultCapture, DSDEVID_DefaultVoicePlayback, or
246 * DSDEVID_DefaultVoiceCapture.
247 * Returns pGuidSrc if pGuidSrc is a valid device or the device
248 * GUID for the specified constants.
250 HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
252 TRACE("(%s,%p)\n", get_device_id(pGuidSrc),pGuidDest);
254 if ( pGuidSrc == NULL) {
255 WARN("invalid parameter: pGuidSrc == NULL\n");
256 return DSERR_INVALIDPARAM;
259 if ( pGuidDest == NULL ) {
260 WARN("invalid parameter: pGuidDest == NULL\n");
261 return DSERR_INVALIDPARAM;
264 if ( IsEqualGUID( &DSDEVID_DefaultPlayback, pGuidSrc ) ||
265 IsEqualGUID( &DSDEVID_DefaultVoicePlayback, pGuidSrc ) ) {
266 CopyMemory(pGuidDest, &DSOUND_renderer_guids[ds_default_playback], sizeof(GUID));
267 TRACE("returns %s\n", get_device_id(pGuidDest));
271 if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) ||
272 IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) {
273 CopyMemory(pGuidDest, &DSOUND_capture_guids[ds_default_capture], sizeof(GUID));
274 TRACE("returns %s\n", get_device_id(pGuidDest));
278 CopyMemory(pGuidDest, pGuidSrc, sizeof(GUID));
279 TRACE("returns %s\n", get_device_id(pGuidDest));
285 /***************************************************************************
286 * DirectSoundEnumerateA [DSOUND.2]
288 * Enumerate all DirectSound drivers installed in the system
291 * lpDSEnumCallback [I] Address of callback function.
292 * lpContext [I] Address of user defined context passed to callback function.
296 * Failure: DSERR_INVALIDPARAM
298 HRESULT WINAPI DirectSoundEnumerateA(
299 LPDSENUMCALLBACKA lpDSEnumCallback,
307 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
308 lpDSEnumCallback, lpContext);
310 if (lpDSEnumCallback == NULL) {
311 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
312 return DSERR_INVALIDPARAM;
315 devs = waveOutGetNumDevs();
317 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
318 for (wod = 0; wod < devs; ++wod) {
319 if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod]) ) {
320 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
322 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
323 "Primary Sound Driver",desc.szDrvname,lpContext);
324 if (lpDSEnumCallback(NULL, "Primary Sound Driver", desc.szDrvname, lpContext) == FALSE)
332 for (wod = 0; wod < devs; ++wod) {
333 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
335 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
336 debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
337 if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], desc.szDesc, desc.szDrvname, lpContext) == FALSE)
344 /***************************************************************************
345 * DirectSoundEnumerateW [DSOUND.3]
347 * Enumerate all DirectSound drivers installed in the system
350 * lpDSEnumCallback [I] Address of callback function.
351 * lpContext [I] Address of user defined context passed to callback function.
355 * Failure: DSERR_INVALIDPARAM
357 HRESULT WINAPI DirectSoundEnumerateW(
358 LPDSENUMCALLBACKW lpDSEnumCallback,
365 WCHAR wDesc[MAXPNAMELEN];
366 WCHAR wName[MAXPNAMELEN];
368 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
369 lpDSEnumCallback, lpContext);
371 if (lpDSEnumCallback == NULL) {
372 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
373 return DSERR_INVALIDPARAM;
376 devs = waveOutGetNumDevs();
378 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
379 for (wod = 0; wod < devs; ++wod) {
380 if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod] ) ) {
381 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
383 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
384 "Primary Sound Driver",desc.szDrvname,lpContext);
385 MultiByteToWideChar( CP_ACP, 0, "Primary Sound Driver", -1,
386 wDesc, sizeof(wDesc)/sizeof(WCHAR) );
387 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
388 wName, sizeof(wName)/sizeof(WCHAR) );
389 if (lpDSEnumCallback(NULL, wDesc, wName, lpContext) == FALSE)
397 for (wod = 0; wod < devs; ++wod) {
398 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
400 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
401 debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
402 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1,
403 wDesc, sizeof(wDesc)/sizeof(WCHAR) );
404 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
405 wName, sizeof(wName)/sizeof(WCHAR) );
406 if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], wDesc, wName, lpContext) == FALSE)
413 /*******************************************************************************
414 * DirectSound ClassFactory
417 static HRESULT WINAPI
418 DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
419 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
421 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
422 return E_NOINTERFACE;
425 static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
427 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
428 ULONG ref = InterlockedIncrement(&(This->ref));
429 TRACE("(%p) ref was %ld\n", This, ref - 1);
433 static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
435 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
436 ULONG ref = InterlockedDecrement(&(This->ref));
437 TRACE("(%p) ref was %ld\n", This, ref + 1);
438 /* static class, won't be freed */
442 static HRESULT WINAPI DSCF_CreateInstance(
443 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
445 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
446 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
449 return CLASS_E_NOAGGREGATION;
452 WARN("invalid parameter\n");
453 return DSERR_INVALIDPARAM;
458 if ( IsEqualIID( &IID_IDirectSound, riid ) )
459 return DSOUND_Create((LPDIRECTSOUND*)ppobj,pOuter);
461 if ( IsEqualIID( &IID_IDirectSound8, riid ) )
462 return DSOUND_Create8((LPDIRECTSOUND8*)ppobj,pOuter);
464 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
465 return E_NOINTERFACE;
468 static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
469 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
470 FIXME("(%p)->(%d),stub!\n",This,dolock);
474 static const IClassFactoryVtbl DSCF_Vtbl = {
482 static IClassFactoryImpl DSOUND_CF = { &DSCF_Vtbl, 1 };
484 /*******************************************************************************
485 * DirectSoundPrivate ClassFactory
488 static HRESULT WINAPI
489 DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
490 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
492 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
493 return E_NOINTERFACE;
496 static ULONG WINAPI DSPCF_AddRef(LPCLASSFACTORY iface)
498 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
499 ULONG ref = InterlockedIncrement(&(This->ref));
500 TRACE("(%p) ref was %ld\n", This, ref - 1);
504 static ULONG WINAPI DSPCF_Release(LPCLASSFACTORY iface)
506 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
507 ULONG ref = InterlockedDecrement(&(This->ref));
508 TRACE("(%p) ref was %ld\n", This, ref + 1);
509 /* static class, won't be freed */
513 static HRESULT WINAPI
514 DSPCF_CreateInstance(
515 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
517 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
518 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
521 WARN("invalid parameter\n");
522 return DSERR_INVALIDPARAM;
527 if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
528 return IKsPrivatePropertySetImpl_Create((IKsPrivatePropertySetImpl**)ppobj);
531 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
532 return E_NOINTERFACE;
535 static HRESULT WINAPI
536 DSPCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
537 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
538 FIXME("(%p)->(%d),stub!\n",This,dolock);
542 static const IClassFactoryVtbl DSPCF_Vtbl = {
543 DSPCF_QueryInterface,
546 DSPCF_CreateInstance,
550 static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
552 /*******************************************************************************
553 * DllGetClassObject [DSOUND.@]
554 * Retrieves class object from a DLL object
557 * Docs say returns STDAPI
560 * rclsid [I] CLSID for the class object
561 * riid [I] Reference to identifier of interface for class object
562 * ppv [O] Address of variable to receive interface pointer for riid
566 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
569 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
571 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
574 WARN("invalid parameter\n");
580 if ( IsEqualCLSID( &CLSID_DirectSound, rclsid ) ||
581 IsEqualCLSID( &CLSID_DirectSound8, rclsid ) ) {
582 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
583 *ppv = (LPVOID)&DSOUND_CF;
584 IClassFactory_AddRef((IClassFactory*)*ppv);
587 WARN("(%s,%s,%p): no interface found.\n",
588 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
592 if ( IsEqualCLSID( &CLSID_DirectSoundCapture, rclsid ) ||
593 IsEqualCLSID( &CLSID_DirectSoundCapture8, rclsid ) ) {
594 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
595 *ppv = (LPVOID)&DSOUND_CAPTURE_CF;
596 IClassFactory_AddRef((IClassFactory*)*ppv);
599 WARN("(%s,%s,%p): no interface found.\n",
600 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
604 if ( IsEqualCLSID( &CLSID_DirectSoundFullDuplex, rclsid ) ) {
605 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
606 *ppv = (LPVOID)&DSOUND_FULLDUPLEX_CF;
607 IClassFactory_AddRef((IClassFactory*)*ppv);
610 WARN("(%s,%s,%p): no interface found.\n",
611 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
615 if ( IsEqualCLSID( &CLSID_DirectSoundPrivate, rclsid ) ) {
616 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
617 *ppv = (LPVOID)&DSOUND_PRIVATE_CF;
618 IClassFactory_AddRef((IClassFactory*)*ppv);
621 WARN("(%s,%s,%p): no interface found.\n",
622 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
626 WARN("(%s,%s,%p): no class found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
627 return CLASS_E_CLASSNOTAVAILABLE;
631 /*******************************************************************************
632 * DllCanUnloadNow [DSOUND.4]
633 * Determines whether the DLL is in use.
639 HRESULT WINAPI DllCanUnloadNow(void)
641 FIXME("(void): stub\n");
645 #define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
646 guid.Data1 = l; guid.Data2 = w1; guid.Data3 = w2; \
647 guid.Data4[0] = b1; guid.Data4[1] = b2; guid.Data4[2] = b3; \
648 guid.Data4[3] = b4; guid.Data4[4] = b5; guid.Data4[5] = b6; \
649 guid.Data4[6] = b7; guid.Data4[7] = b8;
651 /***********************************************************************
652 * DllMain (DSOUND.init)
654 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
657 TRACE("(%p %ld %p)\n", hInstDLL, fdwReason, lpvReserved);
660 case DLL_PROCESS_ATTACH:
661 TRACE("DLL_PROCESS_ATTACH\n");
662 for (i = 0; i < MAXWAVEDRIVERS; i++) {
663 DSOUND_renderer[i] = NULL;
664 DSOUND_capture[i] = NULL;
665 INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
666 INIT_GUID(DSOUND_capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
669 case DLL_PROCESS_DETACH:
670 TRACE("DLL_PROCESS_DETACH\n");
672 case DLL_THREAD_ATTACH:
673 TRACE("DLL_THREAD_ATTACH\n");
675 case DLL_THREAD_DETACH:
676 TRACE("DLL_THREAD_DETACH\n");
679 TRACE("UNKNOWN REASON\n");