Small DSound fix...

Lionel Ulmer lionel.ulmer at free.fr
Fri May 2 12:42:08 CDT 2003


Hi all,

This makes games which do NOT enumerate the sound devices and go through the
ClassFactory work.

It has also some miscellaneous tracing fixes.

Changelog:
 - misc. tracing fixes
 - handle IID_IDirectSound(8) as the default sound driver

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: dlls/dsound/dsound_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound_main.c,v
retrieving revision 1.79
diff -u -r1.79 dsound_main.c
--- dlls/dsound/dsound_main.c	29 Apr 2003 22:49:52 -0000	1.79
+++ dlls/dsound/dsound_main.c	2 May 2003 17:41:15 -0000
@@ -716,8 +716,10 @@
 	unsigned wod, wodn;
 	HRESULT err = DSERR_INVALIDPARAM;
 	GUID devGuid;
-	TRACE("(%p,%p,%p)\n",lpcGUID,ippDS,pUnkOuter);
+	BOOLEAN found = FALSE;
 
+	TRACE("(%s,%p,%p)\n",debugstr_guid(lpcGUID),ippDS,pUnkOuter);
+	
 	if (ippDS == NULL) {
 		WARN("invalid parameter\n");
 		return DSERR_INVALIDPARAM;
@@ -727,7 +729,10 @@
         setup_dsound_options();
 
 	/* Default device? */
-	if ( !lpcGUID || IsEqualGUID(lpcGUID, &GUID_NULL) )
+	if ( !lpcGUID ||
+	    IsEqualGUID(lpcGUID, &GUID_NULL) ||
+	    IsEqualGUID(lpcGUID, &IID_IDirectSound) ||
+	    IsEqualGUID(lpcGUID, &IID_IDirectSound8))
 		lpcGUID = &DSDEVID_DefaultPlayback;
 
 	if (GetDeviceID(lpcGUID, &devGuid) != DS_OK) {
@@ -750,6 +755,8 @@
 	wodn = waveOutGetNumDevs();
 	if (!wodn) return DSERR_NODRIVER;
 
+	TRACE(" expecting GUID %s.\n", debugstr_guid(&devGuid));
+	
 	for (wod=0; wod<wodn; wod++) {
 		GUID guid;
 		err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDGUID,(DWORD)(&guid),0));
@@ -757,8 +764,10 @@
 			WARN("waveOutMessage failed; err=%lx\n",err);
 			return err;
 		}
+		TRACE("got GUID %s for wod %d.\n", debugstr_guid(&guid), wod);
 		if (IsEqualGUID( &devGuid, &guid) ) {
 			err = DS_OK;
+			found = TRUE;
 			break;
 		}
 	}
@@ -768,6 +777,11 @@
 		return DSERR_INVALIDPARAM;
 	}
 
+	if (found == FALSE) {
+		WARN("No device found matching given ID - trying with default one !\n");
+		wod = ds_default_playback;	
+	}
+	
 	/* DRV_QUERYDSOUNDIFACE is a "Wine extension" to get the DSound interface */
 	waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0);
 
@@ -963,14 +977,14 @@
  */
 DWORD WINAPI DSOUND_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
 {
-    TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+    TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
     if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
     	*ppv = (LPVOID)&DSOUND_CF;
 	IClassFactory_AddRef((IClassFactory*)*ppv);
-    return S_OK;
+	return S_OK;
     }
 
-    FIXME("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+    FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
     return CLASS_E_CLASSNOTAVAILABLE;
 }
 


More information about the wine-patches mailing list