1 /*
2     ugens5.h:
3 
4     Copyright (C) 1991 Barry Vercoe, John ffitch, Gabriel Maldonado
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 #include "lpc.h"        /*                               UGENS5.H        */
25 
26 typedef struct {
27         OPDS    h;
28         MYFLT   *kr, *ksig, *ihtim, *isig;
29         double   c1, c2, yt1;
30         MYFLT  ihtim_old;
31 } PORT;
32 
33 typedef struct {
34         OPDS    h;
35         MYFLT   *ar, *asig, *khp, *istor;
36         double  c1, c2, yt1, prvhp;
37 } TONE;
38 
39 typedef struct {
40         OPDS    h;
41         MYFLT   *ar, *asig, *kcf, *kbw, *iscl, *istor;
42         int     scale;
43         double  c1, c2, c3, yt1, yt2, cosf, prvcf, prvbw;
44         int     asigf, asigw;
45 } RESON;
46 
47 typedef struct {
48         OPDS    h;
49         MYFLT   *ar, *asig, *khp, *ord, *istor;
50         double  c1, c2, *yt1, prvhp;
51         int loop;
52         AUXCH   aux;
53 } TONEX;
54 
55 typedef struct {
56         OPDS    h;
57         MYFLT   *ar, *asig, *kcf, *kbw, *ord, *iscl, *istor;
58         int     scale, loop;
59         double  c1, c2, c3, *yt1, *yt2, cosf, prvcf, prvbw;
60         AUXCH   aux;
61 } RESONX;
62 
63 typedef struct {
64         OPDS    h;
65         MYFLT   *krmr, *krmo, *kerr, *kcps, *ktimpt, *ifilcod, *inpoles, *ifrmrate;
66         int32   headlen, npoles, nvals, lastfram16, lastmsg;
67         MYFLT   *kcoefs, framrat16;
68         int     storePoles ;
69         MEMFIL  *mfp;
70         AUXCH   aux;
71 } LPREAD;
72 
73 typedef struct {
74         OPDS    h;
75         MYFLT   *ar, *asig;
76         MYFLT   *circbuf, *circjp, *jp2lim;
77         LPREAD  *lpread;
78         AUXCH   aux;
79 
80 } LPRESON;
81 
82 typedef struct {
83         OPDS    h;
84         MYFLT   *kcf,*kbw, *kfor;
85         LPREAD  *lpread;
86         AUXCH   aux;
87 } LPFORM;
88 
89 typedef struct {
90         OPDS    h;
91         MYFLT   *ar, *asig, *kfrqratio;
92         MYFLT   *past, prvratio, d, prvout;
93         LPREAD  *lpread;
94         AUXCH   aux;
95 } LPFRESON;
96 
97 typedef struct {
98         OPDS    h;
99         MYFLT   *kr, *asig, *ihp, *istor;
100         double   c1, c2, prvq;
101 } RMS;
102 
103 typedef struct {
104         OPDS    h;
105         MYFLT   *ar, *asig, *krms, *ihp, *istor;
106         double  c1, c2, prvq, prva;
107 } GAIN;
108 
109 typedef struct {
110         OPDS    h;
111         MYFLT   *ar, *asig, *csig, *ihp, *istor;
112         double  c1, c2, prvq, prvr, prva;
113 } BALANCE;
114 
115 typedef struct {
116         OPDS    h;
117         MYFLT   *islotnum ; /* Assume sizeof(int)== sizeof(MYFLT) */
118 } LPSLOT ;
119 
120 typedef struct {
121         OPDS    h;
122         MYFLT   *islot1 ;
123         MYFLT   *islot2 ; /* Assume sizeof(pointer)== sizeof(MYFLT) */
124         MYFLT   *kmix  ;
125         MYFLT   *fpad[5]; /* Pad for kcoef correctly put (Mighty dangerous) */
126         int32    lpad,npoles ;
127         LPREAD  *lp1,*lp2 ;
128         int32    lastmsg;
129         MYFLT   *kcoefs/*[MAXPOLES*2]*/, framrat16;
130         int             storePoles ;
131         AUXCH    aux;
132 } LPINTERPOL ;
133 
134 typedef struct {
135         OPDS    h;
136         MYFLT   *ans, *sig, *min, *max;
137 } LIMIT;
138 
139 typedef PORT KPORT;
140 typedef TONE KTONE;
141 typedef RESON KRESON;
142 
143 int kporset(CSOUND*,PORT *p);
144 int kport(CSOUND*,PORT *p);
145 int ktonset(CSOUND*,TONE *p);
146 int ktone(CSOUND*,TONE *p);
147 int katone(CSOUND*,TONE *p);
148 int krsnset(CSOUND*,RESON *p);
149 int kreson(CSOUND*,RESON *p);
150 int kareson(CSOUND*,RESON *p);
151 int klimit(CSOUND*,LIMIT *p);
152 int limit(CSOUND*,LIMIT *p);
153