Debian Codegraph @

iOS/Csound iOS Swift Examples/Csound iOS SwiftExamples/csound-iOS/headers/pstream.h

raw symbols SCIP
1 /*
2 pstream.h:
3
4 Copyright (C) 2001 Richard Dobson
5
6 This file is part of Csound.
7
8 The Csound Library is free software; you can redistribute it
9 and/or modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 Csound is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with Csound; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 02110-1301 USA
22 */
23
24 #ifndef __PSTREAM_H_INCLUDED
25 #define __PSTREAM_H_INCLUDED
26
27 /* pstream.h. Implementation of PVOCEX streaming opcodes.
28 (c) Richard Dobson August 2001
29 NB pvoc routines based on CARL distribution (Mark Dolson).
30 This file is licensed according to the terms of the GNU LGPL.
31 */
32
33 /* opcodes: PROVISIONAL DEFINITIONS
34
35 fsig pvsanal ain,ifftsize,ioverlap,iwinsize,iwintype[,iformat,iinit]
36
37 iwintype: 0 = HAMMING, 1 = VonHann, 2 = Kaiser(?)
38 iformat: only PVS_AMP_FREQ (0) supported at present
39 (TODO: add f-table support for custom window)
40 ( But: really need a param to associate with the window too,
41 or just use a standard default value...)
42
43 fsig pvsfread ktimpt,ifn[,ichan]
44
45 asig pvsynth fsig[,iinit]
46
47 asig pvsadsyn fsig,inoscs,kfmod[,ibin,ibinoffset,iinit]
48
49 ibin: starting bin (defualt 0)
50 ibinoffset: distance between successive bins (default 1)
51 kfmod: multiplier; 1 = no change, 2 = up one octave.
52
53 fsig pvscross fsrc,fdest,kamp1,kamp2
54
55 fsig pvsmaska fsrc,ifn,kdepth
56
57 ioverlap,inumbins,iwinsize,iformat pvsinfo fsig
58
59 ( will need sndinfo supporting pvocex files anyway,
60 to know numchans, wintype, etc.)
61
62 fdest = fsrc
63
64 ( woo-hoo! operator overloading in Csound!)
65 ( NB an init statement for fsigs is not supported. One day....)
66
67 kflag pvsftw fsig,ifna [,ifnf]
68 pvsftr fsig,ifna [,ifnf]
69
70 ( this modifies an ~existing~ signal, does not create a new one,
71 hence no output)
72
73 Re iinit: not implemented yet: and I still need to establish
74 if it's possible...
75 */
76
77 /* description of an fsig analysis frame*/
78 enum PVS_WINTYPE {
79 PVS_WIN_HAMMING = 0,
80 PVS_WIN_HANN,
81 PVS_WIN_KAISER,
82 PVS_WIN_CUSTOM,
83 PVS_WIN_BLACKMAN,
84 PVS_WIN_BLACKMAN_EXACT,
85 PVS_WIN_NUTTALLC3,
86 PVS_WIN_BHARRIS_3,
87 PVS_WIN_BHARRIS_MIN,
88 PVS_WIN_RECT
89 };
90
91
92 enum PVS_ANALFORMAT {
93 PVS_AMP_FREQ = 0,
94 PVS_AMP_PHASE,
95 PVS_COMPLEX,
96 PVS_TRACKS /* added VL, 24.06.2005 */
97 };
98
99 typedef struct {
100 MYFLT re;
101 MYFLT im;
102 } CMPLX;
103
104 typedef struct pvsdat {
105 int32 N;
106 int sliding; /* Flag to indicate sliding case */
107 int32 NB;
108 int32 overlap;
109 int32 winsize;
110 int wintype;
111 int32 format; /* fixed for now to AMP:FREQ */
112 uint32 framecount;
113 AUXCH frame; /* RWD MUST always be 32bit floats */
114 /* But not in sliding case when MYFLT */
115 } PVSDAT;
116
117 /* may be no point supporting Kaiser in an opcode unless we can support
118 the param too but we can have kaiser in a PVOCEX file. */
119
120 typedef struct {
121 OPDS h;
122 PVSDAT *fsig; /* output signal is an analysis frame */
123 MYFLT *ain; /* input sig is audio */
124 MYFLT *fftsize; /* params */
125 MYFLT *overlap;
126 MYFLT *winsize;
127 MYFLT *wintype;
128 MYFLT *format; /* always PVS_AMP_FREQ at present */
129 MYFLT *init; /* not yet implemented */
130 /* internal */
131 int32 buflen;
132 float fund,arate;
133 float RoverTwoPi,TwoPioverR,Fexact;
134 MYFLT *nextIn;
135 int32 nI,Ii,IOi; /* need all these ?; double as N and NB */
136 int32 inptr;
137
138 AUXCH input;
139 AUXCH overlapbuf;
140 AUXCH analbuf;
141 AUXCH analwinbuf; /* prewin in SDFT case */
142 AUXCH oldInPhase;
143 AUXCH trig;
144 double *cosine, *sine;
145 void *setup;
146 } PVSANAL;
147
148 typedef struct {
149 OPDS h;
150 MYFLT *aout; /* audio output signal */
151 PVSDAT *fsig; /* input signal is an analysis frame */
152 MYFLT *init; /* not yet implemented */
153 /* internal */
154 /* check these against fsig vals */
155 int32 overlap,winsize,fftsize,wintype,format;
156 /* can we allow variant window tpes? */
157 int32 buflen;
158 MYFLT fund,arate;
159 MYFLT RoverTwoPi,TwoPioverR,Fexact;
160 MYFLT *nextOut;
161 int32 nO,Ii,IOi; /* need all these ?*/
162 int32 outptr;
163 int32 bin_index; /* for phase normalization across frames */
164 /* renderer gets all format info from fsig */
165
166 AUXCH output;
167 AUXCH overlapbuf;
168 AUXCH synbuf;
169 AUXCH analwinbuf; /* may get away with a local alloc and free */
170 AUXCH synwinbuf;
171 AUXCH oldOutPhase;
172
173 void *setup;
174 } PVSYNTH;
175
176 /* for pvadsyn */
177
178 typedef struct {
179 OPDS h;
180 MYFLT *aout;
181 PVSDAT *fsig;
182 MYFLT *n_oscs;
183 MYFLT *kfmod;
184 MYFLT *ibin; /* default 0 */
185 MYFLT *ibinoffset; /* default 1 */
186 MYFLT *init; /* not yet implemented */
187 /* internal */
188 int32 outptr;
189 uint32 lastframe;
190 /* check these against fsig vals */
191 int32 overlap,winsize,fftsize,wintype,format,noscs;
192 int32 maxosc;
193 float one_over_overlap,pi_over_sr, one_over_sr;
194 float fmod;
195 AUXCH a;
196 AUXCH x;
197 AUXCH y;
198 AUXCH amps;
199 AUXCH lastamps;
200 AUXCH freqs;
201 AUXCH outbuf;
202 } PVADS;
203
204 /* for pvscross */
205 typedef struct {
206 OPDS h;
207 PVSDAT *fout;
208 PVSDAT *fsrc;
209 PVSDAT *fdest;
210 MYFLT *kamp1;
211 MYFLT *kamp2;
212 /* internal */
213 int32 overlap,winsize,fftsize,wintype,format;
214 uint32 lastframe;
215 } PVSCROSS;
216
217 /* for pvsmaska */
218 typedef struct {
219 OPDS h;
220 PVSDAT *fout;
221 PVSDAT *fsrc;
222 MYFLT *ifn;
223 MYFLT *kdepth;
224 /* internal*/
225 int32 overlap,winsize,fftsize,wintype,format;
226 uint32 lastframe;
227 int nwarned,pwarned; /* range errors for kdepth */
228 FUNC *maskfunc;
229 } PVSMASKA;
230
231 /* for pvsftw, pvsftr */
232
233 typedef struct {
234 OPDS h;
235 MYFLT *kflag;
236 PVSDAT *fsrc;
237 MYFLT *ifna; /* amp, required */
238 MYFLT *ifnf; /* freq: optional*/
239 /* internal */
240 int32 overlap,winsize,fftsize,wintype,format;
241 uint32 lastframe;
242 FUNC *outfna, *outfnf;
243 } PVSFTW;
244
245 typedef struct {
246 OPDS h;
247 /* no output var*/
248 PVSDAT *fdest;
249 MYFLT *ifna; /* amp, may be 0 */
250 MYFLT *ifnf; /* freq: optional*/
251 /* internal */
252 int32 overlap,winsize,fftsize,wintype,format;
253 uint32 lastframe;
254 FUNC *infna, *infnf;
255 MYFLT *ftablea,*ftablef;
256 } PVSFTR;
257
258 /* for pvsfread */
259 /* wsig pvsread ktimpt,ifilcod */
260 typedef struct {
261 OPDS h;
262 PVSDAT *fout;
263 MYFLT *kpos;
264 MYFLT *ifilno;
265 MYFLT *ichan;
266 /* internal */
267 int ptr;
268 int32 overlap,winsize,fftsize,wintype,format;
269 uint32 chans, nframes,lastframe,chanoffset,blockalign;
270 MYFLT arate;
271 float *membase; /* RWD MUST be 32bit: reads file */
272 } PVSFREAD;
273
274 /* for pvsinfo */
275
276 typedef struct {
277 OPDS h;
278 MYFLT *ioverlap;
279 MYFLT *inumbins;
280 MYFLT *iwinsize;
281 MYFLT *iformat;
282 /* internal*/
283 PVSDAT *fsrc;
284 } PVSINFO;
285
286 typedef struct {
287 OPDS h;
288 PVSDAT *fout;
289 PVSDAT *fsrc;
290 } FASSIGN;
291
292 #endif
293