1 /*
2     vdelay.h:
3 
4     Copyright (C) 1994 Paris Smaragdis, 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 /*      vdelay, multitap, reverb2 coded by Paris Smaragdis              */
25 /*      Berklee College of Music Csound development team                */
26 /*      Copyright (c) December 1994.  All rights reserved               */
27 
28 typedef struct {
29         OPDS    h;
30         MYFLT   *sr, *ain, *adel, *imaxd, *istod;
31         uint32 maxd;
32         AUXCH   aux;
33         int32   left;
34 } VDEL;
35 
36 typedef struct {
37         OPDS    h;
38         MYFLT   *sr1, *sr2, *sr3, *sr4;
39         MYFLT   *ain1, *ain2, *ain3, *ain4, *adel, *imaxd, *iquality, *istod;
40         AUXCH   aux1, aux2, aux3, aux4;
41         uint32 maxd;
42         int     interp_size;
43         int32   left;
44 } VDELXQ;
45 
46 typedef struct {
47         OPDS    h;
48         MYFLT   *sr1, *sr2, *ain1, *ain2, *adel, *imaxd, *iquality, *istod;
49         AUXCH   aux1, aux2;
50         uint32 maxd;
51         int     interp_size;
52         int32   left;
53 } VDELXS;
54 
55 typedef struct {
56         OPDS    h;
57         MYFLT   *sr1, *ain1, *adel, *imaxd, *iquality, *istod;
58         AUXCH   aux1;
59         uint32 maxd;
60         int     interp_size;
61         int32   left;
62 } VDELX;
63 
64 typedef struct {
65         OPDS    h;
66         MYFLT   *sr, *ain, *ndel[VARGMAX-1];
67         AUXCH   aux;
68         int32   left, max;
69 } MDEL;
70 
71 #if 0
72 
73 #define Combs   6
74 #define Alpas   5
75 
76 typedef struct {
77         OPDS    h;
78         MYFLT   *out, *in, *time, *hdif, *istor;
79         MYFLT   *cbuf_cur[Combs], *abuf_cur[Alpas];
80         MYFLT   c_time[Combs], c_gain[Combs], a_time[Alpas], a_gain[Alpas];
81         MYFLT   z[Combs], g[Combs];
82         AUXCH   temp;
83         AUXCH   caux[Combs], aaux[Alpas];
84         MYFLT   prev_time, prev_hdif;
85 } STVB;
86 
87 /*      nreverb coded by Paris Smaragdis 1994 and Richard Karpen 1998 */
88 
89 typedef struct {
90         OPDS    h;
91         MYFLT   *out, *in, *time, *hdif, *istor;
92         MYFLT   *cbuf_cur[Combs], *abuf_cur[Alpas];
93         MYFLT   c_time[Combs], c_gain[Combs], a_time[Alpas], a_gain[Alpas];
94         MYFLT   z[Combs], g[Combs];
95         AUXCH   temp;
96         AUXCH   caux[Combs], aaux[Alpas];
97         MYFLT   prev_time, prev_hdif;
98 } NREV;
99 
100 #endif
101 
102 /*
103  * Based on nreverb coded by Paris Smaragdis 1994 and Richard Karpen 1998.
104  * Changes made to allow user-defined comb and alpas constant in a ftable.
105  * Sept 2000, by rasmus ekman.
106  * Memory allocation fixed April 2001 by JPff
107  */
108 typedef struct {
109         OPDS    h;
110         MYFLT   *out, *in, *time, *hdif, *istor;
111         MYFLT   *inumCombs, *ifnCombs, *inumAlpas, *ifnAlpas;
112         /* Used to be [Combs]- and [Alpas]-sized arrays */
113         int     numCombs, numAlpas;
114         MYFLT   **cbuf_cur, **abuf_cur;
115         MYFLT   **pcbuf_cur, **pabuf_cur;
116         MYFLT   *c_time, *c_gain, *a_time, *a_gain;
117         const MYFLT *c_orggains, *a_orggains;
118         MYFLT   *z, *g;        /* [Combs] */
119         AUXCH   temp;
120         AUXCH   caux, aaux;
121         AUXCH   caux2, aaux2;  /* Used to hold space for all dynamized arrays */
122         MYFLT   prev_time, prev_hdif;
123 } NREV2;
124 
125 int vdelset(CSOUND *, VDEL *p);
126 int vdelay(CSOUND *, VDEL *p);
127 int vdelay3(CSOUND *, VDEL *p);
128 int vdelxset(CSOUND *, VDELX *p);
129 int vdelxsset(CSOUND *, VDELXS *p);
130 int vdelxqset(CSOUND *, VDELXQ *p);
131 int vdelayx(CSOUND *, VDELX *p);
132 int vdelayxw(CSOUND *, VDELX *p);
133 int vdelayxs(CSOUND *, VDELXS *p);
134 int vdelayxws(CSOUND *, VDELXS *p);
135 int vdelayxq(CSOUND *, VDELXQ *p);
136 int vdelayxwq(CSOUND *, VDELXQ *p);
137 int multitap_set(CSOUND *, MDEL *p);
138 int multitap_play(CSOUND *, MDEL *p);
139 #if 0
140 int nreverb_set(CSOUND *, NREV *p);
141 int nreverb(CSOUND *, NREV *p);
142 #endif
143 int reverbx_set(CSOUND *, NREV2 *p);
144 int reverbx(CSOUND *, NREV2 *p);
145 
146