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 IDirectSoundImpl
* DSOUND_renderer
= NULL
;
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
)) appkey
= 0;
156 RegCloseKey( tmpkey
);
163 if (!get_config_key( hkey
, appkey
, "EmulDriver", buffer
, MAX_PATH
))
164 ds_emuldriver
= strcmp(buffer
, "N");
166 if (!get_config_key( hkey
, appkey
, "HELmargin", buffer
, MAX_PATH
))
167 ds_hel_margin
= atoi(buffer
);
169 if (!get_config_key( hkey
, appkey
, "HELqueue", buffer
, MAX_PATH
))
170 ds_hel_queue
= atoi(buffer
);
172 if (!get_config_key( hkey
, appkey
, "SndQueueMax", buffer
, MAX_PATH
))
173 ds_snd_queue_max
= atoi(buffer
);
175 if (!get_config_key( hkey
, appkey
, "SndQueueMin", buffer
, MAX_PATH
))
176 ds_snd_queue_min
= atoi(buffer
);
178 if (!get_config_key( hkey
, appkey
, "HardwareAcceleration", buffer
, MAX_PATH
)) {
179 if (strcmp(buffer
, "Full") == 0)
180 ds_hw_accel
= DS_HW_ACCEL_FULL
;
181 else if (strcmp(buffer
, "Standard") == 0)
182 ds_hw_accel
= DS_HW_ACCEL_STANDARD
;
183 else if (strcmp(buffer
, "Basic") == 0)
184 ds_hw_accel
= DS_HW_ACCEL_BASIC
;
185 else if (strcmp(buffer
, "Emulation") == 0)
186 ds_hw_accel
= DS_HW_ACCEL_EMULATION
;
189 if (!get_config_key( hkey
, appkey
, "DefaultPlayback", buffer
, MAX_PATH
))
190 ds_default_playback
= atoi(buffer
);
192 if (!get_config_key( hkey
, appkey
, "DefaultCapture", buffer
, MAX_PATH
))
193 ds_default_capture
= atoi(buffer
);
195 if (appkey
) RegCloseKey( appkey
);
198 if (ds_emuldriver
!= DS_EMULDRIVER
)
199 WARN("ds_emuldriver = %d (default=%d)\n",ds_emuldriver
, DS_EMULDRIVER
);
200 if (ds_hel_margin
!= DS_HEL_MARGIN
)
201 WARN("ds_hel_margin = %d (default=%d)\n",ds_hel_margin
, DS_HEL_MARGIN
);
202 if (ds_hel_queue
!= DS_HEL_QUEUE
)
203 WARN("ds_hel_queue = %d (default=%d)\n",ds_hel_queue
, DS_HEL_QUEUE
);
204 if (ds_snd_queue_max
!= DS_SND_QUEUE_MAX
)
205 WARN("ds_snd_queue_max = %d (default=%d)\n",ds_snd_queue_max
,DS_SND_QUEUE_MAX
);
206 if (ds_snd_queue_min
!= DS_SND_QUEUE_MIN
)
207 WARN("ds_snd_queue_min = %d (default=%d)\n",ds_snd_queue_min
,DS_SND_QUEUE_MIN
);
208 if (ds_hw_accel
!= DS_HW_ACCEL_FULL
)
209 WARN("ds_hw_accel = %s (default=Full)\n",
210 ds_hw_accel
==DS_HW_ACCEL_FULL
? "Full" :
211 ds_hw_accel
==DS_HW_ACCEL_STANDARD
? "Standard" :
212 ds_hw_accel
==DS_HW_ACCEL_BASIC
? "Basic" :
213 ds_hw_accel
==DS_HW_ACCEL_EMULATION
? "Emulation" :
215 if (ds_default_playback
!= 0)
216 WARN("ds_default_playback = %d (default=0)\n",ds_default_playback
);
217 if (ds_default_capture
!= 0)
218 WARN("ds_default_capture = %d (default=0)\n",ds_default_playback
);
221 const char * get_device_id(LPCGUID pGuid
)
223 if (IsEqualGUID(&DSDEVID_DefaultPlayback
, pGuid
))
224 return "DSDEVID_DefaultPlayback";
225 else if (IsEqualGUID(&DSDEVID_DefaultVoicePlayback
, pGuid
))
226 return "DSDEVID_DefaultVoicePlayback";
227 else if (IsEqualGUID(&DSDEVID_DefaultCapture
, pGuid
))
228 return "DSDEVID_DefaultCapture";
229 else if (IsEqualGUID(&DSDEVID_DefaultVoiceCapture
, pGuid
))
230 return "DSDEVID_DefaultVoiceCapture";
231 return debugstr_guid(pGuid
);
234 /***************************************************************************
235 * GetDeviceID [DSOUND.9]
237 * Retrieves unique identifier of default device specified
240 * pGuidSrc [I] Address of device GUID.
241 * pGuidDest [O] Address to receive unique device GUID.
245 * Failure: DSERR_INVALIDPARAM
248 * pGuidSrc is a valid device GUID or DSDEVID_DefaultPlayback,
249 * DSDEVID_DefaultCapture, DSDEVID_DefaultVoicePlayback, or
250 * DSDEVID_DefaultVoiceCapture.
251 * Returns pGuidSrc if pGuidSrc is a valid device or the device
252 * GUID for the specified constants.
254 HRESULT WINAPI
GetDeviceID(LPCGUID pGuidSrc
, LPGUID pGuidDest
)
256 TRACE("(%s,%p)\n", get_device_id(pGuidSrc
),pGuidDest
);
258 if ( pGuidSrc
== NULL
) {
259 WARN("invalid parameter: pGuidSrc == NULL\n");
260 return DSERR_INVALIDPARAM
;
263 if ( pGuidDest
== NULL
) {
264 WARN("invalid parameter: pGuidDest == NULL\n");
265 return DSERR_INVALIDPARAM
;
268 if ( IsEqualGUID( &DSDEVID_DefaultPlayback
, pGuidSrc
) ||
269 IsEqualGUID( &DSDEVID_DefaultVoicePlayback
, pGuidSrc
) ) {
270 CopyMemory(pGuidDest
, &DSOUND_renderer_guids
[ds_default_playback
], sizeof(GUID
));
271 TRACE("returns %s\n", get_device_id(pGuidDest
));
275 if ( IsEqualGUID( &DSDEVID_DefaultCapture
, pGuidSrc
) ||
276 IsEqualGUID( &DSDEVID_DefaultVoiceCapture
, pGuidSrc
) ) {
277 CopyMemory(pGuidDest
, &DSOUND_capture_guids
[ds_default_capture
], sizeof(GUID
));
278 TRACE("returns %s\n", get_device_id(pGuidDest
));
282 CopyMemory(pGuidDest
, pGuidSrc
, sizeof(GUID
));
283 TRACE("returns %s\n", get_device_id(pGuidDest
));
289 /***************************************************************************
290 * DirectSoundEnumerateA [DSOUND.2]
292 * Enumerate all DirectSound drivers installed in the system
295 * lpDSEnumCallback [I] Address of callback function.
296 * lpContext [I] Address of user defined context passed to callback function.
300 * Failure: DSERR_INVALIDPARAM
302 HRESULT WINAPI
DirectSoundEnumerateA(
303 LPDSENUMCALLBACKA lpDSEnumCallback
,
311 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
312 lpDSEnumCallback
, lpContext
);
314 if (lpDSEnumCallback
== NULL
) {
315 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
316 return DSERR_INVALIDPARAM
;
319 devs
= waveOutGetNumDevs();
321 if (GetDeviceID(&DSDEVID_DefaultPlayback
, &guid
) == DS_OK
) {
322 for (wod
= 0; wod
< devs
; ++wod
) {
323 if (IsEqualGUID( &guid
, &DSOUND_renderer_guids
[wod
]) ) {
324 err
= mmErr(waveOutMessage((HWAVEOUT
)wod
,DRV_QUERYDSOUNDDESC
,(DWORD
)&desc
,0));
326 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
327 "Primary Sound Driver",desc
.szDrvname
,lpContext
);
328 if (lpDSEnumCallback(NULL
, "Primary Sound Driver", desc
.szDrvname
, lpContext
) == FALSE
)
336 for (wod
= 0; wod
< devs
; ++wod
) {
337 err
= mmErr(waveOutMessage((HWAVEOUT
)wod
,DRV_QUERYDSOUNDDESC
,(DWORD
)&desc
,0));
339 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
340 debugstr_guid(&DSOUND_renderer_guids
[wod
]),desc
.szDesc
,desc
.szDrvname
,lpContext
);
341 if (lpDSEnumCallback(&DSOUND_renderer_guids
[wod
], desc
.szDesc
, desc
.szDrvname
, lpContext
) == FALSE
)
348 /***************************************************************************
349 * DirectSoundEnumerateW [DSOUND.3]
351 * Enumerate all DirectSound drivers installed in the system
354 * lpDSEnumCallback [I] Address of callback function.
355 * lpContext [I] Address of user defined context passed to callback function.
359 * Failure: DSERR_INVALIDPARAM
361 HRESULT WINAPI
DirectSoundEnumerateW(
362 LPDSENUMCALLBACKW lpDSEnumCallback
,
369 WCHAR wDesc
[MAXPNAMELEN
];
370 WCHAR wName
[MAXPNAMELEN
];
372 TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
373 lpDSEnumCallback
, lpContext
);
375 if (lpDSEnumCallback
== NULL
) {
376 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
377 return DSERR_INVALIDPARAM
;
380 devs
= waveOutGetNumDevs();
382 if (GetDeviceID(&DSDEVID_DefaultPlayback
, &guid
) == DS_OK
) {
383 for (wod
= 0; wod
< devs
; ++wod
) {
384 if (IsEqualGUID( &guid
, &DSOUND_renderer_guids
[wod
] ) ) {
385 err
= mmErr(waveOutMessage((HWAVEOUT
)wod
,DRV_QUERYDSOUNDDESC
,(DWORD
)&desc
,0));
387 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
388 "Primary Sound Driver",desc
.szDrvname
,lpContext
);
389 MultiByteToWideChar( CP_ACP
, 0, "Primary Sound Driver", -1,
390 wDesc
, sizeof(wDesc
)/sizeof(WCHAR
) );
391 MultiByteToWideChar( CP_ACP
, 0, desc
.szDrvname
, -1,
392 wName
, sizeof(wName
)/sizeof(WCHAR
) );
393 if (lpDSEnumCallback(NULL
, wDesc
, wName
, lpContext
) == FALSE
)
401 for (wod
= 0; wod
< devs
; ++wod
) {
402 err
= mmErr(waveOutMessage((HWAVEOUT
)wod
,DRV_QUERYDSOUNDDESC
,(DWORD
)&desc
,0));
404 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
405 debugstr_guid(&DSOUND_renderer_guids
[wod
]),desc
.szDesc
,desc
.szDrvname
,lpContext
);
406 MultiByteToWideChar( CP_ACP
, 0, desc
.szDesc
, -1,
407 wDesc
, sizeof(wDesc
)/sizeof(WCHAR
) );
408 MultiByteToWideChar( CP_ACP
, 0, desc
.szDrvname
, -1,
409 wName
, sizeof(wName
)/sizeof(WCHAR
) );
410 if (lpDSEnumCallback(&DSOUND_renderer_guids
[wod
], wDesc
, wName
, lpContext
) == FALSE
)
417 /*******************************************************************************
418 * DirectSound ClassFactory
421 static HRESULT WINAPI
422 DSCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
423 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
425 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
426 return E_NOINTERFACE
;
429 static ULONG WINAPI
DSCF_AddRef(LPCLASSFACTORY iface
)
431 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
432 ULONG ref
= InterlockedIncrement(&(This
->ref
));
433 TRACE("(%p) ref was %ld\n", This
, ref
- 1);
437 static ULONG WINAPI
DSCF_Release(LPCLASSFACTORY iface
)
439 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
440 ULONG ref
= InterlockedDecrement(&(This
->ref
));
441 TRACE("(%p) ref was %ld\n", This
, ref
+ 1);
442 /* static class, won't be freed */
446 static HRESULT WINAPI
DSCF_CreateInstance(
447 LPCLASSFACTORY iface
,LPUNKNOWN pOuter
,REFIID riid
,LPVOID
*ppobj
449 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
450 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
453 return CLASS_E_NOAGGREGATION
;
456 WARN("invalid parameter\n");
457 return DSERR_INVALIDPARAM
;
462 if ( IsEqualIID( &IID_IDirectSound
, riid
) )
463 return DSOUND_Create(0,(LPDIRECTSOUND
*)ppobj
,pOuter
);
465 if ( IsEqualIID( &IID_IDirectSound8
, riid
) )
466 return DSOUND_Create8(0,(LPDIRECTSOUND8
*)ppobj
,pOuter
);
468 WARN("(%p,%p,%s,%p) Interface not found!\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
469 return E_NOINTERFACE
;
472 static HRESULT WINAPI
DSCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
473 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
474 FIXME("(%p)->(%d),stub!\n",This
,dolock
);
478 static IClassFactoryVtbl DSCF_Vtbl
= {
486 static IClassFactoryImpl DSOUND_CF
= { &DSCF_Vtbl
, 1 };
488 /*******************************************************************************
489 * DirectSoundPrivate ClassFactory
492 static HRESULT WINAPI
493 DSPCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
494 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
496 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
497 return E_NOINTERFACE
;
500 static ULONG WINAPI
DSPCF_AddRef(LPCLASSFACTORY iface
)
502 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
503 ULONG ref
= InterlockedIncrement(&(This
->ref
));
504 TRACE("(%p) ref was %ld\n", This
, ref
- 1);
508 static ULONG WINAPI
DSPCF_Release(LPCLASSFACTORY iface
)
510 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
511 ULONG ref
= InterlockedDecrement(&(This
->ref
));
512 TRACE("(%p) ref was %ld\n", This
, ref
+ 1);
513 /* static class, won't be freed */
517 static HRESULT WINAPI
518 DSPCF_CreateInstance(
519 LPCLASSFACTORY iface
,LPUNKNOWN pOuter
,REFIID riid
,LPVOID
*ppobj
521 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
522 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
525 WARN("invalid parameter\n");
526 return DSERR_INVALIDPARAM
;
531 if ( IsEqualGUID( &IID_IKsPropertySet
, riid
) ) {
532 return IKsPrivatePropertySetImpl_Create((IKsPrivatePropertySetImpl
**)ppobj
);
535 WARN("(%p,%p,%s,%p) Interface not found!\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
536 return E_NOINTERFACE
;
539 static HRESULT WINAPI
540 DSPCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
541 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
542 FIXME("(%p)->(%d),stub!\n",This
,dolock
);
546 static IClassFactoryVtbl DSPCF_Vtbl
= {
547 DSPCF_QueryInterface
,
550 DSPCF_CreateInstance
,
554 static IClassFactoryImpl DSOUND_PRIVATE_CF
= { &DSPCF_Vtbl
, 1 };
556 /*******************************************************************************
557 * DllGetClassObject [DSOUND.5]
558 * Retrieves class object from a DLL object
561 * Docs say returns STDAPI
564 * rclsid [I] CLSID for the class object
565 * riid [I] Reference to identifier of interface for class object
566 * ppv [O] Address of variable to receive interface pointer for riid
570 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
573 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
575 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
578 WARN("invalid parameter\n");
584 if ( IsEqualCLSID( &CLSID_DirectSound
, rclsid
) ||
585 IsEqualCLSID( &CLSID_DirectSound8
, rclsid
) ) {
586 if ( IsEqualCLSID( &IID_IClassFactory
, riid
) ) {
587 *ppv
= (LPVOID
)&DSOUND_CF
;
588 IClassFactory_AddRef((IClassFactory
*)*ppv
);
591 WARN("(%s,%s,%p): no interface found.\n",
592 debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
596 if ( IsEqualCLSID( &CLSID_DirectSoundCapture
, rclsid
) ||
597 IsEqualCLSID( &CLSID_DirectSoundCapture8
, rclsid
) ) {
598 if ( IsEqualCLSID( &IID_IClassFactory
, riid
) ) {
599 *ppv
= (LPVOID
)&DSOUND_CAPTURE_CF
;
600 IClassFactory_AddRef((IClassFactory
*)*ppv
);
603 WARN("(%s,%s,%p): no interface found.\n",
604 debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
608 if ( IsEqualCLSID( &CLSID_DirectSoundFullDuplex
, rclsid
) ) {
609 if ( IsEqualCLSID( &IID_IClassFactory
, riid
) ) {
610 *ppv
= (LPVOID
)&DSOUND_FULLDUPLEX_CF
;
611 IClassFactory_AddRef((IClassFactory
*)*ppv
);
614 WARN("(%s,%s,%p): no interface found.\n",
615 debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
619 if ( IsEqualCLSID( &CLSID_DirectSoundPrivate
, rclsid
) ) {
620 if ( IsEqualCLSID( &IID_IClassFactory
, riid
) ) {
621 *ppv
= (LPVOID
)&DSOUND_PRIVATE_CF
;
622 IClassFactory_AddRef((IClassFactory
*)*ppv
);
625 WARN("(%s,%s,%p): no interface found.\n",
626 debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
630 WARN("(%s,%s,%p): no class found.\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
631 return CLASS_E_CLASSNOTAVAILABLE
;
635 /*******************************************************************************
636 * DllCanUnloadNow [DSOUND.4]
637 * Determines whether the DLL is in use.
643 HRESULT WINAPI
DllCanUnloadNow(void)
645 FIXME("(void): stub\n");
649 #define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
650 guid.Data1 = l; guid.Data2 = w1; guid.Data3 = w2; \
651 guid.Data4[0] = b1; guid.Data4[1] = b2; guid.Data4[2] = b3; \
652 guid.Data4[3] = b4; guid.Data4[4] = b5; guid.Data4[5] = b6; \
653 guid.Data4[6] = b7; guid.Data4[7] = b8;
655 /***********************************************************************
656 * DllMain (DSOUND.init)
658 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
661 TRACE("(%p 0x%lx %p)\n", hInstDLL
, fdwReason
, lpvReserved
);
664 case DLL_PROCESS_ATTACH
:
665 TRACE("DLL_PROCESS_ATTACH\n");
666 for (i
= 0; i
< MAXWAVEDRIVERS
; i
++) {
667 INIT_GUID(DSOUND_renderer_guids
[i
], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i
);
668 INIT_GUID(DSOUND_capture_guids
[i
], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i
);
671 case DLL_PROCESS_DETACH
:
672 TRACE("DLL_PROCESS_DETACH\n");
674 case DLL_THREAD_ATTACH
:
675 TRACE("DLL_THREAD_ATTACH\n");
677 case DLL_THREAD_DETACH
:
678 TRACE("DLL_THREAD_DETACH\n");
681 TRACE("UNKNOWN REASON\n");