Debian Codegraph @

opcodes/stack.xml

raw symbols SCIP
1
2 <refentry id="stack">
3 <indexterm id="IndexStack"><primary>stack</primary></indexterm>
4 <refentryinfo><title>Instrument Control:Stacks</title></refentryinfo>
5 <refentryinfo><title>Deprecated</title></refentryinfo>
6 <refmeta>
7 <refentrytitle>stack</refentrytitle>
8 </refmeta>
9
10 <refnamediv>
11 <refname>stack</refname>
12 <refpurpose>
13 Initializes the stack. Deprecated.
14 </refpurpose>
15
16 </refnamediv>
17
18 <refsect1>
19 <title>Description</title>
20 <para>Plugin opcode in stackops.</para>
21 <para>
22 Initializes and sets the size of the global stack.
23 </para>
24 </refsect1>
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis><command>stack</command> iStackSize</synopsis>
28 </refsect1>
29
30 <refsect1>
31 <title>Initialization</title>
32 <para>
33 <emphasis>iStackSize</emphasis> - size of the stack in bytes.
34 </para>
35 </refsect1>
36 <refsect1>
37 <title>Performance</title>
38 <para>
39 Csound implements a single global stack. Initializing the stack with the <emphasis>stack</emphasis> opcode is not required - it is optional, and if not done, the first use of <link linkend="push"><citetitle>push</citetitle></link> or <link linkend="push_f"><citetitle>push_f</citetitle></link> will automatically create a stack of 32768 bytes. Otherwise, <emphasis>stack</emphasis> is normally called from the orchestra header, and takes a stack size parameter in bytes (there is an upper limit of about 16 MB). Once set, the stack size is fixed and cannot be changed during performance.
40 </para>
41 <para>
42 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 <link linkend="push"><citetitle>push</citetitle></link> 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 <link linkend="push"><citetitle>push</citetitle></link>. 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 <link linkend="push"><citetitle>push</citetitle></link> and <link linkend="pop"><citetitle>pop</citetitle></link> opcodes can take variables of any type (i-, k-, a- and strings). 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 stack opcode. It uses the file <ulink url="examples/stack.csd"><citetitle>stack.csd</citetitle></ulink>.
62 <example>
63 <title>Example of the stack 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/stack.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>