| 1 | |
| 2 | <refentry id="push"> |
| 3 | <indexterm id="Indexpush"><primary>push</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Stacks</title></refentryinfo> |
| 5 | <refentryinfo><title>Deprecated</title></refentryinfo> |
| 6 | <refmeta> |
| 7 | <refentrytitle>push</refentrytitle> |
| 8 | </refmeta> |
| 9 | |
| 10 | <refnamediv> |
| 11 | <refname>push</refname> |
| 12 | <refpurpose> |
| 13 | Pushes a value into the global stack. Deprecated. |
| 14 | </refpurpose> |
| 15 | </refnamediv> |
| 16 | |
| 17 | <refsect1> |
| 18 | <title>Description</title> |
| 19 | <para>Plugin opcode in stackops.</para> |
| 20 | <para> |
| 21 | Pushes a value into the global stack. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | <refsect1> |
| 25 | <title>Syntax</title> |
| 26 | <synopsis><command>push</command> xval1, [xval2, ... , xval31]</synopsis> |
| 27 | <synopsis><command>push</command> ival1, [ival2, ... , ival31]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>ival1 ... ival31 </emphasis> - values to be pushed into the stack. |
| 34 | </para> |
| 35 | </refsect1> |
| 36 | <refsect1> |
| 37 | <title>Performance</title> |
| 38 | <para> |
| 39 | <emphasis>xval1 ... xval31 </emphasis> - values to be pushed into the stack. |
| 40 | </para> |
| 41 | <para> |
| 42 | The given values are pushed into the global stack as a bundle. The global stack works in LIFO order: after multiple <link linkend="push"><citetitle>push</citetitle></link> calls, <link linkend="pop"><citetitle>pop</citetitle></link> should be used in reverse order. |
| 43 | </para> |
| 44 | <para> |
| 45 | Each <emphasis>push</emphasis> or <link linkend="pop"><citetitle>pop</citetitle></link> operation can work on a "bundle" of multiple variables. When using <link linkend="pop"><citetitle>pop</citetitle></link>, the number, type, and order of items must match those used by the corresponding <emphasis>push</emphasis>. That is, after a 'push Sfoo, ibar', you must call something like 'Sbar, ifoo pop', and not e.g. two separate 'pop' statements. |
| 46 | </para> |
| 47 | <para> |
| 48 | <emphasis>push</emphasis> and <link linkend="pop"><citetitle>pop</citetitle></link> opcodes can take variables of any type (i-, k-, a- and strings). Use of any combination of i, k, a, and S types is allowed. Variables of type 'a' and 'k' are passed at performance time only, while 'i' and 'S' are passed at init time only. |
| 49 | </para> |
| 50 | <para> |
| 51 | push/pop for a, k, i, and S types copy data by value. By contrast, <link linkend="push_f"><citetitle>push_f</citetitle></link> only pushes a "reference" to the f-signal, and then the corresponding <link linkend="pop_f"><citetitle>pop_f</citetitle></link> will copy directly from the original variable to its output signal. For this reason, changing the source f-signal of <link linkend="push_f"><citetitle>push_f</citetitle></link> before <link linkend="pop_f"><citetitle>pop_f</citetitle></link> is called is not recommended, and if the instrument instance owning the variable that was passed by push_f is deactivated before pop_f is called, undefined behavior may occur. |
| 52 | </para> |
| 53 | <para> |
| 54 | Any stack errors (trying to push when there is no more space, or pop from an empty stack, inconsistent number or type of arguments, etc.) are fatal and terminate performance. |
| 55 | </para> |
| 56 | </refsect1> |
| 57 | |
| 58 | <refsect1> |
| 59 | <title>Examples</title> |
| 60 | <para> |
| 61 | Here is an example of the push opcode. It uses the file <ulink url="examples/push.csd"><citetitle>push.csd</citetitle></ulink>. |
| 62 | <example> |
| 63 | <title>Example of the push opcode.</title> |
| 64 | <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> |
| 65 | <xi:include href="examples-xml/push.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 66 | </example> |
| 67 | </para> |
| 68 | </refsect1> |
| 69 | |
| 70 | <refsect1> |
| 71 | <title>See also</title> |
| 72 | <para><link linkend="ControlStacks"><citetitle>Stacks</citetitle></link></para> |
| 73 | <para>Using this opcode is somewhat hackish, as you can read here: <ulink url="http://csound.1045644.n5.nabble.com/passing-a-string-to-a-UDO-td1099284.html"></ulink></para> |
| 74 | </refsect1> |
| 75 | |
| 76 | <refsect1> |
| 77 | <title>Credits</title> |
| 78 | <para>By: &nameistvan;.</para> |
| 79 | <para>2006</para> |
| 80 | <para>Deprecated as of version 6.04.</para> |
| 81 | </refsect1> |
| 82 | </refentry> |