| 1 | |
| 2 | <refentry id="eventcycles"> |
| 3 | <indexterm id="IndexEventcycles"><primary>eventcycles</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Time Reading</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>eventcycles</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>eventcycles</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 an |
| 20 | instance of an instrument. Called at both i-time as well as |
| 21 | k-time. NB: the returned value at k-time starts at 1 |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>kres <command>eventcycles</command></synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Performance</title> |
| 32 | <para> |
| 33 | <emphasis>eventcycles</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>eventcycles</emphasis> opcode would |
| 43 | report 3150. It will always report an integer. |
| 44 | </para> |
| 45 | |
| 46 | <para> |
| 47 | <emphasis>eventcycles</emphasis> produces a k-rate variable for output. |
| 48 | There are no input parameters. |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>eventcycles</emphasis> is similar to |
| 53 | <link linkend="elapsedcycles"><citetitle>elapsedcycles</citetitle></link> |
| 54 | except it returns the time since the start of this instance of the |
| 55 | instrument. |
| 56 | </para> |
| 57 | |
| 58 | <note> |
| 59 | <para> |
| 60 | <emphasis>eventcycles</emphasis> acts like |
| 61 | <link linkend="timeinstk"><citetitle>timeinstk</citetitle></link> but it |
| 62 | returns the correct values instead of being one cycle late. |
| 63 | </para> |
| 64 | </note> |
| 65 | </refsect1> |
| 66 | |
| 67 | <refsect1> |
| 68 | <title>See also</title> |
| 69 | <para><link linkend="ControlTimeread"><citetitle>Time Reading</citetitle></link></para> |
| 70 | </refsect1> |
| 71 | |
| 72 | <refsect1> |
| 73 | <title>Credits</title> |
| 74 | <para> |
| 75 | <simplelist> |
| 76 | <member>Author: &nameeduardo;</member> |
| 77 | <member>August 2022</member> |
| 78 | </simplelist> |
| 79 | </para> |
| 80 | </refsect1> |
| 81 | </refentry> |