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
51 #include "wine/debug.h"
54 #include "dsound_private.h"
57 WINE_DEFAULT_DEBUG_CHANNEL(dsound);
59 /* these are eligible for tuning... they must be high on slow machines... */
60 /* some stuff may get more responsive with lower values though... */
61 #define DS_EMULDRIVER 0 /* some games (Quake 2, UT) refuse to accept
62 emulated dsound devices. set to 0 ! */
63 #define DS_HEL_MARGIN 5 /* HEL only: number of waveOut fragments ahead to mix in new buffers
64 * (keep this close or equal to DS_HEL_QUEUE for best results) */
65 #define DS_HEL_QUEUE 5 /* HEL only: number of waveOut fragments ahead to queue to driver
66 * (this will affect HEL sound reliability and latency) */
68 #define DS_SND_QUEUE_MAX 28 /* max number of fragments to prebuffer */
69 #define DS_SND_QUEUE_MIN 12 /* min number of fragments to prebuffer */
71 DirectSoundDevice* DSOUND_renderer[MAXWAVEDRIVERS];
72 GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
73 GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
75 HRESULT mmErr(UINT err)
78 case MMSYSERR_NOERROR:
80 case MMSYSERR_ALLOCATED:
81 return DSERR_ALLOCATED;
83 case MMSYSERR_INVALHANDLE:
84 case WAVERR_STILLPLAYING:
85 return DSERR_GENERIC; /* FIXME */
86 case MMSYSERR_NODRIVER:
87 return DSERR_NODRIVER;
89 return DSERR_OUTOFMEMORY;
90 case MMSYSERR_INVALPARAM:
91 case WAVERR_BADFORMAT:
92 case WAVERR_UNPREPARED:
93 return DSERR_INVALIDPARAM;
94 case MMSYSERR_NOTSUPPORTED:
95 return DSERR_UNSUPPORTED;
97 FIXME("Unknown MMSYS error %d\n",err);
102 int ds_emuldriver = DS_EMULDRIVER;
103 int ds_hel_margin = DS_HEL_MARGIN;
104 int ds_hel_queue = DS_HEL_QUEUE;
105 int ds_snd_queue_max = DS_SND_QUEUE_MAX;
106 int ds_snd_queue_min = DS_SND_QUEUE_MIN;
107 int ds_hw_accel = DS_HW_ACCEL_FULL;
108 int ds_default_playback = 0;
109 int ds_default_capture = 0;
112 * Get a config key from either the app-specific or the default config
115 inline static DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
116 char *buffer, DWORD size )
118 if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size )) return 0;
119 if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size )) return 0;
120 return ERROR_FILE_NOT_FOUND;
125 * Setup the dsound options.
128 void setup_dsound_options(void)
130 char buffer[MAX_PATH+16];
131 HKEY hkey, appkey = 0;
134 buffer[MAX_PATH]='\0';
136 /* @@ Wine registry key: HKCU\Software\Wine\DirectSound */
137 if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\DirectSound", &hkey )) hkey = 0;
139 len = GetModuleFileNameA( 0, buffer, MAX_PATH );
140 if (len && len < MAX_PATH)
143 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectSound */
144 if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey ))
146 char *p, *appname = buffer;
147 if ((p = strrchr( appname, '/' ))) appname = p + 1;
148 if ((p = strrchr( appname, '\\' ))) appname = p + 1;
149 strcat( appname, "\\DirectSound" );
150 TRACE("appname = [%s] \n",appname);
151 if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
152 RegCloseKey( tmpkey );
158 if (!get_config_key( hkey, appkey, "EmulDriver", buffer, MAX_PATH ))
159 ds_emuldriver = strcmp(buffer, "N");
161 if (!get_config_key( hkey, appkey, "HELmargin", buffer, MAX_PATH ))
162 ds_hel_margin = atoi(buffer);
164 if (!get_config_key( hkey, appkey, "HELqueue", buffer, MAX_PATH ))
165 ds_hel_queue = atoi(buffer);
167 if (!get_config_key( hkey, appkey, "SndQueueMax", buffer, MAX_PATH ))
168 ds_snd_queue_max = atoi(buffer);
170 if (!get_config_key( hkey, appkey, "SndQueueMin", buffer, MAX_PATH ))
171 ds_snd_queue_min = atoi(buffer);
173 if (!get_config_key( hkey, appkey, "HardwareAcceleration", buffer, MAX_PATH )) {
174 if (strcmp(buffer, "Full") == 0)
175 ds_hw_accel = DS_HW_ACCEL_FULL;
176 else if (strcmp(buffer, "Standard") == 0)
177 ds_hw_accel = DS_HW_ACCEL_STANDARD;
178 else if (strcmp(buffer, "Basic") == 0)
179 ds_hw_accel = DS_HW_ACCEL_BASIC;
180 else if (strcmp(buffer, "Emulation") == 0)
181 ds_hw_accel = DS_HW_ACCEL_EMULATION;
184 if (!get_config_key( hkey, appkey, "DefaultPlayback", buffer, MAX_PATH ))
185 ds_default_playback = atoi(buffer);
187 if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH ))
188 ds_default_capture = atoi(buffer);
190 if (appkey) RegCloseKey( appkey );
191 if (hkey) RegCloseKey( hkey );
193 if (ds_emuldriver != DS_EMULDRIVER )
194 WARN("ds_emuldriver = %d (default=%d)\n",ds_emuldriver, DS_EMULDRIVER);
195 if (ds_hel_margin != DS_HEL_MARGIN )
196 WARN("ds_hel_margin = %d (default=%d)\n",ds_hel_margin, DS_HEL_MARGIN );
197 if (ds_hel_queue != DS_HEL_QUEUE )
198 WARN("ds_hel_queue = %d (default=%d)\n",ds_hel_queue, DS_HEL_QUEUE );
199 if (ds_snd_queue_max != DS_SND_QUEUE_MAX)
200 WARN("ds_snd_queue_max = %d (default=%d)\n",ds_snd_queue_max ,DS_SND_QUEUE_MAX);
201 if (ds_snd_queue_min != DS_SND_QUEUE_MIN)
202 WARN("ds_snd_queue_min = %d (default=%d)\n",ds_snd_queue_min ,DS_SND_QUEUE_MIN);
203 if (ds_hw_accel != DS_HW_ACCEL_FULL)
204 WARN("ds_hw_accel = %s (default=Full)\n",
205 ds_hw_accel==DS_HW_ACCEL_FULL ? "Full" :
206 ds_hw_accel==DS_HW_ACCEL_STANDARD ? "Standard" :
207 ds_hw_accel==DS_HW_ACCEL_BASIC ? "Basic" :
208 ds_hw_accel==DS_HW_ACCEL_EMULATION ? "Emulation" :
210 if (ds_default_playback != 0)
211 WARN("ds_default_playback = %d (default=0)\n",ds_default_playback);
212 if (ds_default_capture != 0)
213 WARN("ds_default_capture = %d (default=0)\n",ds_default_playback);
216 const char * get_device_id(LPCGUID pGuid)
218 if (IsEqualGUID(&DSDEVID_DefaultPlayback, pGuid))
219 return "DSDEVID_DefaultPlayback";
220 else if (IsEqualGUID(&DSDEVID_DefaultVoicePlayback, pGuid))
221 return "DSDEVID_DefaultVoicePlayback";
222 else if (IsEqualGUID(&DSDEVID_DefaultCapture, pGuid))
223 return "DSDEVID_DefaultCapture";
224 else if (IsEqualGUID(&DSDEVID_DefaultVoiceCapture, pGuid))
225 return "DSDEVID_DefaultVoiceCapture";
226 return debugstr_guid(pGuid);
229 /***************************************************************************
230 * GetDeviceID [DSOUND.9]
232 * Retrieves unique identifier of default device specified
235 * pGuidSrc [I] Address of device GUID.
236 * pGuidDest [O] Address to receive unique device GUID.
240 * Failure: DSERR_INVALIDPARAM
243 * pGuidSrc is a valid device GUID or DSDEVID_DefaultPlayback,
244 * DSDEVID_DefaultCapture, DSDEVID_DefaultVoicePlayback, or
245 * DSDEVID_DefaultVoiceCapture.
246 * Returns pGuidSrc if pGuidSrc is a valid device or the device
247 * GUID for the specified constants.
249 HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
251 TRACE("(%s,%p)\n", get_device_id(pGuidSrc),pGuidDest);
253 if ( pGuidSrc == NULL) {
254 WARN("invalid parameter: pGuidSrc == NULL\n");
255 return DSERR_INVALIDPARAM;
258 if ( pGuidDest == NULL ) {
259 WARN("invalid parameter: pGuidDest == NULL\n");
260 return DSERR_INVALIDPARAM;
263 if ( IsEqualGUID( &DSDEVID_DefaultPlayback, pGuidSrc ) ||
264 IsEqualGUID( &DSDEVID_DefaultVoicePlayback, pGuidSrc ) ) {
265 CopyMemory(pGuidDest, &DSOUND_renderer_guids[ds_default_playback], sizeof(GUID));
266 TRACE("returns %s\n", get_device_id(pGuidDest));
270 if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) ||
271 IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) {
272 CopyMemory(pGuidDest, &DSOUND_capture_guids[ds_default_capture], sizeof(GUID));
273 TRACE("returns %s\n", get_device_id(pGuidDest));
277 CopyMemory(pGuidDest, pGuidSrc, sizeof(GUID));
278 TRACE("returns %s\n", get_device_id(pGuidDest));
284 /***************************************************************************
285 * DirectSoundEnumerateA [DSOUND.2]
287 * Enumerate all DirectSound drivers installed in the system
290 * lpDSEnumCallback [I] Address of callback function.
291 * lpContext [I] Address of user defined context passed to callback function.
295 * Failure: DSERR_INVALIDPARAM
297 HRESULT WINAPI DirectSoundEnumerateA(
298 LPDSENUMCALLBACKA lpDSEnumCallback,
306 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
307 lpDSEnumCallback, lpContext);
309 if (lpDSEnumCallback == NULL) {
310 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
311 return DSERR_INVALIDPARAM;
314 devs = waveOutGetNumDevs();
316 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
317 for (wod = 0; wod < devs; ++wod) {
318 if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod]) ) {
319 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
321 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
322 "Primary Sound Driver",desc.szDrvname,lpContext);
323 if (lpDSEnumCallback(NULL, "Primary Sound Driver", desc.szDrvname, lpContext) == FALSE)
331 for (wod = 0; wod < devs; ++wod) {
332 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
334 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
335 debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
336 if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], desc.szDesc, desc.szDrvname, lpContext) == FALSE)
343 /***************************************************************************
344 * DirectSoundEnumerateW [DSOUND.3]
346 * Enumerate all DirectSound drivers installed in the system
349 * lpDSEnumCallback [I] Address of callback function.
350 * lpContext [I] Address of user defined context passed to callback function.
354 * Failure: DSERR_INVALIDPARAM
356 HRESULT WINAPI DirectSoundEnumerateW(
357 LPDSENUMCALLBACKW lpDSEnumCallback,
364 WCHAR wDesc[MAXPNAMELEN];
365 WCHAR wName[MAXPNAMELEN];
367 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
368 lpDSEnumCallback, lpContext);
370 if (lpDSEnumCallback == NULL) {
371 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
372 return DSERR_INVALIDPARAM;
375 devs = waveOutGetNumDevs();
377 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
378 for (wod = 0; wod < devs; ++wod) {
379 if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod] ) ) {
380 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
382 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
383 "Primary Sound Driver",desc.szDrvname,lpContext);
384 MultiByteToWideChar( CP_ACP, 0, "Primary Sound Driver", -1,
385 wDesc, sizeof(wDesc)/sizeof(WCHAR) );
386 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
387 wName, sizeof(wName)/sizeof(WCHAR) );
388 if (lpDSEnumCallback(NULL, wDesc, wName, lpContext) == FALSE)
396 for (wod = 0; wod < devs; ++wod) {
397 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
399 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
400 debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
401 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1,
402 wDesc, sizeof(wDesc)/sizeof(WCHAR) );
403 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
404 wName, sizeof(wName)/sizeof(WCHAR) );
405 if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], wDesc, wName, lpContext) == FALSE)
412 /*******************************************************************************
413 * DirectSound ClassFactory
416 static HRESULT WINAPI
417 DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
418 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
420 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
421 return E_NOINTERFACE;
424 static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
426 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
427 ULONG ref = InterlockedIncrement(&(This->ref));
428 TRACE("(%p) ref was %ld\n", This, ref - 1);
432 static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
434 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
435 ULONG ref = InterlockedDecrement(&(This->ref));
436 TRACE("(%p) ref was %ld\n", This, ref + 1);
437 /* static class, won't be freed */
441 static HRESULT WINAPI DSCF_CreateInstance(
442 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
444 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
445 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
448 return CLASS_E_NOAGGREGATION;
451 WARN("invalid parameter\n");
452 return DSERR_INVALIDPARAM;
457 if ( IsEqualIID( &IID_IDirectSound, riid ) )
458 return DSOUND_Create((LPDIRECTSOUND*)ppobj,pOuter);
460 if ( IsEqualIID( &IID_IDirectSound8, riid ) )
461 return DSOUND_Create8((LPDIRECTSOUND8*)ppobj,pOuter);
463 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
464 return E_NOINTERFACE;
467 static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
468 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
469 FIXME("(%p)->(%d),stub!\n",This,dolock);
473 static const IClassFactoryVtbl DSCF_Vtbl = {
481 static IClassFactoryImpl DSOUND_CF = { &DSCF_Vtbl, 1 };
483 /*******************************************************************************
484 * DirectSoundPrivate ClassFactory
487 static HRESULT WINAPI
488 DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
489 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
491 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
492 return E_NOINTERFACE;
495 static ULONG WINAPI DSPCF_AddRef(LPCLASSFACTORY iface)
497 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
498 ULONG ref = InterlockedIncrement(&(This->ref));
499 TRACE("(%p) ref was %ld\n", This, ref - 1);
503 static ULONG WINAPI DSPCF_Release(LPCLASSFACTORY iface)
505 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
506 ULONG ref = InterlockedDecrement(&(This->ref));
507 TRACE("(%p) ref was %ld\n", This, ref + 1);
508 /* static class, won't be freed */
512 static HRESULT WINAPI
513 DSPCF_CreateInstance(
514 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
516 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
517 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
520 WARN("invalid parameter\n");
521 return DSERR_INVALIDPARAM;
526 if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
527 return IKsPrivatePropertySetImpl_Create((IKsPrivatePropertySetImpl**)ppobj);
530 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
531 return E_NOINTERFACE;
534 static HRESULT WINAPI
535 DSPCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
536 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
537 FIXME("(%p)->(%d),stub!\n",This,dolock);
541 static const IClassFactoryVtbl DSPCF_Vtbl = {
542 DSPCF_QueryInterface,
545 DSPCF_CreateInstance,
549 static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
551 /*******************************************************************************
552 * DllGetClassObject [DSOUND.@]
553 * Retrieves class object from a DLL object
556 * Docs say returns STDAPI
559 * rclsid [I] CLSID for the class object
560 * riid [I] Reference to identifier of interface for class object
561 * ppv [O] Address of variable to receive interface pointer for riid
565 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
568 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
570 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
573 WARN("invalid parameter\n");
579 if ( IsEqualCLSID( &CLSID_DirectSound, rclsid ) ||
580 IsEqualCLSID( &CLSID_DirectSound8, rclsid ) ) {
581 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
582 *ppv = (LPVOID)&DSOUND_CF;
583 IClassFactory_AddRef((IClassFactory*)*ppv);
586 WARN("(%s,%s,%p): no interface found.\n",
587 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
591 if ( IsEqualCLSID( &CLSID_DirectSoundCapture, rclsid ) ||
592 IsEqualCLSID( &CLSID_DirectSoundCapture8, rclsid ) ) {
593 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
594 *ppv = (LPVOID)&DSOUND_CAPTURE_CF;
595 IClassFactory_AddRef((IClassFactory*)*ppv);
598 WARN("(%s,%s,%p): no interface found.\n",
599 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
603 if ( IsEqualCLSID( &CLSID_DirectSoundFullDuplex, rclsid ) ) {
604 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
605 *ppv = (LPVOID)&DSOUND_FULLDUPLEX_CF;
606 IClassFactory_AddRef((IClassFactory*)*ppv);
609 WARN("(%s,%s,%p): no interface found.\n",
610 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
614 if ( IsEqualCLSID( &CLSID_DirectSoundPrivate, rclsid ) ) {
615 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
616 *ppv = (LPVOID)&DSOUND_PRIVATE_CF;
617 IClassFactory_AddRef((IClassFactory*)*ppv);
620 WARN("(%s,%s,%p): no interface found.\n",
621 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
625 WARN("(%s,%s,%p): no class found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
626 return CLASS_E_CLASSNOTAVAILABLE;
630 /*******************************************************************************
631 * DllCanUnloadNow [DSOUND.4]
632 * Determines whether the DLL is in use.
638 HRESULT WINAPI DllCanUnloadNow(void)
640 FIXME("(void): stub\n");
644 #define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
645 guid.Data1 = l; guid.Data2 = w1; guid.Data3 = w2; \
646 guid.Data4[0] = b1; guid.Data4[1] = b2; guid.Data4[2] = b3; \
647 guid.Data4[3] = b4; guid.Data4[4] = b5; guid.Data4[5] = b6; \
648 guid.Data4[6] = b7; guid.Data4[7] = b8;
650 /***********************************************************************
651 * DllMain (DSOUND.init)
653 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
656 TRACE("(%p 0x%lx %p)\n", hInstDLL, fdwReason, lpvReserved);
659 case DLL_PROCESS_ATTACH:
660 TRACE("DLL_PROCESS_ATTACH\n");
661 for (i = 0; i < MAXWAVEDRIVERS; i++) {
662 DSOUND_renderer[i] = NULL;
663 DSOUND_capture[i] = NULL;
664 INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
665 INIT_GUID(DSOUND_capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
668 case DLL_PROCESS_DETACH:
669 TRACE("DLL_PROCESS_DETACH\n");
671 case DLL_THREAD_ATTACH:
672 TRACE("DLL_THREAD_ATTACH\n");
674 case DLL_THREAD_DETACH:
675 TRACE("DLL_THREAD_DETACH\n");
678 TRACE("UNKNOWN REASON\n");