At Wed, 23 Aug 2006 16:07:02 +0100, James Courtier-Dutton wrote: > > Takashi Iwai wrote: > > Hi, > > > > some codecs and dsp chips use linear volumes instead of logarithmic > > one. The patch below adds a new TLV type for such a volume type. > > In alsa-lib, it's converted to dB on the fly. > > > > If no one has objection, I'll push it together with AC97-TLV and > > other similar patches after 1.0.12 release. > > > > > > Takashi > > > I have not had time to look at the AC97-TLV, but if it works, I can't > see why I would object. OK. > I have never come across a sound card with linear volumes. Some AK codecs use linear volumes. Also, YMFPCI DSP use for its native volume controls. > Could you identify a few of them, and also better explain the formula > you are using for the conversion to dB gain. > *db_gain = (long)(100.0 * 20.0 * > log10((double)(volume - rec->min) / > (double)(max - min))); A standard definition of dB (and x100 for alsa-lib unit). > So, 0 dB is when (volume - rec->min) / (max - min) == 1 > So, for +6 dB gain, the volume will need to be higher than max? > Does this sound right? In that case, maybe "max" is not a good name for > it because volume can be greater than max. Hm, right, I didn't think of overload case with a linear volume codec. By min and max, I thought of a "segment" between mute and 0dB (although not implemented rightly in alsa-lib). Maybe min and max should be in (0.01) dB expressions since the min and max "values" are known from snd_ctl_elem_info. The only problem is that we have no standard definition of "mute" in dB expression. In alsa-lib, -9999999 indicates mute. But it should be defined as a constant in a public header. Takashi ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-devel