[oss-devel] wrong documentation for MIXT_SLIDER in oss4 mixer api?
Clive Wright
clive_wright at ntlworld.com
Mon Feb 25 03:03:09 EET 2008
apriori at dkc-clan.de wrote:
> Hi all,
>
> I'm currently hacking around in kmix to add at least basic OSS4 support. I've
> got an usb device with a output.vol control with a value range of 0 - 37. I
> of course get values much higher than that when reading from the mixer
> device. The normal procedure as shown in the doc and in the ossmix source is
> to clamp (is that the right word?) with a bitmask.
>
> According to the documentation the value is a 31 bit positive integer,
> therefore the bitmask should be 0xFFFFFFFE - but that would be wrong, because
> I'd get values of about 9k, whereas I need 0 - 37, which I get when using the
> bitmask 0xFF and AND the value with it.
> What's wrong here, me or the documentation?
>
If control is graduated in centibels required range is probably 0 to 370
whereas kmix is probably 0 to 100 so you will have to apply a scaling
factor (kmix * 37 / 10 = ossmix). Ideally mixer should read max. value
and scale accordingly.
Bit masking should be used depending on the type of control to separate
the channels.
MIXT_STEREOSLIDER is 8 bits per channel whereas MIXT_STEREOSLIDER16 is
16 bits per channel ie maxvalue is 0x01720172 so masking with 0x0000FFFF
would select just the left channel. Shift and mask for the other channel.
regards,
Clive
More information about the oss-devel
mailing list