1 /*
2     zak.h:
3 
4     Copyright (C) 2018 John ffitch
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                                                         /*      ZAK.H */
25 typedef struct {
26     MYFLT         *zkstart;
27     int64_t       zklast;
28     MYFLT         *zastart;
29     int64_t       zalast;
30 } ZAK_GLOBALS;
31 
32 
33 /* Data structures for the zak family of ugens for patching data at i,
34  * k or a rates.
35  * See also four global variables declared in the C code.  */
36 
37 /* ZAKINIT data structure for zakinit(). */
38 typedef struct {
39         OPDS    h;
40         MYFLT   *isizea;        /* Number of a locations, each an array of
41                                  * ksmps long, to to reserve for a rate
42                                  * patching */
43         MYFLT   *isizek;        /* Number of locations for i or k rate
44                                  * variables */
45 } ZAKINIT;
46 
47 /* ZKR data structure for zir() and zkr(). */
48 typedef struct {
49         OPDS    h;
50         MYFLT   *rslt;          /* Where to write the value read from zk */
51         MYFLT   *ndx;           /* Location in zk space to read */
52         MYFLT   *dummy;
53         void    *zz;
54 } ZKR;
55 
56 /* ZKW data structure for ziw() and zkw(). */
57 typedef struct {
58         OPDS    h;
59         MYFLT   *sig;           /* Value to write */
60         MYFLT   *ndx;           /* Locations to read */
61         MYFLT   *dummy;
62         void    *zz;
63 } ZKW;
64 
65 /* ZKWM data structure for ziwm() and zkwm(). */
66 typedef struct {
67         OPDS    h;
68         MYFLT   *sig;           /* Value to write */
69         MYFLT   *ndx;           /* Locations to read */
70         MYFLT   *mix;           /* 0 for write directly;  !0 for mix - add in */
71         void    *zz;
72 } ZKWM;
73 
74 /* ZKMOD data structure for zkmod(). */
75 typedef struct {
76         OPDS    h;
77         MYFLT   *rslt;          /* Points to where to write output */
78         MYFLT   *sig;           /* Value to modulate */
79         MYFLT   *zkmod;         /* Which zk variable to use to modulate sig */
80         void    *zz;
81 } ZKMOD;
82 
83 /* ZKCL data structure for zkcl(). */
84 typedef struct {
85         OPDS    h;
86         MYFLT   *first;         /* First variable to clear */
87         MYFLT   *last;          /* Final variable to clear */
88         MYFLT   *dummy;
89         void    *zz;
90 } ZKCL;
91 
92 /* ZAR data structure for zar(). */
93 typedef struct {
94         OPDS    h;
95         MYFLT   *rslt;          /* Where to write the value */
96         MYFLT   *ndx;           /* Location in za space to read */
97         MYFLT   *dummy;
98         void    *zz;
99 } ZAR;
100 
101 /* ZARG data structure for zarg(). */
102 typedef struct {
103         OPDS    h;
104         MYFLT   *rslt;          /* Where to write the zk location */
105         MYFLT   *ndx;           /* Location in za space to read */
106         MYFLT   *kgain;         /* Gain to be given to signal read */
107         void    *zz;
108 } ZARG;
109 
110 /* ZAW data structure for zaw(). */
111 typedef struct {
112         OPDS    h;
113         MYFLT   *sig, *ndx;
114         MYFLT   *dummy;
115         void    *zz;
116 } ZAW;
117 
118 /* ZAWM data structure for zawm(). */
119 typedef struct {
120         OPDS    h;
121         MYFLT   *sig;
122         MYFLT   *ndx, *mix;     /* Locations to read;
123                                    0 for write directly, or addd in */
124         void    *zz;
125 } ZAWM;
126 
127 /* ZAWOD data structure for zamod(). */
128 typedef struct {
129         OPDS    h;
130         MYFLT   *rslt;
131         MYFLT   *sig, *zamod;   /* Value to modulate; Which za variable to use */
132         void    *zz;
133 } ZAMOD;
134 
135 /* ZACL data structure for zacl(). */
136 typedef struct {
137         OPDS    h;
138         MYFLT   *first, *last;
139         MYFLT   *dummy;
140         void    *zz;
141 } ZACL;
142 
143 int zacl(CSOUND*,ZACL *p);
144 int zakinit(CSOUND*,ZAKINIT *p);
145 int zamod(CSOUND*,ZAMOD *p);
146 int zar(CSOUND*,ZAR *p);
147 int zarg(CSOUND*,ZARG *p);
148 int zaset(CSOUND*,ZAR *p);
149 int zaw(CSOUND*,ZAW *p);
150 int zawm(CSOUND*,ZAWM *p);
151 int zir(CSOUND*,ZKR *p);
152 int ziw(CSOUND*,ZKW *p);
153 int ziwm(CSOUND*,ZKWM *p);
154 int zkcl(CSOUND*,ZKCL *p);
155 int zkmod(CSOUND*,ZKMOD *p);
156 int zkr(CSOUND*,ZKR *p);
157 int zkset(CSOUND*,ZKR *p);
158 int zkw(CSOUND*,ZKW *p);
159 int zkwm(CSOUND*,ZKWM *p);
160 
161