From d8d445f63d8683184927eaaeef7bd8f476256377 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Mon, 18 Sep 2006 10:17:24 +0000 Subject: [PATCH] fall back to software volume control when the mixer ioctl fails on the dsp fd git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1268 423420c4-83ab-492f-b58f-81f9feb106b5 --- rdpsnd_oss.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/rdpsnd_oss.c b/rdpsnd_oss.c index cf8ab1b..5dd6300 100644 --- a/rdpsnd_oss.c +++ b/rdpsnd_oss.c @@ -29,6 +29,7 @@ #include "rdesktop.h" #include "rdpsnd.h" +#include "rdpsnd_dsp.h" #include #include #include @@ -42,6 +43,7 @@ static int snd_rate; static short samplewidth; static char *dsp_dev; +static struct audio_driver oss_driver; BOOL oss_open(void) @@ -153,34 +155,15 @@ oss_set_format(WAVEFORMATEX * pwfx) void oss_volume(uint16 left, uint16 right) { - static BOOL use_dev_mixer = False; uint32 volume; - int fd_mix = -1; volume = left / (65536 / 100); volume |= right / (65536 / 100) << 8; - if (use_dev_mixer) - { - if ((fd_mix = open("/dev/mixer", O_RDWR | O_NONBLOCK)) == -1) - { - perror("open /dev/mixer"); - return; - } - - if (ioctl(fd_mix, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1) - { - perror("MIXER_WRITE(SOUND_MIXER_PCM)"); - return; - } - - close(fd_mix); - } - if (ioctl(g_dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1) { perror("MIXER_WRITE(SOUND_MIXER_PCM)"); - use_dev_mixer = True; + oss_driver.wave_out_volume = rdpsnd_dsp_softvol_set; return; } } @@ -255,8 +238,6 @@ oss_play(void) struct audio_driver * oss_register(char *options) { - static struct audio_driver oss_driver; - oss_driver.wave_out_write = rdpsnd_queue_write; oss_driver.wave_out_open = oss_open; oss_driver.wave_out_close = oss_close;