Skip to content

Commit 0871131

Browse files
authored
Merge 4877fe4 into aa254fb
2 parents aa254fb + 4877fe4 commit 0871131

File tree

6 files changed

+146
-0
lines changed

6 files changed

+146
-0
lines changed

examples/ftexists.csd

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<CsoundSynthesizer>
2+
<CsOptions>
3+
4+
--nosound
5+
6+
</CsOptions>
7+
8+
<CsInstruments>
9+
10+
; This is the example file for ftexists
11+
12+
/*
13+
14+
ftexists
15+
16+
Returns 1 if a given table index refers to an existing
17+
ftable
18+
19+
iexists ftexists ifn
20+
kexists ftexists kfn
21+
22+
Args:
23+
ifn / kfn: the table index to query
24+
25+
Returns:
26+
iexists / kexists: 1 if a table with index ifn exists, 0 otherwise
27+
28+
*/
29+
30+
gifn1 ftgen 0, 0, 8, 2, 0
31+
32+
instr 1
33+
iexists1 ftexists gifn1
34+
print iexists1
35+
36+
iexists2 ftexists 2
37+
print iexists2
38+
39+
kexists ftexists 3
40+
printf "table 3 exists at time %f", kexists, timeinsts()
41+
endin
42+
43+
</CsInstruments>
44+
45+
<CsScore>
46+
47+
f 2 0 8 2 0
48+
f 3 1.5 8 2 0
49+
50+
i 1 0 2
51+
52+
</CsScore>
53+
</CsoundSynthesizer>

manual.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,8 @@
16301630
<!ENTITY opcodesreshapearray SYSTEM "opcodes/reshapearray.xml">
16311631
<!ENTITY opcodesftslice SYSTEM "opcodes/ftslice.xml">
16321632
<!ENTITY opcodesftprint SYSTEM "opcodes/ftprint.xml">
1633+
<!ENTITY opcodesftexists SYSTEM "opcodes/ftexists.xml">
1634+
16331635
<!ENTITY opcodestab2array SYSTEM "opcodes/tab2array.xml">
16341636

16351637
<!ENTITY opcodeszdf_1pole SYSTEM "opcodes/zdf_1pole.xml">

opcodes/ftchnls.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ instr 1: ichnls = 2.000
5858
<link linkend="ftlptim"><citetitle>ftlptim</citetitle></link>,
5959
<link linkend="ftsr"><citetitle>ftsr</citetitle></link>,
6060
<link linkend="nsamp"><citetitle>nsamp</citetitle></link>
61+
<link linkend="ftexists"><citetitle>ftexists</citetitle></link>
62+
6163
</para>
6264
</refsect1>
6365

opcodes/ftexists.xml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!--Change refentry id and indexterm id-->
2+
<refentry id="ftexists">
3+
<indexterm id="IndexFtexists"><primary>ftexists</primary></indexterm>
4+
<!--Make sure the category below is a valid one! See categories.py-->
5+
<refentryinfo><title>Table Control:Table Queries</title></refentryinfo>
6+
<refmeta>
7+
<refentrytitle>ftexists</refentrytitle>
8+
</refmeta>
9+
10+
<refnamediv>
11+
<refname>ftexists</refname>
12+
<refpurpose>
13+
Query if a given table exists
14+
</refpurpose>
15+
</refnamediv>
16+
17+
<refsect1>
18+
<title>Description</title>
19+
<para>Plugin opcode in emugens.</para>
20+
<para>
21+
Returns 1 if a given index refers to an existing table,
22+
0 if the table does not exist.
23+
Works at i-time if output is an ivariable, at k-time otherwise
24+
</para>
25+
</refsect1>
26+
27+
<refsect1>
28+
<title>Syntax</title>
29+
<synopsis>iexists <command>ftexists</command> ifn </synopsis>
30+
<synopsis>kexists <command>ftexists</command> kfn / ifn</synopsis>
31+
32+
</refsect1>
33+
34+
<refsect1>
35+
<title>Arguments</title>
36+
<para>
37+
<emphasis>ifn / kfm</emphasis> - The table to query
38+
</para>
39+
</refsect1>
40+
41+
<refsect1>
42+
<title>Output</title>
43+
<!-- First list all input and output performance parameters-->
44+
<para>
45+
<emphasis>iexists / kexists</emphasis> - 1 if the table exists, 0 otherwise
46+
</para>
47+
48+
</refsect1>
49+
<refsect1>
50+
<!--To add examples, create the csd file in the examples directory, then run:-->
51+
<!--python csd2docbook.py -f newopcodename.csd-->
52+
<!--to generate the xml highlighted version used below-->
53+
<title>Examples</title>
54+
<para>
55+
Here is an example of the ftexists opcode. It uses the file <ulink url="examples/ftexists.csd"><citetitle>ftexists.csd</citetitle></ulink>.
56+
<example>
57+
<title>Example of the ftexists opcode.</title>
58+
<xi:include href="examples-xml/ftexists.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
59+
</example>
60+
</para>
61+
</refsect1>
62+
63+
<refsect1>
64+
<title>See Also</title>
65+
<!-- it's always good to include a good See Also list -->
66+
<para>
67+
<link linkend="ftlen"><citetitle>ftlen</citetitle></link>,
68+
<link linkend="nsamp"><citetitle>nsamp</citetitle></link>,
69+
<link linkend="ftsr"><citetitle>ftsr</citetitle></link>,
70+
<link linkend="ftchnls"><citetitle>ftchnls</citetitle></link>,
71+
</para>
72+
</refsect1>
73+
74+
<refsect1>
75+
<!-- And put your name and other relevant information here-->
76+
<title>Credits</title>
77+
<para>By: &nameeduardo; 2019</para>
78+
<para>New plugin in version 6.14</para>
79+
</refsect1>
80+
81+
<!--Now remember to add a link from the appropriate category in the Opcode Overview.-->
82+
<!--Add the entity to manual.xml-->
83+
<!--Add the entity reference in the appropriate place in opcodes/top.xml-->
84+
<!--And you're set! Maybe delete the comments as well...-->
85+
86+
</refentry>

opcodes/ftlen.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ instr 1: ift = 88199.000
6666
<link linkend="ftlptim"><citetitle>ftlptim</citetitle></link>,
6767
<link linkend="ftsr"><citetitle>ftsr</citetitle></link>,
6868
<link linkend="nsamp"><citetitle>nsamp</citetitle></link>
69+
<link linkend="ftexists"><citetitle>ftexists</citetitle></link>
70+
6971
</para>
7072
</refsect1>
7173

opcodes/top.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@
390390
&opcodesftchnls;
391391
&opcodesftconv;
392392
&opcodesftcps;
393+
&opcodesftexists;
393394
&opcodesftfree;
394395
&opcodesftgen;
395396
&opcodesftgenonce;

0 commit comments

Comments
 (0)