| 1 | |
| 2 | <refentry id="lastcycle"> |
| 3 | <indexterm id="IndexLastcycle"><primary>lastcycle</primary></indexterm> |
| 4 | <refentryinfo><title>Real-time MIDI:Event Extenders</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>lastcycle</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>lastcycle</refname> |
| 11 | |
| 12 | <refpurpose> |
| 13 | Indicates whether an event is in its last performance cycle. |
| 14 | </refpurpose> |
| 15 | </refnamediv> |
| 16 | |
| 17 | <refsect1> |
| 18 | <title>Description</title> |
| 19 | <para> |
| 20 | Provides a way of knowing if an event is in its last performance cycle. Whether an event has a finite duration (p3 > 0) |
| 21 | or a note is extended via a time extending opcode (like <quote>linsegr</quote> or <quote>xtratim</quote>), this opcode returns 1 |
| 22 | if the event is currently at its last k-cycle. The only sitatuation where <quote>lastcycle</quote> does not detect that the event |
| 23 | will not run for another cycle is when the note is turned off by another event (using <quote>turnoff2</quote>) and is not given |
| 24 | the possibility of running through its release stage (using <quote>turnoff2 instrnum, imode, 0</quote>) |
| 25 | </para> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Syntax</title> |
| 30 | <synopsis>kflag <command>lastcycle</command></synopsis> |
| 31 | </refsect1> |
| 32 | |
| 33 | <refsect1> |
| 34 | <title>Performance</title> |
| 35 | <para> |
| 36 | <emphasis>kflag</emphasis> -- indicates whether the note is in its <quote>last cycle</quote>. (1 if this the last cycle, otherwise 0) |
| 37 | </para> |
| 38 | |
| 39 | <para> |
| 40 | This opcode is useful for performing cleanup actions, signaling to other events that this event is finishing, etc. It works only at performance time. |
| 41 | </para> |
| 42 | </refsect1> |
| 43 | |
| 44 | <refsect1> |
| 45 | <title>Examples</title> |
| 46 | <para> |
| 47 | Here is an example of the lastcycle opcode. It uses the file <ulink url="examples/lastcycle.csd"><citetitle>lastcycle.csd</citetitle></ulink>. |
| 48 | <example> |
| 49 | <title>Example of the lastcycle opcode.</title> |
| 50 | <xi:include href="examples-xml/lastcycle.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 51 | </example> |
| 52 | </para> |
| 53 | |
| 54 | </refsect1> |
| 55 | |
| 56 | <refsect1> |
| 57 | <title>See also</title> |
| 58 | <para><link linkend="MidiExtender"><citetitle>Event Extenders</citetitle></link></para> |
| 59 | </refsect1> |
| 60 | |
| 61 | <refsect1> |
| 62 | <title>Credits</title> |
| 63 | <para>By: &nameeduardo; 2020</para> |
| 64 | <para>New in Csound version 6.14 (2020)</para> |
| 65 | </refsect1> |
| 66 | </refentry> |