From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Courtier-Dutton Subject: Re: Mixer volume/decibel mapping Date: Thu, 20 May 2010 17:13:48 +0100 Message-ID: References: <201005191834.57919.vand2@gmx.de> <201005201141.28755.vand2@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-fx0-f51.google.com (mail-fx0-f51.google.com [209.85.161.51]) by alsa0.perex.cz (Postfix) with ESMTP id 00E601037EC for ; Thu, 20 May 2010 18:13:51 +0200 (CEST) Received: by fxm18 with SMTP id 18so3503761fxm.38 for ; Thu, 20 May 2010 09:13:48 -0700 (PDT) In-Reply-To: <201005201141.28755.vand2@gmx.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: "Sebastian H." Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On 20 May 2010 10:41, Sebastian H. wrote: > > That's clear. > I imagined that maybe the dB scale could be the "real thing" and the volume > steps would be a convenient but possibly coarse mapping into a denser > stepped dB space provided by the hardware/driver. > This was unlikely but I wanted to ask anyway ;-). > I believe it could be extended to support a continuous range. For example, some hardware uses a 32bit value to control the gain. The mix operation is simply "the_sample" * "the_control_value". So in this case the hardware has a linear control that can be considered continuous for our purposes. The conversion from the control value to a usable value would have to include a user land log operation. It was never implemented due to lack of demand. For the cards that do have this 32bit linear value, a simple lookup table is used in the kernel code to convert it to 256 step values. If implemented, one could then introduce professional gain controls that do not produce "clicks" in the output when adjusted. gain controls with steps in them produce clicks when the gain control is adjusted.