| 1 | |
| 2 | <refentry id="readclock"> |
| 3 | <indexterm id="IndexReadClock"><primary>readclock</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Time Reading</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>readclock</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>readclock</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Reads the value of an internal clock. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Reads the value of an internal clock. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>ir <command>readclock</command> inum</synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Initialization</title> |
| 33 | <para> |
| 34 | <emphasis>inum</emphasis> -- the number of a clock. There are 32 clocks numbered 0 through 31. All other values are mapped to clock number 32. |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis>ir</emphasis> -- value at i-time, of the clock specified by <emphasis>inum</emphasis> |
| 39 | </para> |
| 40 | </refsect1> |
| 41 | |
| 42 | <refsect1> |
| 43 | <title>Performance</title> |
| 44 | <para> |
| 45 | Between a <link linkend="clockon"><citetitle>clockon</citetitle></link> and a <link linkend="clockoff"><citetitle>clockoff</citetitle></link> opcode, the CPU time used is accumulated in the clock. The precision is machine dependent but is the millisecond range on UNIX and Windows systems. The <emphasis>readclock</emphasis> opcde reads the current value of a clock at initialization time. |
| 46 | </para> |
| 47 | </refsect1> |
| 48 | |
| 49 | <refsect1> |
| 50 | <title>Examples</title> |
| 51 | <para> |
| 52 | Here is an example of the readclock opcode. It uses the file <ulink url="examples/readclock.csd"><citetitle>readclock.csd</citetitle></ulink>. |
| 53 | |
| 54 | <example> |
| 55 | <title>Example of the readclock opcode.</title> |
| 56 | |
| 57 | |
| 58 | |
| 59 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 60 | <xi:include href="examples-xml/readclock.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 61 | </example> |
| 62 | |
| 63 | Its output should include lines like this: |
| 64 | <screen> |
| 65 | instr 1: i1 = 0.000 |
| 66 | instr 1: i1 = 90.000 |
| 67 | instr 1: i1 = 180.000 |
| 68 | </screen> |
| 69 | </para> |
| 70 | </refsect1> |
| 71 | |
| 72 | <refsect1> |
| 73 | <title>See also</title> |
| 74 | <para><link linkend="ControlTimeread"><citetitle>Time Reading</citetitle></link></para> |
| 75 | </refsect1> |
| 76 | |
| 77 | <refsect1> |
| 78 | <title>Credits</title> |
| 79 | <para> |
| 80 | <simplelist> |
| 81 | <member>Author: &namejohn;</member> |
| 82 | <member>University of Bath/Codemist Ltd.</member> |
| 83 | <member>Bath, UK</member> |
| 84 | <member>July, 1999</member> |
| 85 | </simplelist> |
| 86 | </para> |
| 87 | <para>Example written by &namekevin;.</para> |
| 88 | |
| 89 | <para>New in Csound version 3.56</para> |
| 90 | </refsect1> |
| 91 | </refentry> |