Re: RFC: big ac97_codec audio update

From: Rui Sousa (rsousa@grad.physics.sunysb.edu)
Date: Thu Oct 19 2000 - 15:35:36 EST


On Thu, 19 Oct 2000, Jeff Garzik wrote:

> It's a big update, but I think it is necessary.
> We need the new codec-specific init functions.
> We need the new ac97-valid-reg checking.
> We need the dynamic bit resolution detection.

Isn't this producing noise/pops? (since you maximize the volume).

>
> Full change description, and tested patch against 2.4.0-test10-pre4,
> follows. This includes some interface changes that may be
> objectionable, but I consider it to be fixing up an interface before
> final 2.4.0 release...
>
> Comments and feedback very much appreciated. This code is tested on via
> audio.
>
> Judging from comments already received, it looks like we need to do
> logarithmic instead of linear scaling for the OSS mixer values (0 -
> 100).

? The scale (AC97 and OSS) is linear in dB units which is,I believe, how
we perceive sound.

> This change affects a bunch of drivers, and needs lots of testing:
> maestro (when patched to use ac97_codec), trident, via, ymfpci, nm256
> (when patched), and others I am probably forgetting.

Could you include this macro (it gives you perfect accuracy and
prevents mistakes):

/* scales the range a:b to min:max rounding to the nearest integer */
#define scale_range(val, a, b, min, max) \
                ((((val) - a) * ((max) - (min)) + (min) * (b - a)) *
1000 + (b - a) * 500) / (1000 * (b - a))

and then calculate the volumes as:

left = scale_range(left, 1, 100, mh->scale, 0);

instead of

((100 - left) * scale) / 100);

I will provide a patch if you agree.

Everything else looks ok but I still need to test it.

Rui Sousa

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:15 EST