diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2007-09-10 02:05:19 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 10:49:17 -0400 |
commit | d1761d1b14158498d4782d555a9b367ea4647224 (patch) | |
tree | 85abe818de9c6771f89344acdf4fe99f0bfb0f3f /Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |
parent | 950fb626dc28e17ae4ad01dba07957bdc6e0b997 (diff) |
[ALSA] document basic TLV stuff
Add documentation about how to define dB scale information for mixer
controls.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl')
-rw-r--r-- | Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index b9d2dbee9bc3..2c3fc3cb3b6b 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -18,8 +18,8 @@ | |||
18 | </affiliation> | 18 | </affiliation> |
19 | </author> | 19 | </author> |
20 | 20 | ||
21 | <date>July 26, 2007</date> | 21 | <date>September 10, 2007</date> |
22 | <edition>0.3.6.1</edition> | 22 | <edition>0.3.7</edition> |
23 | 23 | ||
24 | <abstract> | 24 | <abstract> |
25 | <para> | 25 | <para> |
@@ -3473,6 +3473,13 @@ struct _snd_pcm_runtime { | |||
3473 | </para> | 3473 | </para> |
3474 | 3474 | ||
3475 | <para> | 3475 | <para> |
3476 | The <structfield>tlv</structfield> field can be used to provide | ||
3477 | metadata about the control; see the | ||
3478 | <link linkend="control-interface-tlv"> | ||
3479 | <citetitle>Metadata</citetitle></link> subsection. | ||
3480 | </para> | ||
3481 | |||
3482 | <para> | ||
3476 | The other three are | 3483 | The other three are |
3477 | <link linkend="control-interface-callbacks"><citetitle> | 3484 | <link linkend="control-interface-callbacks"><citetitle> |
3478 | callback functions</citetitle></link>. | 3485 | callback functions</citetitle></link>. |
@@ -3871,6 +3878,56 @@ struct _snd_pcm_runtime { | |||
3871 | </para> | 3878 | </para> |
3872 | </section> | 3879 | </section> |
3873 | 3880 | ||
3881 | <section id="control-interface-tlv"> | ||
3882 | <title>Metadata</title> | ||
3883 | <para> | ||
3884 | To provide information about the dB values of a mixer control, use | ||
3885 | on of the <constant>DECLARE_TLV_xxx</constant> macros from | ||
3886 | <filename><sound/tlv.h></filename> to define a variable | ||
3887 | containing this information, set the<structfield>tlv.p | ||
3888 | </structfield> field to point to this variable, and include the | ||
3889 | <constant>SNDRV_CTL_ELEM_ACCESS_TLV_READ</constant> flag in the | ||
3890 | <structfield>access</structfield> field; like this: | ||
3891 | <informalexample> | ||
3892 | <programlisting> | ||
3893 | <![CDATA[ | ||
3894 | static DECLARE_TLV_DB_SCALE(db_scale_my_control, -4050, 150, 0); | ||
3895 | |||
3896 | static struct snd_kcontrol_new my_control __devinitdata = { | ||
3897 | ... | ||
3898 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | ||
3899 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | ||
3900 | ... | ||
3901 | .tlv.p = db_scale_my_control, | ||
3902 | }; | ||
3903 | ]]> | ||
3904 | </programlisting> | ||
3905 | </informalexample> | ||
3906 | </para> | ||
3907 | |||
3908 | <para> | ||
3909 | The <function>DECLARE_TLV_DB_SCALE</function> macro defines | ||
3910 | information about a mixer control where each step in the control's | ||
3911 | value changes the dB value by a constant dB amount. | ||
3912 | The first parameter is the name of the variable to be defined. | ||
3913 | The second parameter is the minimum value, in units of 0.01 dB. | ||
3914 | The third parameter is the step size, in units of 0.01 dB. | ||
3915 | Set the fourth parameter to 1 if the minimum value actually mutes | ||
3916 | the control. | ||
3917 | </para> | ||
3918 | |||
3919 | <para> | ||
3920 | The <function>DECLARE_TLV_DB_LINEAR</function> macro defines | ||
3921 | information about a mixer control where the control's value affects | ||
3922 | the output linearly. | ||
3923 | The first parameter is the name of the variable to be defined. | ||
3924 | The second parameter is the minimum value, in units of 0.01 dB. | ||
3925 | The third parameter is the maximum value, in units of 0.01 dB. | ||
3926 | If the minimum value mutes the control, set the second parameter to | ||
3927 | <constant>TLV_DB_GAIN_MUTE</constant>. | ||
3928 | </para> | ||
3929 | </section> | ||
3930 | |||
3874 | </chapter> | 3931 | </chapter> |
3875 | 3932 | ||
3876 | 3933 | ||