<?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>pindex</title> <link rel="stylesheet" href="csound.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /> <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="phasorbnk.html" title="phasorbnk" /> <link rel="next" href="pinkish.html" title="pinkish" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">pindex</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="phasorbnk.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="pinkish.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="pindex"> <a id="pindex"></a> <div class="titlepage"></div> <a id="IndexPindex" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">pindex</span> </h2> <p>pindex — Returns the value of a specified pfield. </p> </div> <div class="refsect1" title="Description"> <a id="id3101991"></a> <h2>Description</h2> <p> <span class="emphasis"><em>pindex</em></span> returns the value of a specified pfield. </p> </div> <div class="refsect1" title="Syntax"> <a id="id3102007"></a> <h2>Syntax</h2> <pre class="synopsis">ivalue <span class="command"><strong>pindex</strong></span> ipfieldIndex</pre> </div> <div class="refsect1" title="Initialization"> <a id="id3102222"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ipfieldIndex</em></span> - pfield number to query. </p> <p> <span class="emphasis"><em>ivalue</em></span> - value of the pfield. </p> </div> <div class="refsect1" title="Examples"> <a id="id3102249"></a> <h2>Examples</h2> <p> Here is an example of the pindex opcode. It uses the file <a class="ulink" href="examples/pindex.csd" target="_top"><em class="citetitle">pindex.csd</em></a>. </p> <div class="example"> <a id="id3102264"></a> <p class="title"> <b>Example 437. Example of the pindex opcode.</b> </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> <pre class="programlisting"> <span class="csdtag"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="comment">; Select audio/midi flags here according to platform</span> <span class="comment">; Audio out Audio in No messages MIDI in</span> -odac -iadc <span class="comment">; -d -M0 ;;;RT audio I/O with MIDI in</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">;-o pindex.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="comment">;Example by Anthony Kozar Dec 2006</span> <span class="oblock">instr</span> 1 inum <span class="opc">pcount</span> index <span class="opc">init</span> 1 loop1<span class="op">:</span> ivalue <span class="opc">pindex</span> index <span class="opc">printf_i</span> "p<span class="op">%</span>d <span class="op">=</span> <span class="op">%</span>f\n", 1, index, ivalue index <span class="op">=</span> index <span class="op">+</span> 1 <span class="octrl">if</span> (index <span class="op"><=</span> inum) <span class="octrl">igoto</span> loop1 <span class="opc">print</span> inum <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span>1 0 3 40 50 <span class="comment">; has 5 pfields</span> <span class="stamnt">i</span>1 1 2 80 <span class="comment">; has 5 due to carry</span> <span class="stamnt">i</span>1 2 1 40 50 60 70 <span class="comment">; has 7</span> <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> <p> The example will produce the following output: </p> <pre class="screen"> new alloc for instr 1: WARNING: instr 1 uses 3 p-fields but is given 5 p1 = 1.000000 p2 = 0.000000 p3 = 3.000000 p4 = 40.000000 p5 = 50.000000 instr 1: inum = 5.000 B 0.000 .. 1.000 T 1.000 TT 1.000 M: 0.0 new alloc for instr 1: WARNING: instr 1 uses 3 p-fields but is given 5 p1 = 1.000000 p2 = 1.000000 p3 = 2.000000 p4 = 80.000000 p5 = 50.000000 instr 1: inum = 5.000 B 1.000 .. 2.000 T 2.000 TT 2.000 M: 0.0 new alloc for instr 1: WARNING: instr 1 uses 3 p-fields but is given 7 p1 = 1.000000 p2 = 2.000000 p3 = 1.000000 p4 = 40.000000 p5 = 50.000000 p6 = 60.000000 p7 = 70.000000 instr 1: inum = 7.000 </pre> <p> The warnings can be ignored, because the pfields are used indirectly through pindex instead of explicitly through p4, p5, etc. </p> </div> <div class="refsect1" title="See Also"> <a id="id3102859"></a> <h2>See Also</h2> <p> <a class="link" href="pcount.html" title="pcount"><em class="citetitle">pcount</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="id3102877"></a> <h2>Credits</h2> <p>Example by: Anthony Kozar</p> <p>Dec. 2006</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="phasorbnk.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="pinkish.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">phasorbnk </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> pinkish</td> </tr> </table> </div> </body> </html>