1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Metadata</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Writing an ALSA Driver"><link rel="up" href="control-interface.html" title="Chapter 6. Control Interface"><link rel="prev" href="control-interface-change-notification.html" title="Change Notification"><link rel="next" href="api-ac97.html" title="Chapter 7. API for AC97 Codec"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Metadata</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="control-interface-change-notification.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Control Interface</th><td width="20%" align="right"> <a accesskey="n" href="api-ac97.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="control-interface-tlv"></a>Metadata</h2></div></div></div><p> 2 To provide information about the dB values of a mixer control, use 3 on of the <code class="constant">DECLARE_TLV_xxx</code> macros from 4 <code class="filename"><sound/tlv.h></code> to define a variable 5 containing this information, set the<em class="structfield"><code>tlv.p 6 </code></em> field to point to this variable, and include the 7 <code class="constant">SNDRV_CTL_ELEM_ACCESS_TLV_READ</code> flag in the 8 <em class="structfield"><code>access</code></em> field; like this: 9 </p><div class="informalexample"><pre class="programlisting"> 10 11 static DECLARE_TLV_DB_SCALE(db_scale_my_control, -4050, 150, 0); 12 13 static struct snd_kcontrol_new my_control = { 14 ... 15 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 16 SNDRV_CTL_ELEM_ACCESS_TLV_READ, 17 ... 18 .tlv.p = db_scale_my_control, 19 }; 20 21 </pre></div><p> 22 </p><p> 23 The <code class="function">DECLARE_TLV_DB_SCALE</code> macro defines 24 information about a mixer control where each step in the control's 25 value changes the dB value by a constant dB amount. 26 The first parameter is the name of the variable to be defined. 27 The second parameter is the minimum value, in units of 0.01 dB. 28 The third parameter is the step size, in units of 0.01 dB. 29 Set the fourth parameter to 1 if the minimum value actually mutes 30 the control. 31 </p><p> 32 The <code class="function">DECLARE_TLV_DB_LINEAR</code> macro defines 33 information about a mixer control where the control's value affects 34 the output linearly. 35 The first parameter is the name of the variable to be defined. 36 The second parameter is the minimum value, in units of 0.01 dB. 37 The third parameter is the maximum value, in units of 0.01 dB. 38 If the minimum value mutes the control, set the second parameter to 39 <code class="constant">TLV_DB_GAIN_MUTE</code>. 40 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="control-interface-change-notification.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="control-interface.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="api-ac97.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Change Notification </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. API for AC97 Codec</td></tr></table></div></body></html> 41