3 PROGRAM_NAME PROGRAM_VERSION - PROGRAM_DESCRIPTION
5 Copyright (C) 2003 Angel Ortega <angel@triptico.com>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 http://www.triptico.com
41 void init_delay(struct effect_delay
* e
, int size
, float gain
,
42 double depth
, double lfo_freq
, double llfo
, double rlfo
)
46 e
->lbuffer
=(float *) malloc(size
* sizeof(float));
47 e
->rbuffer
=(float *) malloc(size
* sizeof(float));
50 e
->lbuffer
[n
]=e
->rbuffer
[n
]=0;
59 /* calculates lfo increment */
60 e
->lfo_inc
=(lfo_freq
* 6.28) / (double) _frequency
;
66 void process_delay(struct effect_delay
* e
, float * lsample
, float * rsample
)
70 l
=e
->lbuffer
[e
->cursor
] * e
->gain
;
71 r
=e
->lbuffer
[e
->cursor
] * e
->gain
;
73 e
->lbuffer
[e
->cursor
]=*lsample
;
74 e
->rbuffer
[e
->cursor
]=*rsample
;
76 if(++e
->cursor
== e
->size
) e
->cursor
=0;
83 void process_comb(struct effect_delay
* e
, float * lsample
, float * rsample
)
87 l
=e
->lbuffer
[e
->cursor
];
88 r
=e
->lbuffer
[e
->cursor
];
90 e
->lbuffer
[e
->cursor
]=*lsample
+ (l
* e
->gain
);
91 e
->rbuffer
[e
->cursor
]=*rsample
+ (r
* e
->gain
);
93 if(++e
->cursor
== e
->size
) e
->cursor
=0;
100 void process_flanger(struct effect_delay
* e
, float * lsample
, float * rsample
)
107 c
=(double) e
->cursor
- e
->depth
;
108 c
-=e
->depth
* sin(e
->llfo
);
109 e
->llfo
+= e
->lfo_inc
;
112 l
=get_sample(e
->lbuffer
, s
, c
) * e
->gain
;
114 c
=(double) e
->cursor
- e
->depth
;
115 c
-=e
->depth
* sin(e
->rlfo
);
116 e
->rlfo
+= e
->lfo_inc
;
119 r
=get_sample(e
->rbuffer
, s
, c
) * e
->gain
;
121 e
->lbuffer
[e
->cursor
]=*lsample
;
122 e
->rbuffer
[e
->cursor
]=*rsample
;
124 if(++e
->cursor
== e
->size
) e
->cursor
=0;