File: modules.html

package info (click to toggle)
csound-doc 3.47b2-2
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 1,492 kB
  • ctags: 272
  • sloc: makefile: 36
file content (222 lines) | stat: -rw-r--r-- 16,327 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (X11; I; IRIX 6.3 IP32) [Netscape]">
   <TITLE>ADDING_CMODULES_TO_CSOUND</TITLE>
</HEAD>
<BODY>

<CENTER><A NAME="Adding_Cmodules_to_Csound"></A>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <A HREF="CSCORE.html">Top of this section</A> - <A HREF="compiling.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <B><A HREF="../Command/CSCOMM.html">Next Section</A></B>&nbsp;
<HR></CENTER>

<H2>
<BR>
Adding your own Cmodules to Csound</H2>
If the existing Csound generators do not suit your needs, you can write
your own modules in C and add them to the run-time system. When you invoke
Csound on an orchestra and score file, the orchestra is first read by a
table-driven translator 'otran' and the instrument blocks converted to
coded templates ready for loading into memory by 'oload' on request by
the score reader. To use your own C-modules within a standard orchestra
you need only add an entry in otran's table and relink Csound with your
own code.

<P>The translator, loader, and run-time monitor will treat your module
just like any other provided you follow some conventions. You need a <I>structure</I>
defining the inputs, outputs and workspace, plus some <I>initialization
code</I> and some <I>perf-time code</I>. Let's put an example of these
in two new files, <B>newgen.h</B> and <B>newgen.c</B>:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef struct {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*&nbsp; newgen.h&nbsp; -&nbsp; define a structure&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OPDS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; h;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* required header&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float&nbsp;&nbsp; *result, *istrt, *incr, *itime, *icontin;&nbsp; /* addr outarg, inargs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float&nbsp;&nbsp; curval, vincr;&nbsp;&nbsp; /* private dataspace&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long&nbsp;&nbsp;&nbsp; countdown;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* ditto&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; RMP;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #include "cs.h"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*&nbsp; newgen.c -&nbsp; init and perf code&nbsp;&nbsp;&nbsp;&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #include "newgen.h"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void rampset(RMP *p)&nbsp;&nbsp;&nbsp; /* at note initialization:&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if&nbsp; (*p->icontin == 0.)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p->curval = *p->istrt;&nbsp; /* optionally get new start value */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p->vincr = *p->incr / esr;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* set s-rate increment per sec.&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p->countdown = *p->itime * esr; /* counter for itime seconds&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void ramp(RMP *p)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* during note performance:&nbsp;&nbsp;&nbsp;&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float *rsltp = p->result;&nbsp; /* init an output array pointer&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int nn = ksmps;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* array size from orchestra&nbsp;&nbsp;&nbsp; */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *rsltp++ = p->curval;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* copy current value to ouput */&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (--p->countdown >= 0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* for the first itime seconds, */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p->curval += p->vincr;&nbsp; /* ramp the value&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } while (--nn);&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</TT></PRE>
Now we add this module to the translator table <B>entry.c</B>, under the
opcode name <B>rampt</B>:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp; #include "newgen.h"
&nbsp;&nbsp;&nbsp;&nbsp; void rampset(), ramp();

&nbsp;/*&nbsp;&nbsp; opcode&nbsp;&nbsp;&nbsp; dspace&nbsp;&nbsp;&nbsp; thread&nbsp;&nbsp;&nbsp; outarg&nbsp;&nbsp;&nbsp; inargs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isub&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ksub&nbsp;&nbsp;&nbsp;&nbsp; asub&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp; { "rampt",&nbsp; S(RMP),&nbsp; 5,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "a",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "iiio",&nbsp;&nbsp;&nbsp;&nbsp; rampset,&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp; ramp&nbsp; },</TT></PRE>
Finally we relink Csound to include the new module.&nbsp; If your Csound
installation has created a libcsound.a, you can do this by typing
<BR>&nbsp;
<BR><TT>cc&nbsp; -o mycsound&nbsp; newgen.c&nbsp; entry.c&nbsp; -lcsound
-lX11 -lm (X11 if included at installation)</TT>

<P>Else copy <I>*.c, *.h </I>and Makefile from the <B>Csound</B> sources,
add <B>newgen.o </B>to the Makefile list OBJS, add <B>newgen.h</B> as a
dependency for entry.o, and a new dependency '<B>newgen.o:&nbsp; newgen.h'</B>,
then run '<I>make csound</I>'.&nbsp;&nbsp; If your host is a Macintosh,
simply add <B>newgen.h and newgen.c</B> to one of the segments in the <B>Csound</B>
Project, and invoke the <B>C</B> compiler.
<BR>&nbsp;

<P>The above actions have added a new generator to the Csound language.
It is an audio-rate linear ramp function which modifies an input value
at a user-defined slope for some period. A ramp can optionally continue
from the previous note's last value. The Csound manual entry would look
like:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ar&nbsp;&nbsp; <B>rampt</B>&nbsp;&nbsp;&nbsp;&nbsp; istart,&nbsp; islope, itime [,&nbsp; icontin]</TT></PRE>
<I>istart</I> - beginning value of an audio-rate linear ramp. Optionally
overridden by a continue flag.

<P><I>islope</I> - slope of ramp, expressed as the y-interval change per
second.

<P><I>itime</I> - ramp time in seconds, after which the value is held for
the remainder of the note.

<P><I>icontin</I> (optional) - continue flag. If zero, ramping will proceed
from input <I>istart</I> . If non-zero, ramping will proceed from the last
value of the previous note. The default value is zero.

<P>The file <I>newgen.h</I> includes a one-line list of output and input
parameters. These are the ports through which the new generator will communicate
with the other generators in an instrument. Communication is by <I>address</I>,
not <I>value</I>, and this is a list of pointers to floats. There are no
restrictions on names, but the input-output argument types are further
defined by character strings in entry.c (inargs, outargs). Inarg types
are commonly <B>x</B>, <B>a</B>, <B>k</B>, and <B>i</B>, in the normal
Csound manual conventions; also available are o (optional, defaulting to
0), p (optional, defaulting to 1). Outarg types include <B>a</B>, <B>k</B>,
<B>i</B> and <B>s</B> (asig or ksig). It is important that all listed argument
names be assigned a corresponding argument type in entry.c. Also, i-type
args are valid only at initialization time, and other-type args are available
only at perf time. Subsequent lines in the RMP structure declare the work
space needed to keep the code re-entrant. These enable the module to be
used multiple times in multiple instrument copies while preserving all
data.

<P>The file <I>newgen.c</I> contains two subroutines, each called with
a pointer to the uniquely allocated RMP structure and its data. The subroutines
can be of three types: note initialization, k-rate signal generation, a-rate
signal generation. A module normally requires two of theseinitialization,
and either k-rate or a-rate subroutineswhich become inserted in various
threaded lists of runnable tasks when an instrument is activated. The thread-types
appear in entry.c in two forms: <I>isub</I>, <I>ksub</I> and <I>asub</I>
names; and a threading index which is the sum of isub=1, ksub=2, asub=4.
The code itself may reference global variables defined in <B>cs.h</B> and
<B>oload.c</B>, the most useful of which are:
<BR><TT>&nbsp;</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; extern&nbsp; OPARMS&nbsp; O ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
float&nbsp;&nbsp; esr</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; user-defined sampling rate&nbsp;&nbsp;
float&nbsp;&nbsp; ekr</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; user-defined control rate&nbsp;&nbsp;&nbsp;
float&nbsp;&nbsp; ensmps</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; user-defined ksmps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int&nbsp;&nbsp;&nbsp;&nbsp; ksmps</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; user-defined ksmps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int&nbsp;&nbsp;&nbsp;&nbsp; nchnls</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; user-defined nchnls&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int&nbsp;&nbsp;&nbsp;&nbsp; O.odebug</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; command-line -v flag&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int&nbsp;&nbsp;&nbsp;&nbsp; O.msglevel</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; command-line -m level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
float&nbsp;&nbsp; pi, twopi&nbsp;&nbsp;&nbsp; obvious</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; constants&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
float&nbsp;&nbsp; tpidsr&nbsp;&nbsp;&nbsp; twopi / esr float</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; sstrcod&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
special code for string arguments</TT>
<H4>
<U>Function tables</U></H4>
To access stored function tables, special help is available. The newly
defined structure should include a pointer
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FUNC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *ftp;</TT></PRE>
initialized by the statement
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ftp = ftpfind(p->ifuncno);</TT></PRE>
where float *ifuncno is an i-type input argument containing the ftable
number. The stored table is then at ftp->ftable, and other data such as
length, phase masks, cps-to-incr converters, are also accessed from this
pointer. See the FUNC structure in cs.h, the ftfind() code in fgens.c,
and the code for oscset() and koscil() in ugens2.c.
<H4>
<U>Additional space</U></H4>
Sometimes the space requirement of a module is too large to be part of
a structure (upper limit 65535 bytes), or it is dependent on an i-arg value
which is not known until initialization. Additional space can be dynamically
allocated and properly managed by including the line
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AUXCH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; auxch;</TT></PRE>
in the defined structure (*p), then using the following style of code in
the init module:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (p->auxch.auxp == NULL)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; auxalloc(npoints * sizeof(float), &amp;p->auxch);</TT></PRE>
The address of this auxilliary space is kept in a chain of such spaces
belonging to this instrument, and is automatically managed while the instrument
is being duplicated or garbage-collected during performance. The assignment
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *auxp = p->auxch.auxp;</TT></PRE>
will find the allocated space for init-time and perf-time use. See the
LINSEG structure in ugens1.h and the code for lsgset() and klnseg() in
ugens1.c.
<H4>
<U>File sharing</U></H4>
When accessing an external file often, or doing it from multiple places,
it is often efficient to read the entire file into memory. This is accomplished
by including the line
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MEMFIL&nbsp;&nbsp;&nbsp; *mfp;</TT></PRE>
in the defined structure (*p), then using the following style of code in
the init module:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (p->mfp == NULL)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p->mfp = ldmemfile(filname);</TT></PRE>
where char *filname is a string name of the file requested. The data read
will be found between
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp; (char *)&nbsp; p->mfp->beginp; and (char *) p->mfp->endp;</TT></PRE>
Loaded files do not belong to a particular instrument, but are automatically
shared for multiple access. See the ADSYN structure in ugens3.h and the
code for adset() and adsyn() in ugens3.c.
<H4>
<U>String arguments</U></H4>
To permit a quoted string input argument (float *ifilnam, say) in our defined
structure (*p), assign it the argtype <B>S</B> in entry.c, include another
member char *strarg in the structure, insert a line
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TSTRARG( "rampt",&nbsp; RMP)&nbsp; \</TT></PRE>
in the file <B>oload.h</B>, and include the following code in the init
module:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (*p->ifilnam == sstrcod)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcpy(filename, unquote(p->strarg));</TT></PRE>
See the code for adset() in ugens3.c, lprdset() in ugens5.c, and pvset()
in ugens8.c.
</BODY>
<CENTER><P>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <A HREF="CSCORE.html">Top of this section</A> - <A HREF="compiling.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <B><A HREF="../Command/CSCOMM.html">Next Section</A></B>&nbsp;
<HR></CENTER>


<P><CENTER>
<B><I><FONT COLOR="#006600">HTML Csound Manual - <FONT SIZE=-1>&copy;
Jean Pich&eacute; &amp; Peter J. Nix, 1994-97</FONT></FONT></I></B>&nbsp;
</CENTER>
</HTML>