diff options
Diffstat (limited to 'libao2/ao_oss.c')
-rw-r--r-- | libao2/ao_oss.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 1bcec7f676..b14e8098db 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -10,6 +10,7 @@ //#include <sys/soundcard.h> #include "../config.h" +#include "../mixer.h" #include "afmt.h" @@ -35,7 +36,6 @@ static audio_buf_info zz; static int audio_fd=-1; char *oss_mixer_device = "/dev/mixer"; -int oss_mixer_usemaster = 0; // to set/get/query special features/parameters static int control(int cmd,int arg){ @@ -54,36 +54,28 @@ static int control(int cmd,int arg){ if(ao_data.format == AFMT_AC3) return CONTROL_TRUE; - if ((fd = open("/dev/mixer", O_RDONLY)) > 0) + if ((fd = open(oss_mixer_device, O_RDONLY)) > 0) { ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs); - if ((devs & SOUND_MASK_PCM) && (oss_mixer_usemaster == 0)) - if (cmd == AOCONTROL_GET_VOLUME) - mcmd = SOUND_MIXER_READ_PCM; - else - mcmd = SOUND_MIXER_WRITE_PCM; - else if ((devs & SOUND_MASK_VOLUME) && (oss_mixer_usemaster == 1)) + if (devs & SOUND_MASK_PCM) + { if (cmd == AOCONTROL_GET_VOLUME) - mcmd = SOUND_MIXER_READ_VOLUME; + { + ioctl(fd, SOUND_MIXER_READ_PCM, &v); + vol->right = (v & 0xFF00) >> 8; + vol->left = v & 0x00FF; + } else - mcmd = SOUND_MIXER_WRITE_VOLUME; + { + v = ((int)vol->right << 8) | (int)vol->left; + ioctl(fd, SOUND_MIXER_WRITE_PCM, &v); + } + } else { close(fd); return CONTROL_ERROR; } - - if (cmd == AOCONTROL_GET_VOLUME) - { - ioctl(fd, cmd, &v); - vol->right = (v & 0xFF00) >> 8; - vol->left = v & 0x00FF; - } - else - { - v = ((int)vol->right << 8) | (int)vol->left; - ioctl(fd, cmd, &v); - } close(fd); return CONTROL_OK; } @@ -103,6 +95,9 @@ static int init(int rate,int channels,int format,int flags){ if (ao_subdevice) dsp = ao_subdevice; + if(mixer_device) + oss_mixer_device=mixer_device; + if (verbose) printf("audio_setup: using '%s' dsp device\n", dsp); |