<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!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/html; charset=UTF-8" /> <title>getcfg</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" /> <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="gendyx.html" title="gendyx" /> <link rel="next" href="getcol.html" title="getcol" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">getcfg</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="gendyx.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="getcol.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="getcfg"></a> <div class="titlepage"></div> <a id="Indexgetcfg" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">getcfg</span> </h2> <p>getcfg — Return Csound settings. </p> </div> <div class="refsect1"> <a id="idm281472927093080"></a> <h2>Description</h2> <p> Return various configuration settings in Svalue as a string at init time. </p> </div> <div class="refsect1"> <a id="idm281472927049592"></a> <h2>Syntax</h2> <pre class="synopsis">Svalue <span class="command"><strong>getcfg</strong></span> iopt</pre> </div> <div class="refsect1"> <a id="idm281472927047384"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>iopt</em></span> -- The parameter to be returned, can be one of: </p> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <p>1: the maximum length of string variables in characters; this is at least the value of the -+max_str_len command line option - 1. </p> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top">In Csound6 there is no maximum string length so the returned value is meaningless</td> </tr> </table> </div> </li> <li class="listitem"> <p>2: the input sound file name (-i), or empty if there is no input file</p> </li> <li class="listitem"> <p>3: the output sound file name (-o), or empty if there is no output file</p> </li> <li class="listitem"> <p>4: return "1" if real time audio input or output is being used, and "0" otherwise</p> </li> <li class="listitem"> <p>5: return "1" if running in beat mode (-t command line option), and "0" otherwise</p> </li> <li class="listitem"> <p>6: the host operating system name</p> </li> <li class="listitem"> <p>7: return "1" if a callback function for the chnrecv and chnsend opcodes has been set, and "0" otherwise (which means these opcodes do nothing)</p> </li> </ul> </div> <p> </p> </div> <div class="refsect1"> <a id="idm281472927039032"></a> <h2>Examples</h2> <p> Here is an example of the getcfg opcode. It uses the file <a class="ulink" href="examples/getcfg.csd" target="_top"><em class="citetitle">getcfg.csd</em></a>. </p> <div class="example"> <a id="idm281472927037176"></a> <p class="title"> <strong>Example 383. Example of the getcfg opcode.</strong> </p> <div class="example-contents"> <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p> <div class="refsect1"> <a id="idm281472757058488"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> <span class="c1">; Select audio/midi flags here according to platform</span> -odac <span class="c1">;;;realtime audio out</span> -iadc <span class="c1">;;;uncomment -iadc if realtime audio input is needed too</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">32</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">2</span> <span class="vg">0dbfs</span> <span class="o">=</span> <span class="mi">1</span> <span class="kd">instr</span> <span class="nf">1</span> S<span class="n">1</span> <span class="nb">getcfg</span> <span class="mi">1</span> <span class="c1">; -+max_str_len </span> S<span class="n">2</span> <span class="nb">getcfg</span> <span class="mi">2</span> <span class="c1">; -i </span> S<span class="n">3</span> <span class="nb">getcfg</span> <span class="mi">3</span> <span class="c1">; -o </span> S<span class="n">4</span> <span class="nb">getcfg</span> <span class="mi">4</span> <span class="c1">; RTaudio </span> S<span class="n">5</span> <span class="nb">getcfg</span> <span class="mi">5</span> <span class="c1">; -t </span> S<span class="n">6</span> <span class="nb">getcfg</span> <span class="mi">6</span> <span class="c1">; os system host </span> S<span class="n">7</span> <span class="nb">getcfg</span> <span class="mi">7</span> <span class="c1">; callback </span> <span class="nb">prints</span> <span class="s">"------------------------------"</span> <span class="nb">prints</span> <span class="s">"</span><span class="se">\n</span><span class="s">Max string len : "</span> <span class="nb">prints</span> S<span class="n">1</span> <span class="nb">prints</span> <span class="s">"</span><span class="se">\n</span><span class="s">Input file name (-i) : "</span> <span class="nb">prints</span> S<span class="n">2</span> <span class="nb">prints</span> <span class="s">"</span><span class="se">\n</span><span class="s">Output file name (-o) : "</span> <span class="nb">prints</span> S<span class="n">3</span> <span class="nb">prints</span> <span class="s">"</span><span class="se">\n</span><span class="s">RTaudio (-odac) : "</span> <span class="nb">prints</span> S<span class="n">4</span> <span class="nb">prints</span> <span class="s">"</span><span class="se">\n</span><span class="s">Beat mode (-t)? : "</span> <span class="nb">prints</span> S<span class="n">5</span> <span class="nb">prints</span> <span class="s">"</span><span class="se">\n</span><span class="s">Host Op. Sys. : "</span> <span class="nb">prints</span> S<span class="n">6</span> <span class="nb">prints</span> <span class="s">"</span><span class="se">\n</span><span class="s">Callback ? : "</span> <span class="nb">prints</span> S<span class="n">7</span> <span class="nb">prints</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span> <span class="nb">prints</span> <span class="s">"------------------------------</span><span class="se">\n</span><span class="s">"</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">0</span> <span class="nb">e</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> The output should include lines like these: </p> <pre class="screen"> ------------------------------ Max string len : 255 Input file name (-i) : adc Output file name (-o) : dac RTaudio (-odac) : 1 Beat mode (-t)? : 0 Host Op. Sys. : Linux Callback ? : 0 ------------------------------ </pre> <p> </p> </div> <div class="refsect1"> <a id="idm281472927031944"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Istvan Varga</td> </tr> <tr> <td>2006</td> </tr> </table> <p> </p> <p>New in version 5.02</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="gendyx.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="getcol.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">gendyx </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> getcol</td> </tr> </table> </div> </body> </html>