LMMS
Loading...
Searching...
No Matches
audio_fx.h
Go to the documentation of this file.
1/* Calf DSP Library
2 * Reusable audio effect classes.
3 *
4 * Copyright (C) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald Johansen and others
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
20 */
21#ifndef CALF_AUDIOFX_H
22#define CALF_AUDIOFX_H
23
24#include "biquad.h"
25#include "delay.h"
26#include "fixed_point.h"
27#include "inertia.h"
28#include "giface.h"
29#include "onepole.h"
30#include <complex>
31
32namespace calf_plugins {
33 struct cairo_iface;
34};
35
36namespace dsp {
37#if 0
38}; to keep editor happy
39#endif
40
45{
46public:
47 virtual void setup(int sample_rate)=0;
48 virtual ~audio_effect() {}
49};
50
52{
53protected:
55 float rate, wet, dry, odsr;
57public:
59 float get_rate() const {
60 return rate;
61 }
62 void set_rate(float rate) {
63 this->rate = rate;
64 dphase = rate/sample_rate*4096;
65 }
66 float get_wet() const {
67 return wet;
68 }
69 void set_wet(float wet) {
70 this->wet = wet;
71 gs_wet.set_inertia(wet);
72 }
73 float get_dry() const {
74 return dry;
75 }
76 void set_dry(float dry) {
77 this->dry = dry;
78 gs_dry.set_inertia(dry);
79 }
80 void reset_phase(float req_phase)
81 {
82 phase = req_phase * 4096.0;
83 }
84 void inc_phase(float req_phase)
85 {
86 phase += fixed_point<unsigned int, 20>(req_phase * 4096.0);
87 }
89 {
90 this->sample_rate = sample_rate;
91 this->odsr = 1.0 / sample_rate;
92 phase = 0;
93 lfo_active = 1;
95 }
96 int get_lfo_active() const {
97 return lfo_active;
98 }
99 void set_lfo_active(int i) {
100 this->lfo_active = i;
101 }
102};
103
109{
110protected:
112 float state;
115 float *x1, *y1;
116public:
117 simple_phaser(int _max_stages, float *x1vals, float *y1vals);
118
119 float get_base_frq() const {
120 return base_frq;
121 }
122 void set_base_frq(float _base_frq) {
123 base_frq = _base_frq;
124 }
125 int get_stages() const {
126 return stages;
127 }
128 void set_stages(int _stages);
129
130 float get_mod_depth() const {
131 return mod_depth;
132 }
133 void set_mod_depth(float _mod_depth) {
134 mod_depth = _mod_depth;
135 }
136
137 float get_fb() const {
138 return fb;
139 }
140 void set_fb(float fb) {
141 this->fb = fb;
142 }
143
144 virtual void setup(int sample_rate) {
146 reset();
147 }
148 void reset();
149 void control_step();
150 void process(float *buf_out, float *buf_in, int nsamples, bool active, float level_in = 1., float level_out = 1.);
151 float freq_gain(float freq, float sr) const;
152};
153
160{
161protected:
165public:
166 float get_min_delay() const {
167 return min_delay;
168 }
170 this->min_delay = min_delay;
171 this->min_delay_samples = (int)(min_delay * 65536.0 * sample_rate);
172 }
173 float get_mod_depth() const {
174 return mod_depth;
175 }
177 this->mod_depth = mod_depth;
178 // 128 because it's then multiplied by (hopefully) a value of 32768..-32767
179 this->mod_depth_samples = (int)(mod_depth * 32.0 * sample_rate);
180 }
181};
182
187template<class T, int MaxDelay=512>
189{
190protected:
192public:
194 rate = 0.63f;
195 dry = 0.5f;
196 wet = 0.5f;
197 min_delay = 0.005f;
198 mod_depth = 0.0025f;
199 setup(44100);
200 }
201 void reset() {
202 delay.reset();
203 }
210 template<class OutIter, class InIter>
211 void process(OutIter buf_out, InIter buf_in, int nsamples, bool active, float level_in = 1., float level_out = 1.) {
212 int mds = min_delay_samples + mod_depth_samples * 1024 + 2*65536;
213 int mdepth = mod_depth_samples;
214 for (int i=0; i<nsamples; i++) {
215 if (lfo_active)
216 phase += dphase;
217 unsigned int ipart = phase.ipart();
218
219 float in = *buf_in++ * level_in;
220 int lfo = phase.lerp_by_fract_int<int, 14, int>(sine.data[ipart], sine.data[ipart+1]);
221 int v = mds + (mdepth * lfo >> 6);
222 // if (!(i & 7)) printf("%d\n", v);
223 int ifv = v >> 16;
224 delay.put(in);
225 T fd; // signal from delay's output
226 delay.get_interp(fd, ifv, (v & 0xFFFF)*(1.0/65536.0));
227 T sdry = in * gs_dry.get();
228 T swet = fd * gs_wet.get();
229 *buf_out++ = (sdry + (active ? swet : 0)) * level_out;
230 }
231 }
232};
233
237template<class T, int MaxDelay=1024>
239{
240protected:
242 float fb;
245public:
247 : fb(0) {}
248 void reset() {
249 delay.reset();
251 ramp_pos = 1024;
252 }
253 virtual void setup(int sample_rate) {
254 this->sample_rate = sample_rate;
255 this->odsr = 1.0 / sample_rate;
256 delay.reset();
257 phase = 0;
260 }
261 float get_fb() const {
262 return fb;
263 }
264 void set_fb(float fb) {
265 this->fb = fb;
266 }
267 template<class OutIter, class InIter>
268 void process(OutIter buf_out, InIter buf_in, int nsamples, bool active, float level_in = 1., float level_out = 1.) {
269 if (!nsamples)
270 return;
271 int mds = this->min_delay_samples + this->mod_depth_samples * 1024 + 2 * 65536;
272 int mdepth = this->mod_depth_samples;
273 int delay_pos;
274 unsigned int ipart = this->phase.ipart();
275 int lfo = phase.lerp_by_fract_int<int, 14, int>(this->sine.data[ipart], this->sine.data[ipart+1]);
276 delay_pos = mds + (mdepth * lfo >> 6);
277
278 if (delay_pos != last_delay_pos || ramp_pos < 1024)
279 {
280 if (delay_pos != last_delay_pos) {
281 // we need to ramp from what the delay tap length actually was,
282 // not from old (ramp_delay_pos) or desired (delay_pos) tap length
284 ramp_pos = 0;
285 }
286
287 int64_t dp = 0;
288 for (int i=0; i<nsamples; i++) {
289 float in = *buf_in++ * level_in;
290 T fd; // signal from delay's output
291 dp = (((int64_t)ramp_delay_pos) * (1024 - ramp_pos) + ((int64_t)delay_pos) * ramp_pos) >> 10;
292 ramp_pos++;
293 if (ramp_pos > 1024) ramp_pos = 1024;
294 this->delay.get_interp(fd, dp >> 16, (dp & 0xFFFF)*(1.0/65536.0));
295 sanitize(fd);
296 T sdry = in * this->dry;
297 T swet = fd * this->wet;
298 *buf_out++ = (sdry + (active ? swet : 0)) * level_out;
299 this->delay.put(in+fb*fd);
300
301 if (this->lfo_active)
302 this->phase += this->dphase;
303 ipart = this->phase.ipart();
304 lfo = phase.lerp_by_fract_int<int, 14, int>(this->sine.data[ipart], this->sine.data[ipart+1]);
305 delay_pos = mds + (mdepth * lfo >> 6);
306 }
308 }
309 else {
310 for (int i=0; i<nsamples; i++) {
311 float in = *buf_in++ * level_in;
312 T fd; // signal from delay's output
313 this->delay.get_interp(fd, delay_pos >> 16, (delay_pos & 0xFFFF)*(1.0/65536.0));
314 sanitize(fd);
315 T sdry = in * this->gs_dry.get();
316 T swet = fd * this->gs_wet.get();
317 *buf_out++ = (sdry + (active ? swet : 0)) * level_out;
318 this->delay.put(in+fb*fd);
319
320 if (this->lfo_active)
321 this->phase += this->dphase;
322 ipart = this->phase.ipart();
323 lfo = phase.lerp_by_fract_int<int, 14, int>(this->sine.data[ipart], this->sine.data[ipart+1]);
324 delay_pos = mds + (mdepth * lfo >> 6);
325 }
326 last_actual_delay_pos = delay_pos;
327 }
328 last_delay_pos = delay_pos;
329 }
330 float freq_gain(float freq, float sr) const
331 {
332 typedef std::complex<double> cfloat;
333 freq *= 2.0 * M_PI / sr;
334 cfloat z = 1.0 / exp(cfloat(0.0, freq)); // z^-1
335
336 float ldp = last_delay_pos / 65536.0;
337 float fldp = floor(ldp);
338 cfloat zn = std::pow(z, fldp); // z^-N
339 cfloat zn1 = zn * z; // z^-(N+1)
340 // simulate a lerped comb filter - H(z) = 1 / (1 + fb * (lerp(z^-N, z^-(N+1), fracpos))), N = int(pos), fracpos = pos - int(pos)
341 cfloat delayed = zn + (zn1 - zn) * cfloat(ldp - fldp);
342 cfloat h = cfloat(delayed) / (cfloat(1.0) - cfloat(fb) * delayed);
343 // mix with dry signal
344 float v = std::abs(cfloat(gs_dry.get_last()) + cfloat(gs_wet.get_last()) * h);
345 return v;
346 }
347};
348
354class reverb: public audio_effect
355{
362 int type;
364 int tl[6], tr[6];
365 float ldec[6], rdec[6];
366
367 int sr;
368public:
370 {
371 phase = 0.0;
372 time = 1.0;
373 cutoff = 9000;
374 type = 2;
375 diffusion = 1.f;
376 setup(44100);
377 }
378 virtual void setup(int sample_rate) {
379 sr = sample_rate;
380 set_time(time);
382 phase = 0.0;
383 dphase = 0.5*128/sr;
384 update_times();
385 }
386 void update_times();
387 float get_time() const {
388 return time;
389 }
390 void set_time(float time) {
391 this->time = time;
392 // fb = pow(1.0f/4096.0f, (float)(1700/(time*sr)));
393 fb = 1.0 - 0.3 / (time * sr / 44100.0);
394 }
395 float get_type() const {
396 return type;
397 }
398 void set_type(int type) {
399 this->type = type;
400 update_times();
401 }
402 float get_diffusion() const {
403 return diffusion;
404 }
406 this->diffusion = diffusion;
407 update_times();
408 }
410 this->type = type;
411 this->diffusion = diffusion;
412 update_times();
413 }
414 float get_fb() const
415 {
416 return this->fb;
417 }
418 void set_fb(float fb)
419 {
420 this->fb = fb;
421 }
422 float get_cutoff() const {
423 return cutoff;
424 }
425 void set_cutoff(float cutoff) {
426 this->cutoff = cutoff;
427 lp_left.set_lp(cutoff,sr);
428 lp_right.set_lp(cutoff,sr);
429 }
430 void reset();
431 void process(float &left, float &right);
433 {
434 lp_left.sanitize();
435 lp_right.sanitize();
436 }
437};
438
440{
441public:
442 virtual void calculate_filter(float freq, float q, int mode, float gain = 1.0) = 0;
443 virtual void filter_activate() = 0;
444 virtual void sanitize() = 0;
445 virtual int process_channel(uint16_t channel_no, const float *in, float *out, uint32_t numsamples, int inmask, float lvl_in = 1., float lvl_out = 1.) = 0;
446 virtual float freq_gain(int subindex, float freq, float srate) const = 0;
447
449};
450
451
453{
454private:
456 int order;
457
458public:
460
467 };
468
469public:
472
473 void calculate_filter(float freq, float q, int mode, float gain = 1.0);
475 void filter_activate();
477 void sanitize();
479 int process_channel(uint16_t channel_no, const float *in, float *out, uint32_t numsamples, int inmask, float lvl_in = 1., float lvl_out = 1.);
481 float freq_gain(int subindex, float freq, float srate) const;
482};
483
485{
486private:
489
490public:
491 void reset()
492 {
493 lowcut.reset();
494 highcut.reset();
495 }
496
497 inline float process(float v)
498 {
499 v = dsp::lerp(lowcut.process_hp(v), v, low_gain);
500 v = dsp::lerp(highcut.process_lp(v), v, high_gain);
501 return v;
502 }
503
504 inline void copy_coeffs(const two_band_eq &src)
505 {
506 lowcut.copy_coeffs(src.lowcut);
507 highcut.copy_coeffs(src.highcut);
508 low_gain = src.low_gain;
509 high_gain = src.high_gain;
510 }
511
512 void sanitize()
513 {
514 lowcut.sanitize();
515 highcut.sanitize();
516 }
517
518 void set(float _low_freq, float _low_gain, float _high_freq, float _high_gain, float sr)
519 {
520 lowcut.set_hp(_low_freq, sr);
521 highcut.set_lp(_high_freq, sr);
522 low_gain = _low_gain;
523 high_gain = _high_gain;
524 }
525};
526
531private:
533 int mode;
536public:
537 simple_lfo();
538 void set_params(float f, int m, float o, uint32_t sr, float amount = 1.f, float pwidth = 1.f);
539 void set_freq(float f);
540 void set_mode(int m);
541 void set_amount(float a);
542 void set_offset(float o);
543 void set_pwidth(float p);
544 float get_value();
545 void advance(uint32_t count);
546 void set_phase(float ph);
547 void activate();
548 void deactivate();
549 float get_value_from_phase(float ph) const;
550 bool get_graph(float *data, int points, calf_plugins::cairo_iface *context, int *mode) const;
551 bool get_dot(float &x, float &y, int &size, calf_plugins::cairo_iface *context) const;
552};
553
554
557private:
558public:
561 float att; // a coefficient the output is multiplied with
562 float att_max; // a memory for the highest attenuation - used for display
563 int pos; // where we are actually in our sample buffer
567 bool debug;
570 float *buffer;
572 float delta;
573 float _delta;
574 float peak;
575 unsigned int over_s;
576 float over_c;
578 unsigned int id;
582 int * nextpos;
583 float * nextdelta;
584 int asc_c;
585 float asc;
590 static inline void denormal(volatile float *f) {
591 *f += 1e-18;
592 *f -= 1e-18;
593 }
594 inline float get_rdelta(float peak, float _limit, float _att, bool _asc = true);
595 void reset();
596 void reset_asc();
597 bool get_asc();
600 void set_multi(bool set);
601 void process(float &left, float &right, float *multi_buffer);
602 void set_sample_rate(uint32_t sr);
603 void set_params(float l, float a, float r, float weight = 1.f, bool ar = false, float arc = 1.f, bool d = false);
604 float get_attenuation();
605 void activate();
606 void deactivate();
607};
608
610private:
612public:
617 static const int looksize = 101;
619 float *lookbuf;
622 transients();
623 ~transients();
624 void calc_relfac();
625 void process(float *in, float s);
626 void waveshape(float *in);
627 void set_channels(int ch);
628 void set_sample_rate(uint32_t sr);
629 void set_params(float att_t, float att_l, float rel_t, float rel_l, float sust_th, int look);
630 int cnt;
631};
632
633
635private:
636public:
638 float freq[8], active[8], level[8], out[8][8];
639 dsp::biquad_d2 lp[8][8][4], hp[8][8][4];
640 mutable int redraw_graph;
642 crossover();
643 void process(float *data);
644 float get_value(int c, int b);
645 void set_sample_rate(uint32_t sr);
646 float set_filter(int b, float f, bool force = false);
647 void set_level(int b, float l);
648 void set_active(int b, bool a);
649 void set_mode(int m);
650 int get_filter_count() const;
651 void init(int c, int b, uint32_t sr);
652 virtual bool get_graph(int subindex, int phase, float *data, int points, calf_plugins::cairo_iface *context, int *mode) const;
653 bool get_layers(int index, int generation, unsigned int &layers) const;
654};
655
657{
658private:
659public:
660 float morph, coeff, dc, sqr, aa, aa1;
661 bool bypass;
663 mutable bool redraw_graph;
664 bitreduction();
665 void set_sample_rate(uint32_t sr);
666 float add_dc(float s, float dc) const;
667 float remove_dc(float s, float dc) const;
668 void set_params(float b, float m, bool bp, uint32_t mode, float dc, float aa);
669 float waveshape(float in) const;
670 float process(float in);
671 virtual bool get_graph(int subindex, int phase, float *data, int points, calf_plugins::cairo_iface *context, int *mode) const;
672 bool get_layers(int index, int generation, unsigned int &layers) const;
673 bool get_gridline(int subindex, int phase, float &pos, bool &vertical, std::string &legend, calf_plugins::cairo_iface *context) const;
674};
675
677{
678private:
679public:
680 uint32_t srate; // sample rate; source for upsampling, target for downsampling
681 int factor; // number of added/removed samples, max 16
682 int filters; // how many lowpasses should be used, max 4
683 double tmp[16];
685 resampleN();
686 ~resampleN();
687 void set_params(uint32_t sr, int factor, int filters);
688 double *upsample(double sample);
689 double downsample(double *sample);
690};
691
693{
694private:
695public:
697 unsigned int samples, round, cnt;
698 double last;
700 void set_params(float am);
701 double process(double in);
702};
703
704
709private:
711 float meter;
712 float rdrive, rbdr, kpa, kpb, kna, knb, ap, an, imr, kc, srct, sq, pwrq;
713 int over;
716public:
720 void activate();
721 void deactivate();
722 void set_params(float blend, float drive);
723 void set_sample_rate(uint32_t sr);
724 float process(float in);
725 float get_distortion_level();
726 static inline float M(float x)
727 {
728 return (fabs(x) > 0.00000001f) ? x : 0.0f;
729 }
730
731 static inline float D(float x)
732 {
733 x = fabs(x);
734 return (x > 0.00000001f) ? sqrtf(x) : 0.0f;
735 }
736};
737
738/*
739 Class for warping clicks avoiding between chunks
740 Used in reverse delay
741*/
743{
744private:
745 float val;
746 float step;
747 float acc;
748 unsigned int active_samples;
749 unsigned int full_samples;
750 unsigned int counter;
751
752public:
754 val = 0;
755 step = 0;
756 acc = 0;
757 active_samples = 0;
758 full_samples = 0;
759 counter = 0;
760 }
761 void set_coef(float t /* 0..1 */, unsigned int full_samples) {
763 }
764 bool set_full(float min_val, unsigned int full_samples, unsigned int active_samples) {
765 if(active_samples >= full_samples) return false;
766
767 acc = min_val;
768 val = min_val;
769 this->full_samples = full_samples;
770 this->active_samples = active_samples;
771 counter = 0;
772 step = (1 - min_val)/(active_samples/2);
773
774 return true;
775 }
776 float get() {
777 if(counter < active_samples/2) {
778 acc += step;
779 counter++;
780 return acc;
781 }
783 counter++;
784 return 1;
785 }
787 acc -= step;
788 counter++;
789 return acc;
790 }
791 else if(counter >= full_samples) {
792 float ret_val = acc;
793 acc = val;
794 counter = 0;
795 return ret_val;
796 }
797 return 1;
798 }
799};
800
801#if 0
802{ to keep editor happy
803#endif
804}
805
806#endif
uint8_t a
Definition Spc_Cpu.h:141
int dp
Definition Spc_Cpu.h:149
void process(Alg_seq_ptr seq, bool tempo_flag, double tempo, bool flatten_flag)
Definition allegroconvert.cpp:42
static void deactivate(LV2_Handle instance)
Definition bindings_test_plugin.c:128
Definition audio_fx.h:45
virtual ~audio_effect()
Definition audio_fx.h:48
virtual void setup(int sample_rate)=0
uint32_t srate
Definition audio_fx.h:459
dsp::biquad_d1 left[3]
Definition audio_fx.h:455
dsp::biquad_d1 right[3]
Definition audio_fx.h:455
@ mode_12db_bp
Definition audio_fx.h:463
@ mode_allpass
Definition audio_fx.h:465
@ mode_12db_br
Definition audio_fx.h:464
@ mode_18db_br
Definition audio_fx.h:464
@ mode_count
Definition audio_fx.h:466
@ mode_24db_hp
Definition audio_fx.h:462
@ mode_6db_bp
Definition audio_fx.h:463
@ mode_12db_hp
Definition audio_fx.h:462
@ mode_24db_lp
Definition audio_fx.h:461
@ mode_6db_br
Definition audio_fx.h:464
@ mode_36db_lp
Definition audio_fx.h:461
@ mode_36db_hp
Definition audio_fx.h:462
@ mode_18db_bp
Definition audio_fx.h:463
@ mode_12db_lp
Definition audio_fx.h:461
biquad_filter_module()
Definition audio_fx.h:470
int order
Definition audio_fx.h:456
bool get_layers(int index, int generation, unsigned int &layers) const
Definition audio_fx.cpp:1329
void set_sample_rate(uint32_t sr)
Definition audio_fx.cpp:1238
void set_params(float b, float m, bool bp, uint32_t mode, float dc, float aa)
Definition audio_fx.cpp:1242
bitreduction()
Definition audio_fx.cpp:1226
float add_dc(float s, float dc) const
Definition audio_fx.cpp:1254
float remove_dc(float s, float dc) const
Definition audio_fx.cpp:1258
uint32_t srate
Definition audio_fx.h:662
uint32_t mode
Definition audio_fx.h:662
bool get_gridline(int subindex, int phase, float &pos, bool &vertical, std::string &legend, calf_plugins::cairo_iface *context) const
Definition audio_fx.cpp:1351
float dc
Definition audio_fx.h:660
bool bypass
Definition audio_fx.h:661
bool redraw_graph
Definition audio_fx.h:663
float coeff
Definition audio_fx.h:660
virtual bool get_graph(int subindex, int phase, float *data, int points, calf_plugins::cairo_iface *context, int *mode) const
Definition audio_fx.cpp:1334
float waveshape(float in) const
Definition audio_fx.cpp:1262
float aa1
Definition audio_fx.h:660
float aa
Definition audio_fx.h:660
float morph
Definition audio_fx.h:660
float sqr
Definition audio_fx.h:660
Definition audio_fx.h:160
float min_delay
Definition audio_fx.h:163
sine_table< int, 4096, 65536 > sine
Definition audio_fx.h:164
float get_mod_depth() const
Definition audio_fx.h:173
int min_delay_samples
Definition audio_fx.h:162
int mod_depth_samples
Definition audio_fx.h:162
void set_min_delay(float min_delay)
Definition audio_fx.h:169
float mod_depth
Definition audio_fx.h:163
float get_min_delay() const
Definition audio_fx.h:166
void set_mod_depth(float mod_depth)
Definition audio_fx.h:176
float freq[8]
Definition audio_fx.h:638
void set_level(int b, float l)
Definition audio_fx.cpp:1155
void set_mode(int m)
Definition audio_fx.cpp:1140
uint32_t srate
Definition audio_fx.h:641
float set_filter(int b, float f, bool force=false)
Definition audio_fx.cpp:1087
float active[8]
Definition audio_fx.h:638
int mode
Definition audio_fx.h:637
int redraw_graph
Definition audio_fx.h:640
float out[8][8]
Definition audio_fx.h:638
bool get_layers(int index, int generation, unsigned int &layers) const
Definition audio_fx.cpp:1205
int get_filter_count() const
Definition audio_fx.cpp:1211
dsp::biquad_d2 hp[8][8][4]
Definition audio_fx.h:639
float level[8]
Definition audio_fx.h:638
int channels
Definition audio_fx.h:637
virtual bool get_graph(int subindex, int phase, float *data, int points, calf_plugins::cairo_iface *context, int *mode) const
Definition audio_fx.cpp:1182
void set_sample_rate(uint32_t sr)
Definition audio_fx.cpp:1069
int bands
Definition audio_fx.h:637
float get_value(int c, int b)
Definition audio_fx.cpp:1179
crossover()
Definition audio_fx.cpp:1064
dsp::biquad_d2 lp[8][8][4]
Definition audio_fx.h:639
void set_active(int b, bool a)
Definition audio_fx.cpp:1149
Definition audio_fx.h:440
virtual int process_channel(uint16_t channel_no, const float *in, float *out, uint32_t numsamples, int inmask, float lvl_in=1., float lvl_out=1.)=0
virtual void sanitize()=0
virtual float freq_gain(int subindex, float freq, float srate) const =0
virtual ~filter_module_iface()
Definition audio_fx.h:448
virtual void filter_activate()=0
virtual void calculate_filter(float freq, float q, int mode, float gain=1.0)=0
Definition fixed_point.h:38
Definition inertia.h:242
Lookahead Limiter by Markus Schmidt and Christian Holschuh.
Definition audio_fx.h:556
float limit
Definition audio_fx.h:559
float asc_coeff
Definition audio_fx.h:588
int overall_buffer_size
Definition audio_fx.h:565
float release
Definition audio_fx.h:559
int * nextpos
Definition audio_fx.h:582
int buffer_size
Definition audio_fx.h:564
bool asc_changed
Definition audio_fx.h:587
int nextlen
Definition audio_fx.h:581
float * nextdelta
Definition audio_fx.h:583
bool is_active
Definition audio_fx.h:566
unsigned int id
Definition audio_fx.h:578
float att_max
Definition audio_fx.h:562
float delta
Definition audio_fx.h:572
static void denormal(volatile float *f)
Definition audio_fx.h:590
int channels
Definition audio_fx.h:571
float weight
Definition audio_fx.h:559
bool auto_release
Definition audio_fx.h:568
float _delta
Definition audio_fx.h:573
float att
Definition audio_fx.h:561
lookahead_limiter()
Lookahead Limiter by Christian Holschuh and Markus Schmidt.
Definition audio_fx.cpp:595
int asc_pos
Definition audio_fx.h:586
int asc_c
Definition audio_fx.h:584
float asc
Definition audio_fx.h:585
float * buffer
Definition audio_fx.h:570
bool use_multi
Definition audio_fx.h:577
int pos
Definition audio_fx.h:563
float attack
Definition audio_fx.h:559
bool debug
Definition audio_fx.h:567
bool asc_active
Definition audio_fx.h:569
uint32_t srate
Definition audio_fx.h:560
float over_c
Definition audio_fx.h:576
unsigned int over_s
Definition audio_fx.h:575
int nextiter
Definition audio_fx.h:580
bool _asc_used
Definition audio_fx.h:589
float peak
Definition audio_fx.h:574
bool _sanitize
Definition audio_fx.h:579
Definition audio_fx.h:52
int lfo_active
Definition audio_fx.h:54
float rate
Definition audio_fx.h:55
gain_smoothing gs_dry
Definition audio_fx.h:56
fixed_point< unsigned int, 20 > phase
Definition audio_fx.h:58
fixed_point< unsigned int, 20 > dphase
Definition audio_fx.h:58
float get_dry() const
Definition audio_fx.h:73
void setup(int sample_rate)
Definition audio_fx.h:88
void set_rate(float rate)
Definition audio_fx.h:62
int get_lfo_active() const
Definition audio_fx.h:96
void set_lfo_active(int i)
Definition audio_fx.h:99
float dry
Definition audio_fx.h:55
float odsr
Definition audio_fx.h:55
void inc_phase(float req_phase)
Definition audio_fx.h:84
void set_wet(float wet)
Definition audio_fx.h:69
void set_dry(float dry)
Definition audio_fx.h:76
float wet
Definition audio_fx.h:55
int sample_rate
Definition audio_fx.h:54
void reset_phase(float req_phase)
Definition audio_fx.h:80
float get_wet() const
Definition audio_fx.h:66
gain_smoothing gs_wet
Definition audio_fx.h:56
float get_rate() const
Definition audio_fx.h:59
Definition onepole.h:35
bool set_full(float min_val, unsigned int full_samples, unsigned int active_samples)
Definition audio_fx.h:764
unsigned int counter
Definition audio_fx.h:750
overlap_window()
Definition audio_fx.h:753
unsigned int active_samples
Definition audio_fx.h:748
void set_coef(float t, unsigned int full_samples)
Definition audio_fx.h:761
float step
Definition audio_fx.h:746
float acc
Definition audio_fx.h:747
float val
Definition audio_fx.h:745
float get()
Definition audio_fx.h:776
unsigned int full_samples
Definition audio_fx.h:749
Definition audio_fx.h:677
double tmp[16]
Definition audio_fx.h:683
uint32_t srate
Definition audio_fx.h:680
void set_params(uint32_t sr, int factor, int filters)
Definition audio_fx.cpp:1371
resampleN()
Definition audio_fx.cpp:1362
int factor
Definition audio_fx.h:681
double * upsample(double sample)
Definition audio_fx.cpp:1383
double downsample(double *sample)
Definition audio_fx.cpp:1397
dsp::biquad_d2 filter[2][4]
Definition audio_fx.h:684
int filters
Definition audio_fx.h:682
float get_cutoff() const
Definition audio_fx.h:422
void extra_sanitize()
Definition audio_fx.h:432
simple_delay< 2048, float > apR6
Definition audio_fx.h:357
simple_delay< 2048, float > apL6
Definition audio_fx.h:356
float get_type() const
Definition audio_fx.h:395
int tr[6]
Definition audio_fx.h:364
float fb
Definition audio_fx.h:363
float old_left
Definition audio_fx.h:361
float diffusion
Definition audio_fx.h:363
float get_fb() const
Definition audio_fx.h:414
simple_delay< 2048, float > apL4
Definition audio_fx.h:356
void set_fb(float fb)
Definition audio_fx.h:418
float ldec[6]
Definition audio_fx.h:365
void set_time(float time)
Definition audio_fx.h:390
float rdec[6]
Definition audio_fx.h:365
fixed_point< unsigned int, 25 > phase
Definition audio_fx.h:358
void set_cutoff(float cutoff)
Definition audio_fx.h:425
fixed_point< unsigned int, 25 > dphase
Definition audio_fx.h:358
simple_delay< 2048, float > apR1
Definition audio_fx.h:357
float get_time() const
Definition audio_fx.h:387
void update_times()
Definition audio_fx.cpp:269
simple_delay< 2048, float > apL1
Definition audio_fx.h:356
simple_delay< 2048, float > apR3
Definition audio_fx.h:357
simple_delay< 2048, float > apR5
Definition audio_fx.h:357
simple_delay< 2048, float > apL5
Definition audio_fx.h:356
float get_diffusion() const
Definition audio_fx.h:402
int type
Definition audio_fx.h:362
reverb()
Definition audio_fx.h:369
onepole< float > lp_left
Definition audio_fx.h:360
int sr
Definition audio_fx.h:367
void set_type_and_diffusion(int type, float diffusion)
Definition audio_fx.h:409
int tl[6]
Definition audio_fx.h:364
simple_delay< 2048, float > apL2
Definition audio_fx.h:356
float cutoff
Definition audio_fx.h:363
float time
Definition audio_fx.h:363
float old_right
Definition audio_fx.h:361
virtual void setup(int sample_rate)
Definition audio_fx.h:378
void set_type(int type)
Definition audio_fx.h:398
simple_delay< 2048, float > apR4
Definition audio_fx.h:357
onepole< float > lp_right
Definition audio_fx.h:360
simple_delay< 2048, float > apR2
Definition audio_fx.h:357
void set_diffusion(float diffusion)
Definition audio_fx.h:405
simple_delay< 2048, float > apL3
Definition audio_fx.h:356
sine_table< int, 128, 10000 > sine
Definition audio_fx.h:359
samplereduction()
Definition audio_fx.cpp:1411
unsigned int cnt
Definition audio_fx.h:697
unsigned int round
Definition audio_fx.h:697
float target
Definition audio_fx.h:696
float amount
Definition audio_fx.h:696
unsigned int samples
Definition audio_fx.h:697
void set_params(float am)
Definition audio_fx.cpp:1420
float real
Definition audio_fx.h:696
double last
Definition audio_fx.h:698
virtual void setup(int sample_rate)
Definition audio_fx.h:204
void process(OutIter buf_out, InIter buf_in, int nsamples, bool active, float level_in=1., float level_out=1.)
Definition audio_fx.h:211
void reset()
Definition audio_fx.h:201
simple_chorus()
Definition audio_fx.h:193
simple_delay< MaxDelay, T > delay
Definition audio_fx.h:191
int ramp_delay_pos
Definition audio_fx.h:244
float freq_gain(float freq, float sr) const
Definition audio_fx.h:330
void set_fb(float fb)
Definition audio_fx.h:264
virtual void setup(int sample_rate)
Definition audio_fx.h:253
int ramp_pos
Definition audio_fx.h:244
float get_fb() const
Definition audio_fx.h:261
int last_delay_pos
Definition audio_fx.h:243
simple_flanger()
Definition audio_fx.h:246
int last_actual_delay_pos
Definition audio_fx.h:243
int lfo
Definition audio_fx.h:244
simple_delay< MaxDelay, T > delay
Definition audio_fx.h:241
float fb
Definition audio_fx.h:242
void reset()
Definition audio_fx.h:248
void process(OutIter buf_out, InIter buf_in, int nsamples, bool active, float level_in=1., float level_out=1.)
Definition audio_fx.h:268
void set_amount(float a)
Definition audio_fx.cpp:561
float offset
Definition audio_fx.h:532
void set_offset(float o)
Definition audio_fx.cpp:557
bool get_graph(float *data, int points, calf_plugins::cairo_iface *context, int *mode) const
Definition audio_fx.cpp:569
float get_value_from_phase(float ph) const
Definition audio_fx.cpp:484
float get_value()
Definition audio_fx.cpp:479
void set_params(float f, int m, float o, uint32_t sr, float amount=1.f, float pwidth=1.f)
Definition audio_fx.cpp:537
void advance(uint32_t count)
Definition audio_fx.cpp:523
bool is_active
Definition audio_fx.h:535
void set_pwidth(float p)
Definition audio_fx.cpp:565
void activate()
Definition audio_fx.cpp:468
float phase
Definition audio_fx.h:532
void set_freq(float f)
Definition audio_fx.cpp:549
void set_phase(float ph)
Definition audio_fx.cpp:529
uint32_t srate
Definition audio_fx.h:534
float pwidth
Definition audio_fx.h:532
int mode
Definition audio_fx.h:533
simple_lfo()
Definition audio_fx.cpp:461
float amount
Definition audio_fx.h:532
float freq
Definition audio_fx.h:532
void set_mode(int m)
Definition audio_fx.cpp:553
bool get_dot(float &x, float &y, int &size, calf_plugins::cairo_iface *context) const
Definition audio_fx.cpp:580
virtual void setup(int sample_rate)
Definition audio_fx.h:144
float state
Definition audio_fx.h:112
float * y1
Definition audio_fx.h:115
void set_mod_depth(float _mod_depth)
Definition audio_fx.h:133
void reset()
Definition audio_fx.cpp:71
float * x1
Definition audio_fx.h:115
float get_base_frq() const
Definition audio_fx.h:119
float get_fb() const
Definition audio_fx.h:137
int cnt
Definition audio_fx.h:113
int stages
Definition audio_fx.h:113
float fb
Definition audio_fx.h:111
void set_fb(float fb)
Definition audio_fx.h:140
float mod_depth
Definition audio_fx.h:111
simple_phaser(int _max_stages, float *x1vals, float *y1vals)
Definition audio_fx.cpp:40
int max_stages
Definition audio_fx.h:113
int get_stages() const
Definition audio_fx.h:125
float base_frq
Definition audio_fx.h:111
dsp::onepole< float, float > stage1
Definition audio_fx.h:114
float get_mod_depth() const
Definition audio_fx.h:130
void set_base_frq(float _base_frq)
Definition audio_fx.h:122
Definition primitives.h:425
tap_distortion()
Definition audio_fx.cpp:381
float srct
Definition audio_fx.h:712
float blend_old
Definition audio_fx.h:710
uint32_t srate
Definition audio_fx.h:717
float ap
Definition audio_fx.h:712
void set_sample_rate(uint32_t sr)
Definition audio_fx.cpp:425
float an
Definition audio_fx.h:712
float drive_old
Definition audio_fx.h:710
float imr
Definition audio_fx.h:712
void activate()
Definition audio_fx.cpp:391
resampleN resampler
Definition audio_fx.h:715
int over
Definition audio_fx.h:713
float rdrive
Definition audio_fx.h:712
bool is_active
Definition audio_fx.h:718
float kna
Definition audio_fx.h:712
float prev_out
Definition audio_fx.h:714
void set_params(float blend, float drive)
Definition audio_fx.cpp:401
float kc
Definition audio_fx.h:712
float meter
Definition audio_fx.h:711
float knb
Definition audio_fx.h:712
float get_distortion_level()
Definition audio_fx.cpp:454
float prev_med
Definition audio_fx.h:714
float kpb
Definition audio_fx.h:712
static float M(float x)
Definition audio_fx.h:726
float pwrq
Definition audio_fx.h:712
float sq
Definition audio_fx.h:712
float rbdr
Definition audio_fx.h:712
float kpa
Definition audio_fx.h:712
static float D(float x)
Definition audio_fx.h:731
double attack_coef
Definition audio_fx.h:611
double envelope
Definition audio_fx.h:613
int lookahead
Definition audio_fx.h:618
void set_params(float att_t, float att_l, float rel_t, float rel_l, float sust_th, int look)
Definition audio_fx.cpp:975
void calc_relfac()
Definition audio_fx.cpp:986
float att_level
Definition audio_fx.h:616
int channels
Definition audio_fx.h:620
float att_time
Definition audio_fx.h:616
double new_return
Definition audio_fx.h:615
double maxdelta
Definition audio_fx.h:615
float sust_thres
Definition audio_fx.h:616
double release_coef
Definition audio_fx.h:611
double attack
Definition audio_fx.h:613
float * lookbuf
Definition audio_fx.h:619
transients()
Definition audio_fx.cpp:935
double old_return
Definition audio_fx.h:615
void set_channels(int ch)
Definition audio_fx.cpp:959
bool sustain_ended
Definition audio_fx.h:614
double relfac
Definition audio_fx.h:615
void waveshape(float *in)
static const int looksize
Definition audio_fx.h:617
uint32_t srate
Definition audio_fx.h:621
int lookpos
Definition audio_fx.h:618
float rel_time
Definition audio_fx.h:616
void set_sample_rate(uint32_t sr)
Definition audio_fx.cpp:964
int cnt
Definition audio_fx.h:630
double release
Definition audio_fx.h:613
float rel_level
Definition audio_fx.h:616
Definition audio_fx.h:485
float high_gain
Definition audio_fx.h:488
void reset()
Definition audio_fx.h:491
void sanitize()
Definition audio_fx.h:512
float low_gain
Definition audio_fx.h:488
dsp::onepole< float > highcut
Definition audio_fx.h:487
float process(float v)
Definition audio_fx.h:497
dsp::onepole< float > lowcut
Definition audio_fx.h:487
void set(float _low_freq, float _low_gain, float _high_freq, float _high_gain, float sr)
Definition audio_fx.h:518
void copy_coeffs(const two_band_eq &src)
Definition audio_fx.h:504
#define M_PI
Definition compat.h:149
* e
Definition inflate.c:1404
int * l
Definition inflate.c:1579
unsigned z
Definition inflate.c:1589
unsigned * m
Definition inflate.c:1559
struct huft * t
Definition inflate.c:943
int y
Definition inflate.c:1588
unsigned v[N_MAX]
Definition inflate.c:1584
unsigned d
Definition inflate.c:940
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
unsigned x[BMAX+1]
Definition inflate.c:1586
unsigned f
Definition inflate.c:1572
struct @113205115357366127300225113341150224053346037032::@137033172036070230260373056156374243321245367362 left
struct @113205115357366127300225113341150224053346037032::@137033172036070230260373056156374243321245367362 right
JHUFF_TBL long freq[]
Definition jchuff.h:50
float in
Definition lilv_test.c:1460
float out
Definition lilv_test.c:1461
unsigned short uint16_t
Definition mid.cpp:99
unsigned int uint32_t
Definition mid.cpp:100
Definition benchmark.cpp:53
Definition audio_fx.h:36
T lerp(T v1, T v2, U mix)
Definition primitives.h:267
T sine_table< T, N, Multiplier >::data[N+1]
Definition primitives.h:442
void sanitize(float &value)
Definition primitives.h:354
png_structrp int mode
Definition png.h:1139
Definition giface.h:160
Definition biquad.h:346
Definition biquad.h:430
Definition delay.h:41
void put(T idata)
Definition delay.h:54
void get_interp(U &odata, int delay, float udelay)
Definition delay.h:94
Definition globals.h:33
signed int sample
Definition tap_dynamics_m.c:41
uch * p
Definition crypt.c:594
return c
Definition crypt.c:175
int r
Definition crypt.c:458
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
b
Definition crypt.c:628
ZCONST uch * init
Definition extract.c:2392
ulg size
Definition extract.c:2350
register uch * q
Definition fileio.c:817
typedef int(UZ_EXP MsgFn)()
_WDL_CSTRING_PREFIX void INT_PTR count
Definition wdlcstring.h:263