Debian Codegraph @

opcodes/chnget.xml

raw symbols SCIP
1
2 <refentry id="chnget">
3 <indexterm id="Indexchnget"><primary>chnget</primary></indexterm>
4 <refentryinfo><title>Signal I/O:Software Bus</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>chnget</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>chnget</refname>
11 <refpurpose>
12 Reads data from the software bus.
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 Reads data from a channel of the inward named software bus.
20 Implies declaring the channel with <emphasis>imode</emphasis>=1 (see also
21 <link linkend="chn"><citetitle>chn_k, chn_a, and chn_S</citetitle></link>).
22 </para>
23 </refsect1>
24
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis>ival <command>chnget</command> Sname</synopsis>
28 <synopsis>kval <command>chnget</command> Sname</synopsis>
29 <synopsis>aval <command>chnget</command> Sname</synopsis>
30 <synopsis>Sval <command>chnget</command> Sname</synopsis>
31 <synopsis>Sval <command>chngetks</command> Sname</synopsis>
32 <synopsis>ival[] <command>chngeti</command> Sname[]</synopsis>
33 <synopsis>kval[] <command>chngetk</command> Sname[]</synopsis>
34 <synopsis>aval[] <command>chngeta</command> Sname[]</synopsis>
35 <synopsis>Sval[] <command>chngets</command> Sname[]</synopsis>
36 </refsect1>
37
38 <refsect1>
39 <title>Initialization</title>
40 <para>
41 <emphasis>Sname</emphasis> -- a string that identifies a channel
42 of the named software bus to read.
43 </para>
44 <para>
45 <emphasis>Sname[]</emphasis> -- an array of named software channels to query.
46 </para>
47 <para>
48 <emphasis>ival</emphasis> -- the control value read at i-time.
49 </para>
50 <para>
51 <emphasis>Sval</emphasis> -- the string value read at i-time.
52 </para>
53 <para>
54 <emphasis>ival[]</emphasis> -- an array of control values read at i-time.
55 </para>
56 <para>
57 <emphasis>Sval{}</emphasis> -- an array of strings read at i-time.
58 </para>
59 </refsect1>
60
61 <refsect1>
62 <title>Performance</title>
63 <para>
64 <emphasis>kval</emphasis> -- the control value read at performance time.
65 </para>
66 <para>
67 <emphasis>kval[]</emphasis> -- an array of control values read at performance time.
68 </para>
69 <para>
70 <emphasis>aval</emphasis> -- the audio signal read at performance time.
71 </para>
72 <para>
73 <emphasis>aval[]</emphasis> -- the array of audio vectors read at performance time.
74 </para>
75 <para>
76 <emphasis>Sval</emphasis> -- the string value read at
77 k-rate. The chnget opcode works both at i-time and perf-time,
78 whereas chngetks works only at perf-time. String variables are only
79 updated if the channel has changed.
80 </para>
81 </refsect1>
82
83 <note>
84 <para>
85 Although it is possible to loop through channel names from an array with <emphasis>chnget</emphasis> and <emphasis>chnset</emphasis>,
86 using the array based variants is more efficient.
87 </para>
88 </note>
89
90 <refsect1>
91 <title>Example</title>
92 <para>
93 The example shows the software bus being used as an asynchronous
94 control signal to select a filter cutoff. It assumes that an
95 external program that has access to the API is feeding the values.
96 </para>
97
98 <informalexample>
99 <programlisting>
100 <emphasis role="ohdr">sr</emphasis> <emphasis role="op">=</emphasis> 44100
101 <emphasis role="ohdr">kr</emphasis> <emphasis role="op">=</emphasis> 100
102 <emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 1
103
104 <emphasis role="oblock">instr</emphasis> 1
105 kc <emphasis role="opc">chnget</emphasis> "cutoff"
106 a1 <emphasis role="opc">oscil</emphasis> p4, p5, 100
107 a2 <emphasis role="opc">lowpass2</emphasis> a1, kc, 200
108 <emphasis role="opc">out</emphasis> a2
109 <emphasis role="oblock">endin</emphasis>
110 </programlisting>
111 </informalexample>
112 <para>
113 Here is another example of the chnget opcode. It uses the file <ulink url="examples/chnget.csd"><citetitle>chnget.csd</citetitle></ulink>.
114 <example>
115 <title>Example of the chnget opcode.</title>
116 <xi:include href="examples-xml/chnget.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
117 </example>
118 </para>
119 </refsect1>
120
121 <refsect1>
122 <title>See also</title>
123 <para><link linkend="SoftwareBus"><citetitle>Software Bus</citetitle></link></para>
124 </refsect1>
125
126 <refsect1>
127 <title>Credits</title>
128 <para>
129 <simplelist>
130 <member>Author: &nameistvan;</member>
131 <member>2005</member>
132 <member>Array based channel opcodes added in version 6.14 - Rory Walsh</member>
133 </simplelist>
134 </para>
135 </refsect1>
136 </refentry>