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
40 #include "wine/port.h"
45 #include <sys/types.h>
46 #include <sys/fcntl.h>
55 #define NONAMELESSSTRUCT
56 #define NONAMELESSUNION
68 #include "wine/windef16.h"
69 #include "wine/winbase16.h"
70 #include "wine/debug.h"
73 #include "dsound_private.h"
76 WINE_DEFAULT_DEBUG_CHANNEL(dsound);
78 /* these are eligible for tuning... they must be high on slow machines... */
79 /* some stuff may get more responsive with lower values though... */
80 #define DS_EMULDRIVER 0 /* some games (Quake 2, UT) refuse to accept
81 emulated dsound devices. set to 0 ! */
82 #define DS_HEL_MARGIN 5 /* HEL only: number of waveOut fragments ahead to mix in new buffers
83 * (keep this close or equal to DS_HEL_QUEUE for best results) */
84 #define DS_HEL_QUEUE 5 /* HEL only: number of waveOut fragments ahead to queue to driver
85 * (this will affect HEL sound reliability and latency) */
87 #define DS_SND_QUEUE_MAX 28 /* max number of fragments to prebuffer */
88 #define DS_SND_QUEUE_MIN 12 /* min number of fragments to prebuffer */
90 IDirectSoundImpl* dsound = NULL;
91 GUID renderer_guids[MAXWAVEDRIVERS];
92 GUID capture_guids[MAXWAVEDRIVERS];
94 HRESULT mmErr(UINT err)
97 case MMSYSERR_NOERROR:
99 case MMSYSERR_ALLOCATED:
100 return DSERR_ALLOCATED;
102 case MMSYSERR_INVALHANDLE:
103 case WAVERR_STILLPLAYING:
104 return DSERR_GENERIC; /* FIXME */
105 case MMSYSERR_NODRIVER:
106 return DSERR_NODRIVER;
108 return DSERR_OUTOFMEMORY;
109 case MMSYSERR_INVALPARAM:
110 case WAVERR_BADFORMAT:
111 case WAVERR_UNPREPARED:
112 return DSERR_INVALIDPARAM;
113 case MMSYSERR_NOTSUPPORTED:
114 return DSERR_UNSUPPORTED;
116 FIXME("Unknown MMSYS error %d\n",err);
117 return DSERR_GENERIC;
121 int ds_emuldriver = DS_EMULDRIVER;
122 int ds_hel_margin = DS_HEL_MARGIN;
123 int ds_hel_queue = DS_HEL_QUEUE;
124 int ds_snd_queue_max = DS_SND_QUEUE_MAX;
125 int ds_snd_queue_min = DS_SND_QUEUE_MIN;
126 int ds_hw_accel = DS_HW_ACCEL_FULL;
127 int ds_default_playback = 0;
128 int ds_default_capture = 0;
131 * Get a config key from either the app-specific or the default config
134 inline static DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
135 char *buffer, DWORD size )
137 if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, buffer, &size )) return 0;
138 return RegQueryValueExA( defkey, name, 0, NULL, buffer, &size );
143 * Setup the dsound options.
146 void setup_dsound_options(void)
148 char buffer[MAX_PATH+1];
149 HKEY hkey, appkey = 0;
152 buffer[MAX_PATH]='\0';
154 if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\dsound", 0, NULL,
155 REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
157 ERR("Cannot create config registry key\n" );
161 len = GetModuleFileNameA( 0, buffer, MAX_PATH );
162 if (len && len < MAX_PATH)
166 if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\AppDefaults", &tmpkey ))
168 char appname[MAX_PATH+16];
169 char *p = strrchr( buffer, '\\' );
171 appname[MAX_PATH]='\0';
172 strncpy(appname,p+1,MAX_PATH);
173 strcat(appname,"\\dsound");
174 TRACE("appname = [%s] \n",appname);
175 if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
176 RegCloseKey( tmpkey );
183 if (!get_config_key( hkey, appkey, "EmulDriver", buffer, MAX_PATH ))
184 ds_emuldriver = strcmp(buffer, "N");
186 if (!get_config_key( hkey, appkey, "HELmargin", buffer, MAX_PATH ))
187 ds_hel_margin = atoi(buffer);
189 if (!get_config_key( hkey, appkey, "HELqueue", buffer, MAX_PATH ))
190 ds_hel_queue = atoi(buffer);
192 if (!get_config_key( hkey, appkey, "SndQueueMax", buffer, MAX_PATH ))
193 ds_snd_queue_max = atoi(buffer);
195 if (!get_config_key( hkey, appkey, "SndQueueMin", buffer, MAX_PATH ))
196 ds_snd_queue_min = atoi(buffer);
198 if (!get_config_key( hkey, appkey, "HardwareAcceleration", buffer, MAX_PATH )) {
199 if (strcmp(buffer, "Full") == 0)
200 ds_hw_accel = DS_HW_ACCEL_FULL;
201 else if (strcmp(buffer, "Standard") == 0)
202 ds_hw_accel = DS_HW_ACCEL_STANDARD;
203 else if (strcmp(buffer, "Basic") == 0)
204 ds_hw_accel = DS_HW_ACCEL_BASIC;
205 else if (strcmp(buffer, "Emulation") == 0)
206 ds_hw_accel = DS_HW_ACCEL_EMULATION;
209 if (!get_config_key( hkey, appkey, "DefaultPlayback", buffer, MAX_PATH ))
210 ds_default_playback = atoi(buffer);
212 if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH ))
213 ds_default_capture = atoi(buffer);
215 if (appkey) RegCloseKey( appkey );
218 if (ds_emuldriver != DS_EMULDRIVER )
219 WARN("ds_emuldriver = %d (default=%d)\n",ds_emuldriver, DS_EMULDRIVER);
220 if (ds_hel_margin != DS_HEL_MARGIN )
221 WARN("ds_hel_margin = %d (default=%d)\n",ds_hel_margin, DS_HEL_MARGIN );
222 if (ds_hel_queue != DS_HEL_QUEUE )
223 WARN("ds_hel_queue = %d (default=%d)\n",ds_hel_queue, DS_HEL_QUEUE );
224 if (ds_snd_queue_max != DS_SND_QUEUE_MAX)
225 WARN("ds_snd_queue_max = %d (default=%d)\n",ds_snd_queue_max ,DS_SND_QUEUE_MAX);
226 if (ds_snd_queue_min != DS_SND_QUEUE_MIN)
227 WARN("ds_snd_queue_min = %d (default=%d)\n",ds_snd_queue_min ,DS_SND_QUEUE_MIN);
228 if (ds_hw_accel != DS_HW_ACCEL_FULL)
229 WARN("ds_hw_accel = %s (default=Full)\n",
230 ds_hw_accel==DS_HW_ACCEL_FULL ? "Full" :
231 ds_hw_accel==DS_HW_ACCEL_STANDARD ? "Standard" :
232 ds_hw_accel==DS_HW_ACCEL_BASIC ? "Basic" :
233 ds_hw_accel==DS_HW_ACCEL_EMULATION ? "Emulation" :
235 if (ds_default_playback != 0)
236 WARN("ds_default_playback = %d (default=0)\n",ds_default_playback);
237 if (ds_default_capture != 0)
238 WARN("ds_default_capture = %d (default=0)\n",ds_default_playback);
241 const char * get_device_id(LPCGUID pGuid)
243 if (IsEqualGUID(&DSDEVID_DefaultPlayback, pGuid))
244 return "DSDEVID_DefaultPlayback";
245 else if (IsEqualGUID(&DSDEVID_DefaultVoicePlayback, pGuid))
246 return "DSDEVID_DefaultVoicePlayback";
247 else if (IsEqualGUID(&DSDEVID_DefaultCapture, pGuid))
248 return "DSDEVID_DefaultCapture";
249 else if (IsEqualGUID(&DSDEVID_DefaultVoiceCapture, pGuid))
250 return "DSDEVID_DefaultVoiceCapture";
251 return debugstr_guid(pGuid);
254 /***************************************************************************
255 * GetDeviceID [DSOUND.9]
257 * Retrieves unique identifier of default device specified
260 * pGuidSrc [I] Address of device GUID.
261 * pGuidDest [O] Address to receive unique device GUID.
265 * Failure: DSERR_INVALIDPARAM
268 * pGuidSrc is a valid device GUID or DSDEVID_DefaultPlayback,
269 * DSDEVID_DefaultCapture, DSDEVID_DefaultVoicePlayback, or
270 * DSDEVID_DefaultVoiceCapture.
271 * Returns pGuidSrc if pGuidSrc is a valid device or the device
272 * GUID for the specified constants.
274 HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
276 TRACE("(%s,%p)\n", get_device_id(pGuidSrc),pGuidDest);
278 if ( pGuidSrc == NULL) {
279 WARN("invalid parameter: pGuidSrc == NULL\n");
280 return DSERR_INVALIDPARAM;
283 if ( pGuidDest == NULL ) {
284 WARN("invalid parameter: pGuidDest == NULL\n");
285 return DSERR_INVALIDPARAM;
288 if ( IsEqualGUID( &DSDEVID_DefaultPlayback, pGuidSrc ) ||
289 IsEqualGUID( &DSDEVID_DefaultVoicePlayback, pGuidSrc ) ) {
290 memcpy(pGuidDest, &renderer_guids[ds_default_playback], sizeof(GUID));
291 TRACE("returns %s\n", get_device_id(pGuidDest));
295 if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) ||
296 IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) {
297 memcpy(pGuidDest, &capture_guids[ds_default_capture], sizeof(GUID));
298 TRACE("returns %s\n", get_device_id(pGuidDest));
302 memcpy(pGuidDest, pGuidSrc, sizeof(GUID));
303 TRACE("returns %s\n", get_device_id(pGuidDest));
309 /***************************************************************************
310 * DirectSoundEnumerateA [DSOUND.2]
312 * Enumerate all DirectSound drivers installed in the system
315 * lpDSEnumCallback [I] Address of callback function.
316 * lpContext [I] Address of user defined context passed to callback function.
320 * Failure: DSERR_INVALIDPARAM
322 HRESULT WINAPI DirectSoundEnumerateA(
323 LPDSENUMCALLBACKA lpDSEnumCallback,
331 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
332 lpDSEnumCallback, lpContext);
334 if (lpDSEnumCallback == NULL) {
335 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
336 return DSERR_INVALIDPARAM;
339 devs = waveOutGetNumDevs();
341 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
342 for (wod = 0; wod < devs; ++wod) {
343 if (IsEqualGUID( &guid, &renderer_guids[wod]) ) {
344 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
346 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
347 "Primary Sound Driver",desc.szDrvName,lpContext);
348 if (lpDSEnumCallback(NULL, "Primary Sound Driver", desc.szDrvName, lpContext) == FALSE)
356 for (wod = 0; wod < devs; ++wod) {
357 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
359 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
360 debugstr_guid(&renderer_guids[wod]),desc.szDesc,desc.szDrvName,lpContext);
361 if (lpDSEnumCallback(&renderer_guids[wod], desc.szDesc, desc.szDrvName, lpContext) == FALSE)
368 /***************************************************************************
369 * DirectSoundEnumerateW [DSOUND.3]
371 * Enumerate all DirectSound drivers installed in the system
374 * lpDSEnumCallback [I] Address of callback function.
375 * lpContext [I] Address of user defined context passed to callback function.
379 * Failure: DSERR_INVALIDPARAM
381 HRESULT WINAPI DirectSoundEnumerateW(
382 LPDSENUMCALLBACKW lpDSEnumCallback,
389 WCHAR wDesc[MAXPNAMELEN];
390 WCHAR wName[MAXPNAMELEN];
392 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
393 lpDSEnumCallback, lpContext);
395 if (lpDSEnumCallback == NULL) {
396 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
397 return DSERR_INVALIDPARAM;
400 devs = waveOutGetNumDevs();
402 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
403 for (wod = 0; wod < devs; ++wod) {
404 if (IsEqualGUID( &guid, &renderer_guids[wod] ) ) {
405 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
407 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
408 "Primary Sound Driver",desc.szDrvName,lpContext);
409 MultiByteToWideChar( CP_ACP, 0, "Primary Sound Driver", -1,
410 wDesc, sizeof(wDesc)/sizeof(WCHAR) );
411 MultiByteToWideChar( CP_ACP, 0, desc.szDrvName, -1,
412 wName, sizeof(wName)/sizeof(WCHAR) );
413 if (lpDSEnumCallback(NULL, wDesc, wName, lpContext) == FALSE)
421 for (wod = 0; wod < devs; ++wod) {
422 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
424 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
425 debugstr_guid(&renderer_guids[wod]),desc.szDesc,desc.szDrvName,lpContext);
426 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1,
427 wDesc, sizeof(wDesc)/sizeof(WCHAR) );
428 MultiByteToWideChar( CP_ACP, 0, desc.szDrvName, -1,
429 wName, sizeof(wName)/sizeof(WCHAR) );
430 if (lpDSEnumCallback(&renderer_guids[wod], wDesc, wName, lpContext) == FALSE)
437 /*******************************************************************************
438 * DirectSound ClassFactory
441 static HRESULT WINAPI
442 DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
443 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
445 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
446 return E_NOINTERFACE;
450 DSCF_AddRef(LPCLASSFACTORY iface) {
451 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
452 TRACE("(%p) ref was %ld\n", This, This->ref);
453 return InterlockedIncrement(&(This->ref));
456 static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) {
457 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
458 /* static class, won't be freed */
459 TRACE("(%p) ref was %ld\n", This, This->ref);
460 return InterlockedDecrement(&(This->ref));
463 static HRESULT WINAPI DSCF_CreateInstance(
464 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
466 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
467 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
470 return CLASS_E_NOAGGREGATION;
473 WARN("invalid parameter\n");
474 return DSERR_INVALIDPARAM;
479 if ( IsEqualIID( &IID_IDirectSound, riid ) )
480 return DSOUND_Create(0,(LPDIRECTSOUND*)ppobj,pOuter);
482 if ( IsEqualIID( &IID_IDirectSound8, riid ) )
483 return DSOUND_Create8(0,(LPDIRECTSOUND8*)ppobj,pOuter);
485 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
486 return E_NOINTERFACE;
489 static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
490 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
491 FIXME("(%p)->(%d),stub!\n",This,dolock);
495 static IClassFactoryVtbl DSCF_Vtbl = {
503 static IClassFactoryImpl DSOUND_CF = { &DSCF_Vtbl, 1 };
505 /*******************************************************************************
506 * DirectSoundPrivate ClassFactory
509 static HRESULT WINAPI
510 DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
511 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
513 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
514 return E_NOINTERFACE;
518 DSPCF_AddRef(LPCLASSFACTORY iface) {
519 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
520 TRACE("(%p) ref was %ld\n", This, This->ref);
521 return InterlockedIncrement(&(This->ref));
525 DSPCF_Release(LPCLASSFACTORY iface) {
526 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
527 /* static class, won't be freed */
528 TRACE("(%p) ref was %ld\n", This, This->ref);
529 return InterlockedDecrement(&(This->ref));
532 static HRESULT WINAPI
533 DSPCF_CreateInstance(
534 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
536 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
537 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
540 WARN("invalid parameter\n");
541 return DSERR_INVALIDPARAM;
546 if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
547 return IKsPrivatePropertySetImpl_Create((IKsPrivatePropertySetImpl**)ppobj);
550 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
551 return E_NOINTERFACE;
554 static HRESULT WINAPI
555 DSPCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
556 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
557 FIXME("(%p)->(%d),stub!\n",This,dolock);
561 static IClassFactoryVtbl DSPCF_Vtbl = {
562 DSPCF_QueryInterface,
565 DSPCF_CreateInstance,
569 static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
571 /*******************************************************************************
572 * DllGetClassObject [DSOUND.5]
573 * Retrieves class object from a DLL object
576 * Docs say returns STDAPI
579 * rclsid [I] CLSID for the class object
580 * riid [I] Reference to identifier of interface for class object
581 * ppv [O] Address of variable to receive interface pointer for riid
585 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
588 DWORD WINAPI DSOUND_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
590 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
593 WARN("invalid parameter\n");
599 if ( IsEqualCLSID( &CLSID_DirectSound, rclsid ) ||
600 IsEqualCLSID( &CLSID_DirectSound8, rclsid ) ) {
601 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
602 *ppv = (LPVOID)&DSOUND_CF;
603 IClassFactory_AddRef((IClassFactory*)*ppv);
606 WARN("(%s,%s,%p): no interface found.\n",
607 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
611 if ( IsEqualCLSID( &CLSID_DirectSoundCapture, rclsid ) ||
612 IsEqualCLSID( &CLSID_DirectSoundCapture8, rclsid ) ) {
613 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
614 *ppv = (LPVOID)&DSOUND_CAPTURE_CF;
615 IClassFactory_AddRef((IClassFactory*)*ppv);
618 WARN("(%s,%s,%p): no interface found.\n",
619 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
623 if ( IsEqualCLSID( &CLSID_DirectSoundFullDuplex, rclsid ) ) {
624 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
625 *ppv = (LPVOID)&DSOUND_FULLDUPLEX_CF;
626 IClassFactory_AddRef((IClassFactory*)*ppv);
629 WARN("(%s,%s,%p): no interface found.\n",
630 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
634 if ( IsEqualCLSID( &CLSID_DirectSoundPrivate, rclsid ) ) {
635 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
636 *ppv = (LPVOID)&DSOUND_PRIVATE_CF;
637 IClassFactory_AddRef((IClassFactory*)*ppv);
640 WARN("(%s,%s,%p): no interface found.\n",
641 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
645 WARN("(%s,%s,%p): no class found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
646 return CLASS_E_CLASSNOTAVAILABLE;
650 /*******************************************************************************
651 * DllCanUnloadNow [DSOUND.4]
652 * Determines whether the DLL is in use.
658 DWORD WINAPI DSOUND_DllCanUnloadNow(void)
660 FIXME("(void): stub\n");
664 #define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
665 guid.Data1 = l; guid.Data2 = w1; guid.Data3 = w2; \
666 guid.Data4[0] = b1; guid.Data4[1] = b2; guid.Data4[2] = b3; \
667 guid.Data4[3] = b4; guid.Data4[4] = b5; guid.Data4[5] = b6; \
668 guid.Data4[6] = b7; guid.Data4[7] = b8;
670 /***********************************************************************
671 * DllMain (DSOUND.init)
673 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
676 TRACE("(%p 0x%lx %p)\n", hInstDLL, fdwReason, lpvReserved);
679 case DLL_PROCESS_ATTACH:
680 TRACE("DLL_PROCESS_ATTACH\n");
681 for (i = 0; i < MAXWAVEDRIVERS; i++) {
682 INIT_GUID(renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
683 INIT_GUID(capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
686 case DLL_PROCESS_DETACH:
687 TRACE("DLL_PROCESS_DETACH\n");
689 case DLL_THREAD_ATTACH:
690 TRACE("DLL_THREAD_ATTACH\n");
692 case DLL_THREAD_DETACH:
693 TRACE("DLL_THREAD_DETACH\n");
696 TRACE("UNKNOWN REASON\n");