fix oss' device openning mode. defaults to write only, but read/write can be

selected by setting snd_oss_rw (need better name?) to non-zero
This commit is contained in:
Bill Currie 2001-05-16 18:59:31 +00:00
parent 35a52bb634
commit d16dc87dfa
3 changed files with 10 additions and 1 deletions

View file

@ -182,6 +182,7 @@ extern cvar_t *bgmvolume;
extern cvar_t *volume;
extern cvar_t *snd_device;
extern cvar_t *snd_oss_rw;
extern cvar_t *snd_rate;
extern cvar_t *snd_bits;
extern cvar_t *snd_stereo;

View file

@ -100,6 +100,7 @@ extern cvar_t *bgmvolume;
extern cvar_t *volume;
cvar_t *snd_device;
cvar_t *snd_oss_rw;
cvar_t *snd_rate;
cvar_t *snd_bits;
cvar_t *snd_stereo;
@ -275,6 +276,9 @@ S_Init_Cvars (void)
{
snd_device = Cvar_Get ("snd_device", "", CVAR_ROM, NULL,
"sound device. \"\" is system default");
snd_oss_rw = Cvar_Get ("snd_oss_rw", "0", CVAR_ROM, NULL,
"open the oss device in r/w mode instead of w/o"
" (for braindead(?) drivers)");
snd_rate = Cvar_Get ("snd_rate", "0", CVAR_ROM, NULL,
"sound playback rate. 0 is system default");
snd_bits = Cvar_Get ("snd_bits", "0", CVAR_ROM, NULL,

View file

@ -80,6 +80,7 @@ SNDDMA_Init (void)
struct audio_buf_info info;
int caps;
int retries = 3;
int omode = O_WRONLY;
snd_inited = 0;
@ -87,7 +88,10 @@ SNDDMA_Init (void)
if (snd_device->string[0])
snd_dev = snd_device->string;
audio_fd = open (snd_dev, O_RDWR);
if (snd_oss_rw->int_val)
omode = O_RDWR;
audio_fd = open (snd_dev, omode);
if (audio_fd < 0) { // Failed open, retry up to 3 times
// if it's busy
while ((audio_fd < 0) && retries-- &&