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, buffer, &size )) return 0;
119 return RegQueryValueExA( defkey, name, 0, NULL, buffer, &size );
124 * Setup the dsound options.
127 void setup_dsound_options(void)
129 char buffer[MAX_PATH+1];
130 HKEY hkey, appkey = 0;
133 buffer[MAX_PATH]='\0';
135 if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\dsound", 0, NULL,
136 REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
138 ERR("Cannot create config registry key\n" );
142 len = GetModuleFileNameA( 0, buffer, MAX_PATH );
143 if (len && len < MAX_PATH)
147 if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\AppDefaults", &tmpkey ))
149 char appname[MAX_PATH+16];
150 char *p = strrchr( buffer, '\\' );
152 lstrcpynA(appname,p+1,MAX_PATH);
153 strcat(appname,"\\dsound");
154 TRACE("appname = [%s] \n",appname);
155 if (RegOpenKeyA( tmpkey, appname, &appkey ))
157 RegCloseKey( tmpkey );
164 if (!get_config_key( hkey, appkey, "EmulDriver", buffer, MAX_PATH ))
165 ds_emuldriver = strcmp(buffer, "N");
167 if (!get_config_key( hkey, appkey, "HELmargin", buffer, MAX_PATH ))
168 ds_hel_margin = atoi(buffer);
170 if (!get_config_key( hkey, appkey, "HELqueue", buffer, MAX_PATH ))
171 ds_hel_queue = atoi(buffer);
173 if (!get_config_key( hkey, appkey, "SndQueueMax", buffer, MAX_PATH ))
174 ds_snd_queue_max = atoi(buffer);
176 if (!get_config_key( hkey, appkey, "SndQueueMin", buffer, MAX_PATH ))
177 ds_snd_queue_min = atoi(buffer);
179 if (!get_config_key( hkey, appkey, "HardwareAcceleration", buffer, MAX_PATH )) {
180 if (strcmp(buffer, "Full") == 0)
181 ds_hw_accel = DS_HW_ACCEL_FULL;
182 else if (strcmp(buffer, "Standard") == 0)
183 ds_hw_accel = DS_HW_ACCEL_STANDARD;
184 else if (strcmp(buffer, "Basic") == 0)
185 ds_hw_accel = DS_HW_ACCEL_BASIC;
186 else if (strcmp(buffer, "Emulation") == 0)
187 ds_hw_accel = DS_HW_ACCEL_EMULATION;
190 if (!get_config_key( hkey, appkey, "DefaultPlayback", buffer, MAX_PATH ))
191 ds_default_playback = atoi(buffer);
193 if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH ))
194 ds_default_capture = atoi(buffer);
196 if (appkey) RegCloseKey( appkey );
199 if (ds_emuldriver != DS_EMULDRIVER )
200 WARN("ds_emuldriver = %d (default=%d)\n",ds_emuldriver, DS_EMULDRIVER);
201 if (ds_hel_margin != DS_HEL_MARGIN )
202 WARN("ds_hel_margin = %d (default=%d)\n",ds_hel_margin, DS_HEL_MARGIN );
203 if (ds_hel_queue != DS_HEL_QUEUE )
204 WARN("ds_hel_queue = %d (default=%d)\n",ds_hel_queue, DS_HEL_QUEUE );
205 if (ds_snd_queue_max != DS_SND_QUEUE_MAX)
206 WARN("ds_snd_queue_max = %d (default=%d)\n",ds_snd_queue_max ,DS_SND_QUEUE_MAX);
207 if (ds_snd_queue_min != DS_SND_QUEUE_MIN)
208 WARN("ds_snd_queue_min = %d (default=%d)\n",ds_snd_queue_min ,DS_SND_QUEUE_MIN);
209 if (ds_hw_accel != DS_HW_ACCEL_FULL)
210 WARN("ds_hw_accel = %s (default=Full)\n",
211 ds_hw_accel==DS_HW_ACCEL_FULL ? "Full" :
212 ds_hw_accel==DS_HW_ACCEL_STANDARD ? "Standard" :
213 ds_hw_accel==DS_HW_ACCEL_BASIC ? "Basic" :
214 ds_hw_accel==DS_HW_ACCEL_EMULATION ? "Emulation" :
216 if (ds_default_playback != 0)
217 WARN("ds_default_playback = %d (default=0)\n",ds_default_playback);
218 if (ds_default_capture != 0)
219 WARN("ds_default_capture = %d (default=0)\n",ds_default_playback);
222 const char * get_device_id(LPCGUID pGuid)
224 if (IsEqualGUID(&DSDEVID_DefaultPlayback, pGuid))
225 return "DSDEVID_DefaultPlayback";
226 else if (IsEqualGUID(&DSDEVID_DefaultVoicePlayback, pGuid))
227 return "DSDEVID_DefaultVoicePlayback";
228 else if (IsEqualGUID(&DSDEVID_DefaultCapture, pGuid))
229 return "DSDEVID_DefaultCapture";
230 else if (IsEqualGUID(&DSDEVID_DefaultVoiceCapture, pGuid))
231 return "DSDEVID_DefaultVoiceCapture";
232 return debugstr_guid(pGuid);
235 /***************************************************************************
236 * GetDeviceID [DSOUND.9]
238 * Retrieves unique identifier of default device specified
241 * pGuidSrc [I] Address of device GUID.
242 * pGuidDest [O] Address to receive unique device GUID.
246 * Failure: DSERR_INVALIDPARAM
249 * pGuidSrc is a valid device GUID or DSDEVID_DefaultPlayback,
250 * DSDEVID_DefaultCapture, DSDEVID_DefaultVoicePlayback, or
251 * DSDEVID_DefaultVoiceCapture.
252 * Returns pGuidSrc if pGuidSrc is a valid device or the device
253 * GUID for the specified constants.
255 HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
257 TRACE("(%s,%p)\n", get_device_id(pGuidSrc),pGuidDest);
259 if ( pGuidSrc == NULL) {
260 WARN("invalid parameter: pGuidSrc == NULL\n");
261 return DSERR_INVALIDPARAM;
264 if ( pGuidDest == NULL ) {
265 WARN("invalid parameter: pGuidDest == NULL\n");
266 return DSERR_INVALIDPARAM;
269 if ( IsEqualGUID( &DSDEVID_DefaultPlayback, pGuidSrc ) ||
270 IsEqualGUID( &DSDEVID_DefaultVoicePlayback, pGuidSrc ) ) {
271 CopyMemory(pGuidDest, &DSOUND_renderer_guids[ds_default_playback], sizeof(GUID));
272 TRACE("returns %s\n", get_device_id(pGuidDest));
276 if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) ||
277 IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) {
278 CopyMemory(pGuidDest, &DSOUND_capture_guids[ds_default_capture], sizeof(GUID));
279 TRACE("returns %s\n", get_device_id(pGuidDest));
283 CopyMemory(pGuidDest, pGuidSrc, sizeof(GUID));
284 TRACE("returns %s\n", get_device_id(pGuidDest));
290 /***************************************************************************
291 * DirectSoundEnumerateA [DSOUND.2]
293 * Enumerate all DirectSound drivers installed in the system
296 * lpDSEnumCallback [I] Address of callback function.
297 * lpContext [I] Address of user defined context passed to callback function.
301 * Failure: DSERR_INVALIDPARAM
303 HRESULT WINAPI DirectSoundEnumerateA(
304 LPDSENUMCALLBACKA lpDSEnumCallback,
312 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
313 lpDSEnumCallback, lpContext);
315 if (lpDSEnumCallback == NULL) {
316 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
317 return DSERR_INVALIDPARAM;
320 devs = waveOutGetNumDevs();
322 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
323 for (wod = 0; wod < devs; ++wod) {
324 if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod]) ) {
325 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
327 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
328 "Primary Sound Driver",desc.szDrvname,lpContext);
329 if (lpDSEnumCallback(NULL, "Primary Sound Driver", desc.szDrvname, lpContext) == FALSE)
337 for (wod = 0; wod < devs; ++wod) {
338 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
340 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
341 debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
342 if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], desc.szDesc, desc.szDrvname, lpContext) == FALSE)
349 /***************************************************************************
350 * DirectSoundEnumerateW [DSOUND.3]
352 * Enumerate all DirectSound drivers installed in the system
355 * lpDSEnumCallback [I] Address of callback function.
356 * lpContext [I] Address of user defined context passed to callback function.
360 * Failure: DSERR_INVALIDPARAM
362 HRESULT WINAPI DirectSoundEnumerateW(
363 LPDSENUMCALLBACKW lpDSEnumCallback,
370 WCHAR wDesc[MAXPNAMELEN];
371 WCHAR wName[MAXPNAMELEN];
373 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
374 lpDSEnumCallback, lpContext);
376 if (lpDSEnumCallback == NULL) {
377 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
378 return DSERR_INVALIDPARAM;
381 devs = waveOutGetNumDevs();
383 if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
384 for (wod = 0; wod < devs; ++wod) {
385 if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod] ) ) {
386 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
388 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
389 "Primary Sound Driver",desc.szDrvname,lpContext);
390 MultiByteToWideChar( CP_ACP, 0, "Primary Sound Driver", -1,
391 wDesc, sizeof(wDesc)/sizeof(WCHAR) );
392 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
393 wName, sizeof(wName)/sizeof(WCHAR) );
394 if (lpDSEnumCallback(NULL, wDesc, wName, lpContext) == FALSE)
402 for (wod = 0; wod < devs; ++wod) {
403 err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
405 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
406 debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
407 MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1,
408 wDesc, sizeof(wDesc)/sizeof(WCHAR) );
409 MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
410 wName, sizeof(wName)/sizeof(WCHAR) );
411 if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], wDesc, wName, lpContext) == FALSE)
418 /*******************************************************************************
419 * DirectSound ClassFactory
422 static HRESULT WINAPI
423 DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
424 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
426 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
427 return E_NOINTERFACE;
430 static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
432 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
433 ULONG ref = InterlockedIncrement(&(This->ref));
434 TRACE("(%p) ref was %ld\n", This, ref - 1);
438 static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
440 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
441 ULONG ref = InterlockedDecrement(&(This->ref));
442 TRACE("(%p) ref was %ld\n", This, ref + 1);
443 /* static class, won't be freed */
447 static HRESULT WINAPI DSCF_CreateInstance(
448 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
450 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
451 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
454 return CLASS_E_NOAGGREGATION;
457 WARN("invalid parameter\n");
458 return DSERR_INVALIDPARAM;
463 if ( IsEqualIID( &IID_IDirectSound, riid ) )
464 return DSOUND_Create((LPDIRECTSOUND*)ppobj,pOuter);
466 if ( IsEqualIID( &IID_IDirectSound8, riid ) )
467 return DSOUND_Create8((LPDIRECTSOUND8*)ppobj,pOuter);
469 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
470 return E_NOINTERFACE;
473 static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
474 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
475 FIXME("(%p)->(%d),stub!\n",This,dolock);
479 static const IClassFactoryVtbl DSCF_Vtbl = {
487 static IClassFactoryImpl DSOUND_CF = { &DSCF_Vtbl, 1 };
489 /*******************************************************************************
490 * DirectSoundPrivate ClassFactory
493 static HRESULT WINAPI
494 DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
495 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
497 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
498 return E_NOINTERFACE;
501 static ULONG WINAPI DSPCF_AddRef(LPCLASSFACTORY iface)
503 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
504 ULONG ref = InterlockedIncrement(&(This->ref));
505 TRACE("(%p) ref was %ld\n", This, ref - 1);
509 static ULONG WINAPI DSPCF_Release(LPCLASSFACTORY iface)
511 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
512 ULONG ref = InterlockedDecrement(&(This->ref));
513 TRACE("(%p) ref was %ld\n", This, ref + 1);
514 /* static class, won't be freed */
518 static HRESULT WINAPI
519 DSPCF_CreateInstance(
520 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
522 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
523 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
526 WARN("invalid parameter\n");
527 return DSERR_INVALIDPARAM;
532 if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
533 return IKsPrivatePropertySetImpl_Create((IKsPrivatePropertySetImpl**)ppobj);
536 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
537 return E_NOINTERFACE;
540 static HRESULT WINAPI
541 DSPCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
542 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
543 FIXME("(%p)->(%d),stub!\n",This,dolock);
547 static const IClassFactoryVtbl DSPCF_Vtbl = {
548 DSPCF_QueryInterface,
551 DSPCF_CreateInstance,
555 static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
557 /*******************************************************************************
558 * DllGetClassObject [DSOUND.5]
559 * Retrieves class object from a DLL object
562 * Docs say returns STDAPI
565 * rclsid [I] CLSID for the class object
566 * riid [I] Reference to identifier of interface for class object
567 * ppv [O] Address of variable to receive interface pointer for riid
571 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
574 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
576 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
579 WARN("invalid parameter\n");
585 if ( IsEqualCLSID( &CLSID_DirectSound, rclsid ) ||
586 IsEqualCLSID( &CLSID_DirectSound8, rclsid ) ) {
587 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
588 *ppv = (LPVOID)&DSOUND_CF;
589 IClassFactory_AddRef((IClassFactory*)*ppv);
592 WARN("(%s,%s,%p): no interface found.\n",
593 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
597 if ( IsEqualCLSID( &CLSID_DirectSoundCapture, rclsid ) ||
598 IsEqualCLSID( &CLSID_DirectSoundCapture8, rclsid ) ) {
599 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
600 *ppv = (LPVOID)&DSOUND_CAPTURE_CF;
601 IClassFactory_AddRef((IClassFactory*)*ppv);
604 WARN("(%s,%s,%p): no interface found.\n",
605 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
609 if ( IsEqualCLSID( &CLSID_DirectSoundFullDuplex, rclsid ) ) {
610 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
611 *ppv = (LPVOID)&DSOUND_FULLDUPLEX_CF;
612 IClassFactory_AddRef((IClassFactory*)*ppv);
615 WARN("(%s,%s,%p): no interface found.\n",
616 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
620 if ( IsEqualCLSID( &CLSID_DirectSoundPrivate, rclsid ) ) {
621 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
622 *ppv = (LPVOID)&DSOUND_PRIVATE_CF;
623 IClassFactory_AddRef((IClassFactory*)*ppv);
626 WARN("(%s,%s,%p): no interface found.\n",
627 debugstr_guid(rclsid), debugstr_guid(riid), ppv);
631 WARN("(%s,%s,%p): no class found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
632 return CLASS_E_CLASSNOTAVAILABLE;
636 /*******************************************************************************
637 * DllCanUnloadNow [DSOUND.4]
638 * Determines whether the DLL is in use.
644 HRESULT WINAPI DllCanUnloadNow(void)
646 FIXME("(void): stub\n");
650 #define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
651 guid.Data1 = l; guid.Data2 = w1; guid.Data3 = w2; \
652 guid.Data4[0] = b1; guid.Data4[1] = b2; guid.Data4[2] = b3; \
653 guid.Data4[3] = b4; guid.Data4[4] = b5; guid.Data4[5] = b6; \
654 guid.Data4[6] = b7; guid.Data4[7] = b8;
656 /***********************************************************************
657 * DllMain (DSOUND.init)
659 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
662 TRACE("(%p 0x%lx %p)\n", hInstDLL, fdwReason, lpvReserved);
665 case DLL_PROCESS_ATTACH:
666 TRACE("DLL_PROCESS_ATTACH\n");
667 for (i = 0; i < MAXWAVEDRIVERS; i++) {
668 DSOUND_renderer[i] = NULL;
669 DSOUND_capture[i] = NULL;
670 INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
671 INIT_GUID(DSOUND_capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
674 case DLL_PROCESS_DETACH:
675 TRACE("DLL_PROCESS_DETACH\n");
677 case DLL_THREAD_ATTACH:
678 TRACE("DLL_THREAD_ATTACH\n");
680 case DLL_THREAD_DETACH:
681 TRACE("DLL_THREAD_DETACH\n");
684 TRACE("UNKNOWN REASON\n");