dsound: Handle failing of IDsDriver_CreateSoundBuffer better.

This commit is contained in:
Maarten Lankhorst 2007-08-19 23:52:19 +02:00 committed by Alexandre Julliard
parent 4a2424d6a3
commit 9c469e1a94
2 changed files with 14 additions and 5 deletions

View File

@ -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;
}
}
}

View File

@ -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);