1 /*  Copyright (C) 2002-2004 Gabriel Maldonado
2 
3   The gab library is free software; you can redistribute it
4   and/or modify it under the terms of the GNU Lesser General Public
5   License as published by the Free Software Foundation; either
6   version 2.1 of the License, or (at your option) any later version.
7 
8   The gab library is distributed in the hope that it will be useful,
9   but WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   GNU Lesser General Public License for more details.
12 
13   You should have received a copy of the GNU Lesser General Public
14   License along with the gab library; if not, write to the Free Software
15   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16   02110-1301 USA
17 
18   Ported to csound5 by:Andres Cabrera andres@geminiflux.com
19 */
20 
21 #ifndef GAB_H
22 #define GAB_H
23 
24 #include "../stdopcod.h"
25 #include "H/ugrw1.h"    /* for zread function */
26 #include "ugens6.h"     /* for a_k_set function */
27 
28 typedef struct {
29     OPDS    h;
30     MYFLT   *ar, *asig, *kcf, *kbw, *ord, *iscl, *istor;
31     int32_t scale, loop;
32     MYFLT   c1, c2, c3, *yt1, *yt2, cosf, prvcf, prvbw;
33     AUXCH   aux;
34 } KRESONX;
35 
36 typedef struct {
37     OPDS    h;
38     MYFLT   *rslt, *xndx, *xfn, *ixmode;
39     MYFLT   *table;
40     MYFLT   xbmul;
41     int32_t xmode;
42     int32_t tablen;
43 } FASTAB;
44 
45 typedef struct {
46     OPDS    h;
47     MYFLT   *r, *ndx;
48     MYFLT   **tb_ptr;
49 } FASTB;
50 
51 typedef struct {
52     OPDS    h;
53     MYFLT   *ifn;
54 } TB_INIT;
55 
56 /* ====================== */
57 /* opcodes from Jens Groh */
58 /* ====================== */
59 typedef struct {        /* for nlalp opcode */
60     OPDS    h;          /* header */
61     MYFLT   *aresult;   /* resulting signal */
62     MYFLT   *ainsig;    /* input signal */
63     MYFLT   *klfact;    /* linear factor */
64     MYFLT   *knfact;    /* nonlinear factor */
65     MYFLT   *istor;     /* initial storage disposition */
66     double  m0;         /* energy storage */
67     double  m1;         /* energy storage */
68 } NLALP;
69 
70 /* end opcodes from Jens Groh */
71 
72 typedef struct {
73     OPDS    h;
74     MYFLT   *sr, *kamp, *kcps, *ifn, *ifreqtbl, *iamptbl, *icnt, *iphs;
75     FUNC    *ftp;
76     FUNC    *freqtp;
77     FUNC    *amptp;
78     int32_t count;
79     int32_t inerr;
80     AUXCH   lphs;
81     AUXCH   pamp;
82 } ADSYNT2;
83 
84 typedef struct {
85     OPDS    h;
86     MYFLT   *retval;
87 } EXITNOW;
88 
89 typedef struct {
90     OPDS    h;
91     MYFLT   *ktrig_start, *ktrig_stop, *numtics, *kfn, *inargs[VARGMAX];
92     int32_t recording, numins;
93     int64_t currtic, ndx, tablen;
94     MYFLT   *table, old_fn;
95 } TABREC;
96 
97 typedef struct {
98     OPDS    h;
99     MYFLT   *ktrig, *numtics, *kfn, *outargs[VARGMAX];
100     int32_t playing, numouts;
101     int64_t currtic, ndx, tablen;
102     MYFLT   *table, old_fn;
103 } TABPLAY;
104 
105 typedef struct {
106     OPDS    h;
107     MYFLT   *ktrig, *inargs[VARGMAX];
108     int32_t numargs;            /* Reordered for caching */
109     int32_t cnt;
110     MYFLT   old_inargs[VARGMAX];
111 } ISCHANGED;
112 
113 typedef struct {
114     OPDS     h;
115     MYFLT    *ktrig;
116     ARRAYDAT *chk;
117     int32_t  size;
118     int32_t  cnt;
119     AUXCH    old_chk;
120 } ISACHANGED;
121 
122 typedef struct {
123     OPDS    h;
124     MYFLT   *commandLine;
125 } CSSYSTEM;
126 
127 typedef struct {
128     OPDS    h;
129     MYFLT   *kout, *asig, *ktrig, *imaxflag;
130     MYFLT   max;
131     int32_t     counter;
132 } P_MAXIMUM;
133 
134 /* From fractals.h */
135 typedef struct {
136     OPDS    h;
137     MYFLT   *kr, *koutrig,  *ktrig, *kx, *ky, *kmaxIter;
138     MYFLT   oldx, oldy;
139     int32_t oldCount;
140 } MANDEL;
141 
142 #endif
143 
144