Current File : //proc/self/root/kunden/usr/share/doc/alsa-lib-devel/doxygen/html/confarg.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ALSA project - the C library reference: Runtime arguments in configuration files</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">ALSA project - the C library reference
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="index.html">Index, Preamble and License</a></li> </ul>
</div>
</div><!-- top -->
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">Runtime arguments in configuration files </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>The ALSA library can accept runtime arguments for some configuration blocks. This extension is built on top of the basic configuration file syntax.</p>
<h1><a class="anchor" id="confarg_define"></a>
Defining arguments</h1>
<p>Arguments are defined using the id (key) <code>@args</code> and array values containing the string names of the arguments:</p>
<div class="fragment"><div class="line">@args [ CARD ] # or</div>
<div class="line">@args.0 CARD</div>
</div><!-- fragment --><h1><a class="anchor" id="confarg_type"></a>
Defining argument types and default values</h1>
<p>An argument's type is specified with the id (key) <code>@args</code> and the argument name. The type and the default value are specified in the compound block:</p>
<div class="fragment"><div class="line">@args.CARD {</div>
<div class="line"> <a class="code" href="ump__msg_8h.html#ad44b615021ed3ccb734fcaf583ef4a03">type</a> <span class="keywordtype">string</span></div>
<div class="line"> <span class="keywordflow">default</span> <span class="stringliteral">"abcd"</span></div>
<div class="line">}</div>
<div class="ttc" id="aump__msg_8h_html_ad44b615021ed3ccb734fcaf583ef4a03"><div class="ttname"><a href="ump__msg_8h.html#ad44b615021ed3ccb734fcaf583ef4a03">type</a></div><div class="ttdeci">uint8_t type</div><div class="ttdef"><b>Definition:</b> ump_msg.h:13</div></div>
</div><!-- fragment --><h1><a class="anchor" id="confarg_refer"></a>
Referring to arguments</h1>
<p>Arguments are referred to with a dollar-sign ($) and the name of the argument:</p>
<div class="fragment"><div class="line">card $CARD</div>
</div><!-- fragment --><h1><a class="anchor" id="confarg_math"></a>
simple math expressions</h1>
<p>The simple math expressions are identified using a unix shell like expression syntax with a dollar-sign ($) and bracket ([):</p>
<div class="fragment"><div class="line">card <span class="stringliteral">"$[$CARD + 1]"</span></div>
</div><!-- fragment --><h1><a class="anchor" id="confarg_usage"></a>
Usage</h1>
<p>To use a block with arguments, write the argument values after the key, separated with a colon (:). For example, all these names for PCM interfaces give the same result:</p>
<div class="fragment"><div class="line">hw:0,1</div>
<div class="line">hw:CARD=0,DEV=1</div>
<div class="line">hw:{CARD 0 DEV 1}</div>
<div class="line">plug:<span class="stringliteral">"hw:0,1"</span></div>
<div class="line">plug:{SLAVE=<span class="stringliteral">"hw:{CARD 0 DEV 1}"</span>}</div>
</div><!-- fragment --><p>As you see, arguments can be specified in their proper order or by name. Note that arguments enclosed in braces are parsed in the same way as in configuration files, but using the override method by default.</p>
<h1><a class="anchor" id="confarg_example"></a>
Example</h1>
<div class="fragment"><div class="line">pcm.demo {</div>
<div class="line"> @args [ CARD DEVICE ]</div>
<div class="line"> @args.CARD {</div>
<div class="line"> <a class="code" href="ump__msg_8h.html#ad44b615021ed3ccb734fcaf583ef4a03">type</a> <span class="keywordtype">string</span></div>
<div class="line"> <span class="keywordflow">default</span> <span class="stringliteral">"supersonic"</span></div>
<div class="line"> }</div>
<div class="line"> @args.DEVICE {</div>
<div class="line"> <a class="code" href="ump__msg_8h.html#ad44b615021ed3ccb734fcaf583ef4a03">type</a> integer</div>
<div class="line"> <span class="keywordflow">default</span> 0</div>
<div class="line"> }</div>
<div class="line"> <a class="code" href="ump__msg_8h.html#ad44b615021ed3ccb734fcaf583ef4a03">type</a> hw</div>
<div class="line"> card $CARD</div>
<div class="line"> device $DEVICE</div>
<div class="line">}</div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>