Maarten Lankhorst : dsound:
Handle failing of IDsDriver_CreateSoundBuffer better.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 20 16:08:42 CDT 2007
Module: wine
Branch: master
Commit: 9c469e1a9487d81186642282de89048fc51c0864
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9c469e1a9487d81186642282de89048fc51c0864
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Sun Aug 19 23:52:19 2007 +0200
dsound: Handle failing of IDsDriver_CreateSoundBuffer better.
---
dlls/dsound/primary.c | 15 +++++++++++++--
dlls/wineoss.drv/dsrender.c | 4 +---
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index 3e75275..4063266 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -224,8 +224,19 @@ HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device)
&(device->buflen),&(device->buffer),
(LPVOID*)&(device->hwbuf));
if (err != DS_OK) {
- WARN("IDsDriver_CreateSoundBuffer failed\n");
- return err;
+ WARN("IDsDriver_CreateSoundBuffer failed, falling back to waveout\n");
+ /* Wine-only: close wine directsound driver, then reopen without WAVE_DIRECTSOUND */
+ device->drvdesc.dwFlags = DSDDESC_DOMMSYSTEMOPEN | DSDDESC_DOMMSYSTEMSETFORMAT;
+ waveOutClose(device->hwo);
+ IDsDriver_Release(device->driver);
+ device->driver = device->buffer = NULL;
+ device->hwo = 0;
+ err = mmErr(waveOutOpen(&(device->hwo), device->drvdesc.dnDevNode, device->pwfx, (DWORD_PTR)DSOUND_callback, (DWORD)device, CALLBACK_FUNCTION));
+ if (err != DS_OK)
+ {
+ WARN("Falling back to waveout failed too! Giving up\n");
+ return err;
+ }
}
}
diff --git a/dlls/wineoss.drv/dsrender.c b/dlls/wineoss.drv/dsrender.c
index aa9d373..27672fb 100644
--- a/dlls/wineoss.drv/dsrender.c
+++ b/dlls/wineoss.drv/dsrender.c
@@ -344,9 +344,7 @@ static HRESULT DSDB_MapBuffer(IDsDriverBufferImpl *dsdb)
dsdb->mapping = mmap(NULL, dsdb->maplen, PROT_WRITE, MAP_SHARED,
dsdb->fd, 0);
if (dsdb->mapping == (LPBYTE)-1) {
- ERR("Could not map sound device for direct access (%s)\n", strerror(errno));
- ERR("Please run winecfg, open \"Audio\" page and set\n"
- "\"Hardware Acceleration\" to \"Emulation\".\n");
+ WARN("Could not map sound device for direct access (%s)\n", strerror(errno));
return DSERR_GENERIC;
}
TRACE("The sound device has been mapped for direct access at %p, size=%d\n", dsdb->mapping, dsdb->maplen);
More information about the wine-cvs
mailing list