From: Takashi Iwai Subject: Re: [PATCH] Adds dB gain to alsa-driver, alsa-lib. Date: Fri, 16 Dec 2005 15:24:50 +0100 Message-ID: References: <43A1B744.2050703@superbug.co.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Jaroslav Kysela Cc: James Courtier-Dutton , alsa-devel List-Id: alsa-devel@alsa-project.org At Thu, 15 Dec 2005 20:13:57 +0100 (CET), Jaroslav Kysela wrote: > > On Thu, 15 Dec 2005, James Courtier-Dutton wrote: > > > I have implemented dB gain reporting for ALSA mixer controls. > > By applying the attached patches to alsa-driver and alsa-lib, one will then > > see dB values appear in alsamixer. (I added support to alsamixer a long time > > ago) > > > > Currently, only the snd-ca0106 sound card reports the values. > > NACK. > > 1) The midlevel code should not know anything about dB scale or so... > It should handle only universal containter / TLV stuff per control. > I'm talking about dB_scale members etc. The TLV should be obtained > from the lowlevel driver using a callback like get. You can provide > the library function to manage TLV in the control midlevel code. > 2) The ca0106 driver is not candidate for such info. The info should > be static somewhere in alsa-lib, probably in the src/control/control.c > and added only when TLV stuff is requested. > 3) I'm still not sure to use integers as keys in the TLV > tree. Of course, it's more efficient than string handling, but > I think that it's not an issue because the amount of transferred > data is low. > 4) Nesting. Do we need this on the driver side? The key might contain > multiple "sub-keys". If we have this information static, it might be > more efficient than your implementation. > > So, what about this (use integers as keys): > > - one key - max 8 * 32-bit subkeys > - value - depending on subkeys, store only the size, might be binary > > or (use strings as keys): > > - one key - max 8 * 16 byte subkeys (ASCII string) > - value - depending on subkeys, store only the size, might be binary > > So the key lookup function will handle max. 256 bytes which is no so bad. > The lowlevel driver might use some key-lookup library functions in the > control midlevel code like snd_control_key_is_db_scale() or so and put > directly the data in the get_key() callback to value area. > > Perhaps, we can use 8 byte strings (it's enough) or use 64-bit values for > sub-keys which might represent strings (I can imagine that first sub-key > will be string and rest of sub-keys might be indexes, strings, 64-bit > values, 64-bit masks etc.). > > In future, if 8-subkeys are not enough, we may create a new ioctl which > will add more space to the whole key. The old ioctl might be simply > emulated with the conversion to new one. Well, I also can't image that so complicated TLV expressions will be ever used. James' implementation already includes the type tag at the very beginning, so it's almost one-key-to-one-conent mapping. The record to be used would very likely only the unnested ones with fixed sizes. OTOH, the string or 256 byte keys look too much to me for our purpuses. It's hard to believe that we'll have so many different keys. Takashi ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click