DirectSound fix and warning
Mike Hearn
mike at navi.cx
Wed May 25 18:47:33 CDT 2005
Insomnia. Should be revising. Can't sleep.
This fix means that if XMMS is playing, GLExcess doesn't crash.
Mike Hearn <mh at codeweavers.com>
- Set returned interface to NULL on error
- Add a comment and visual warning so users who get bitten by OSS+cheap cards have a clue
Index: dlls/dsound/dsound.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound.c,v
retrieving revision 1.32
diff -u -p -d -u -r1.32 dsound.c
--- dlls/dsound/dsound.c 6 May 2005 19:33:32 -0000 1.32
+++ dlls/dsound/dsound.c 25 May 2005 23:44:18 -0000
@@ -28,6 +28,7 @@
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
+#include "winuser.h" /* for MessageBoxA */
#include "mmsystem.h"
#include "winternl.h"
#include "mmddk.h"
@@ -835,8 +836,20 @@ HRESULT WINAPI IDirectSoundImpl_Create(
/* Enumerate WINMM audio devices and find the one we want */
wodn = waveOutGetNumDevs();
- if (!wodn) {
- WARN("no driver\n");
+ if (!wodn){
+
+ /* This can happen if the wave out device is locked - the OSS
+ * driver will silently fail to initialise leading to the "no
+ * driver" error here. */
+
+ static BOOL warned = FALSE;
+
+ if (!warned) {
+ warned = TRUE;
+ ERR("DirectSound: no sound driver available\n");
+ MessageBoxA(NULL, "No sound drivers are available, your sound card may be in use by another application.\n\nYou will not hear audio from this Windows program.", "Wine DirectSound", MB_OK);
+ }
+
*ppDS = NULL;
return DSERR_NODRIVER;
}
@@ -1653,8 +1666,10 @@ HRESULT WINAPI DSOUND_Create(
WARN("IDirectSound_IDirectSound_Create failed\n");
IDirectSound8_Release(pDS);
}
- } else
+ } else {
WARN("IDirectSoundImpl_Create failed\n");
+ *ppDS = NULL;
+ }
}
return hr;
More information about the wine-patches
mailing list