Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > updates > by-pkgid > 18785641029f14f23cccc82925607ace > files > 17

libalsa2-docs-0.9.0-0.14rc7.1mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Runtime arguments in configuration files</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindex" href="examples.html">Examples</a> &nbsp; </center>
<hr><h1><a name="confarg">Runtime arguments in configuration files</a>
</h1>
<p>

<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>

<p>
<h2><a name="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>@args [ CARD ]  # or
@args.0 CARD
</pre></div>
<p>
<h2><a name="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>@args.CARD {
  type string
  <span class="keywordflow">default</span> <span class="stringliteral">"abcd"</span>
}
</pre></div>
<p>
<h2><a name="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>  card $CARD
</pre></div>
<p>
<h2><a name="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>hw:0,1
hw:CARD=0,DEV=1
hw:{CARD 0 DEV 1}
plug:<span class="stringliteral">"hw:0,1"</span>
plug:{SLAVE=<span class="stringliteral">"hw:{CARD 0 DEV 1}"</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 name="confarg_example">Example</a>
</h2>
<p>
<div class="fragment"><pre>pcm.demo {
        @args [ CARD DEVICE ]
        @args.CARD {
                type string
                <span class="keywordflow">default</span> <span class="stringliteral">"supersonic"</span>
        }
        @args.DEVICE {
                type integer
                <span class="keywordflow">default</span> 0
        }
        type hw
        card $CARD
        device $DEVICE
}
</pre></div>
<p>
<hr><address style="align: right;"><small>Generated on Wed Apr 2 16:06:36 2003 for ALSA project - the C library reference by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.18 </small></address>
</body>
</html>