| 1 | |
| 2 | <refentry id="elapsedcycles"> |
| 3 | <indexterm id="IndexElapsedcycles"><primary>elapsedcycles</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Time Reading</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>elapsedcycles</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>elapsedcycles</refname> |
| 11 | <refpurpose> |
| 12 | Read absolute time in k-rate cycles. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Read absolute time, in k-rate cycles, since the start of the performance. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ires <command>elapsedcycles</command></synopsis> |
| 26 | |
| 27 | <synopsis>kres <command>elapsedcycles</command></synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Performance</title> |
| 32 | <para> |
| 33 | <emphasis>elapsedcycles</emphasis> is for time in k-rate cycles. So with: |
| 34 | |
| 35 | <informalexample> |
| 36 | <programlisting> |
| 37 | <emphasis role="opc">sr</emphasis> <emphasis role="op">=</emphasis> 44100 |
| 38 | <emphasis role="opc">kr</emphasis> <emphasis role="op">=</emphasis> 6300 |
| 39 | <emphasis role="opc">ksmps</emphasis> <emphasis role="op">=</emphasis> 7</programlisting> |
| 40 | </informalexample> |
| 41 | |
| 42 | then after half a second, the <emphasis>elapsedcycles</emphasis> opcode |
| 43 | would report 3150. It will always report an integer. |
| 44 | </para> |
| 45 | |
| 46 | <para> |
| 47 | <emphasis>elapsedcycles</emphasis> can produce a k-rate variable for |
| 48 | output. There are no input parameters. |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>elapsedcycles</emphasis> can also operate only at the start of |
| 53 | the instance of the instrument. It produces an i-rate variable (starting |
| 54 | with <emphasis>i</emphasis> or <emphasis>gi</emphasis>) as its output. |
| 55 | </para> |
| 56 | |
| 57 | <note> |
| 58 | <para> |
| 59 | <emphasis>elapsedcycles</emphasis> acts like |
| 60 | <link linkend="timek"><citetitle>timek</citetitle></link> but it |
| 61 | returns the correct values instead of being one cycle late. |
| 62 | </para> |
| 63 | </note> |
| 64 | </refsect1> |
| 65 | |
| 66 | <refsect1> |
| 67 | <title>See also</title> |
| 68 | <para><link linkend="ControlTimeread"><citetitle>Time Reading</citetitle></link></para> |
| 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>Credits</title> |
| 73 | <para> |
| 74 | <simplelist> |
| 75 | <member>Author: &nameeduardo;</member> |
| 76 | <member>August 2022</member> |
| 77 | </simplelist> |
| 78 | </para> |
| 79 | </refsect1> |
| 80 | </refentry> |