open() the OSS sounddevice non-blocking in case another process has it

open already.
This commit is contained in:
Marcus Meissner 2000-03-30 20:22:12 +00:00 committed by Alexandre Julliard
parent 0e37eaaca8
commit 502e15b6e7
2 changed files with 9 additions and 9 deletions

View File

@ -2094,7 +2094,7 @@ static int DSOUND_OpenAudio(void)
/* we will most likely not get one, avoid excessive opens ... */ /* we will most likely not get one, avoid excessive opens ... */
if (audiofd == -ENODEV) if (audiofd == -ENODEV)
return -1; return -1;
audiofd = open("/dev/audio",O_WRONLY); audiofd = open("/dev/audio",O_WRONLY|O_NDELAY);
if (audiofd==-1) { if (audiofd==-1) {
/* Don't worry if sound is busy at the moment */ /* Don't worry if sound is busy at the moment */
if ((errno != EBUSY) && (errno != ENODEV)) if ((errno != EBUSY) && (errno != ENODEV))
@ -2290,7 +2290,7 @@ HRESULT WINAPI DirectSoundCreate(REFGUID lpGUID,LPDIRECTSOUND *ppDS,IUnknown *pU
/* If we do, whether it's busy or not, we continue */ /* If we do, whether it's busy or not, we continue */
/* otherwise we return with DSERR_NODRIVER */ /* otherwise we return with DSERR_NODRIVER */
audiofd = open("/dev/audio",O_WRONLY); audiofd = open("/dev/audio",O_WRONLY|O_NDELAY);
if (audiofd == -1) { if (audiofd == -1) {
audiofd = -errno; audiofd = -errno;
if (errno == ENODEV) { if (errno == ENODEV) {

View File

@ -474,7 +474,7 @@ static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
} }
if (WOutDev[wDevID].unixdev == 0) { if (WOutDev[wDevID].unixdev == 0) {
audio = open(SOUND_DEV, O_WRONLY, 0); audio = open(SOUND_DEV, O_WRONLY|O_NDELAY, 0);
if (audio == -1) return MMSYSERR_ALLOCATED; if (audio == -1) return MMSYSERR_ALLOCATED;
} else { } else {
audio = WOutDev[wDevID].unixdev; audio = WOutDev[wDevID].unixdev;
@ -598,7 +598,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
WOutDev[wDevID].unixdev = 0; WOutDev[wDevID].unixdev = 0;
if (access(SOUND_DEV, 0) != 0) if (access(SOUND_DEV, 0) != 0)
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
audio = open(SOUND_DEV, O_WRONLY, 0); audio = open(SOUND_DEV, O_WRONLY|O_NDELAY, 0);
if (audio == -1) { if (audio == -1) {
WARN("can't open !\n"); WARN("can't open !\n");
return MMSYSERR_ALLOCATED ; return MMSYSERR_ALLOCATED ;
@ -909,7 +909,7 @@ static DWORD wodGetVolume(WORD wDevID, LPDWORD lpdwVol)
if (lpdwVol == NULL) if (lpdwVol == NULL)
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
if ((mixer = open(MIXER_DEV, O_RDONLY)) < 0) { if ((mixer = open(MIXER_DEV, O_RDONLY|O_NDELAY)) < 0) {
WARN("mixer device not available !\n"); WARN("mixer device not available !\n");
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
} }
@ -941,7 +941,7 @@ static DWORD wodSetVolume(WORD wDevID, DWORD dwParam)
right = (HIWORD(dwParam) * 100) / 0xFFFFl; right = (HIWORD(dwParam) * 100) / 0xFFFFl;
volume = left + (right << 8); volume = left + (right << 8);
if ((mixer = open(MIXER_DEV, O_WRONLY)) < 0) { if ((mixer = open(MIXER_DEV, O_WRONLY|O_NDELAY)) < 0) {
WARN("mixer device not available !\n"); WARN("mixer device not available !\n");
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
} }
@ -961,7 +961,7 @@ static DWORD wodGetNumDevs(void)
DWORD ret = 1; DWORD ret = 1;
/* FIXME: For now, only one sound device (SOUND_DEV) is allowed */ /* FIXME: For now, only one sound device (SOUND_DEV) is allowed */
int audio = open(SOUND_DEV, O_WRONLY, 0); int audio = open(SOUND_DEV, O_WRONLY|O_NDELAY, 0);
if (audio == -1) { if (audio == -1) {
if (errno != EBUSY) if (errno != EBUSY)
@ -1026,7 +1026,7 @@ static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSA lpCaps, DWORD dwSize)
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize); TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
if (lpCaps == NULL) return MMSYSERR_NOTENABLED; if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED; if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED;
audio = open(SOUND_DEV, O_RDONLY, 0); audio = open(SOUND_DEV, O_RDONLY|O_NDELAY, 0);
if (audio == -1) return MMSYSERR_ALLOCATED ; if (audio == -1) return MMSYSERR_ALLOCATED ;
#ifdef EMULATE_SB16 #ifdef EMULATE_SB16
lpCaps->wMid = 0x0002; lpCaps->wMid = 0x0002;
@ -1115,7 +1115,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
WInDev[wDevID].unixdev = 0; WInDev[wDevID].unixdev = 0;
if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED; if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED;
audio = open(SOUND_DEV, O_RDONLY, 0); audio = open(SOUND_DEV, O_RDONLY|O_NDELAY, 0);
if (audio == -1) { if (audio == -1) {
WARN("can't open !\n"); WARN("can't open !\n");
return MMSYSERR_ALLOCATED; return MMSYSERR_ALLOCATED;