Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > by-pkgid > 34546d63baef3ab2a7675f37737b66ab > files > 23

libalsa2-docs-1.0.23-2.1mdv2010.1.i586.rpm

<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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"/>
<title>ALSA project - the C library reference: Runtime arguments in configuration files</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <img id="MSearchSelect" src="search/search.png"
             onmouseover="return searchBox.OnSearchSelectShow()"
             onmouseout="return searchBox.OnSearchSelectHide()"
             alt=""/>
        <input type="text" id="MSearchField" value="Search" accesskey="S"
             onfocus="searchBox.OnSearchFieldFocus(true)" 
             onblur="searchBox.OnSearchFieldFocus(false)" 
             onkeyup="searchBox.OnSearchFieldChange(event)"/>
        <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="contents">


<h1><a class="anchor" id="confarg">Runtime arguments in configuration files </a></h1><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>
<h2><a class="anchor" id="confarg_define">
Defining arguments</a></h2>
<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"><pre class="fragment">@args [ CARD ]  # or
@args.0 CARD
</pre></div><h2><a class="anchor" id="confarg_type">
Defining argument types and default values</a></h2>
<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"><pre class="fragment">@args.CARD {
  type <span class="keywordtype">string</span>
  <span class="keywordflow">default</span> <span class="stringliteral">&quot;abcd&quot;</span>
}
</pre></div><h2><a class="anchor" id="confarg_refer">
Referring to arguments</a></h2>
<p>Arguments are referred to with a dollar-sign ($) and the name of the argument:</p>
<div class="fragment"><pre class="fragment">  card $CARD
</pre></div><h2><a class="anchor" id="confarg_usage">
Usage</a></h2>
<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"><pre class="fragment">hw:0,1
hw:CARD=0,DEV=1
hw:{CARD 0 DEV 1}
plug:<span class="stringliteral">&quot;hw:0,1&quot;</span>
plug:{SLAVE=<span class="stringliteral">&quot;hw:{CARD 0 DEV 1}&quot;</span>}
</pre></div><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>
<h2><a class="anchor" id="confarg_example">
Example</a></h2>
<div class="fragment"><pre class="fragment">pcm.demo {
        @args [ CARD DEVICE ]
        @args.CARD {
                type <span class="keywordtype">string</span>
                <span class="keywordflow">default</span> <span class="stringliteral">&quot;supersonic&quot;</span>
        }
        @args.DEVICE {
                type integer
                <span class="keywordflow">default</span> 0
        }
        type hw
        card $CARD
        device $DEVICE
}
</pre></div> </div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&nbsp;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&nbsp;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address style="text-align: right;"><small>Generated on Sat Nov 20 07:42:24 2010 for ALSA project - the C library reference by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>