From 3b7740a11ff2432cc8bbcfa2524ebc859cc4b643 Mon Sep 17 00:00:00 2001 From: swallace Date: Sat, 1 Oct 1994 02:17:17 +0000 Subject: Merged in changes to Hannu Savolainen's VoxWare sound drivers, version 2.9. --- sys/i386/isa/sound/ics2101.c | 50 +++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'sys/i386/isa/sound/ics2101.c') diff --git a/sys/i386/isa/sound/ics2101.c b/sys/i386/isa/sound/ics2101.c index c06fec0..899c94e 100644 --- a/sys/i386/isa/sound/ics2101.c +++ b/sys/i386/isa/sound/ics2101.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: ics2101.c,v 1.3 1994/08/02 07:40:05 davidg Exp $ */ #include "sound_config.h" @@ -49,34 +49,36 @@ static int left_fix[ICS_MIXDEVS] = static int right_fix[ICS_MIXDEVS] = {2, 2, 2, 1, 2, 1}; -static int -scale_vol(int vol) +static int +scale_vol (int vol) { #if 1 -/* + /* * Experimental volume scaling by Risto Kankkunen. * This should give smoother volume response than just * a plain multiplication. */ - int e; - - if (vol < 0) - vol = 0; - if (vol > 100) - vol = 100; - vol = (31 * vol + 50) / 100; - e = 0; - if (vol) { - while (vol < 16) { - vol <<= 1; - e--; - } - vol -= 16; - e += 7; - } - return ((e << 4) + vol); + int e; + + if (vol < 0) + vol = 0; + if (vol > 100) + vol = 100; + vol = (31 * vol + 50) / 100; + e = 0; + if (vol) + { + while (vol < 16) + { + vol <<= 1; + e--; + } + vol -= 16; + e += 7; + } + return ((e << 4) + vol); #else - return ((vol*127)+50)/100; + return ((vol * 127) + 50) / 100; #endif } @@ -88,7 +90,7 @@ write_mix (int dev, int chn, int vol) int ctrl_addr = dev << 3; int attn_addr = dev << 3; - vol=scale_vol(vol); + vol = scale_vol (vol); if (chn == CHN_LEFT) { @@ -185,7 +187,7 @@ ics2101_mixer_ioctl (int dev, unsigned int cmd, unsigned int arg) case SOUND_MIXER_STEREODEVS: return IOCTL_OUT (arg, SOUND_MASK_LINE | SOUND_MASK_CD | - SOUND_MASK_SYNTH | SOUND_MASK_VOLUME| + SOUND_MASK_SYNTH | SOUND_MASK_VOLUME | SOUND_MASK_MIC); break; -- cgit v1.1