1 /* Calf DSP plugin pack
2 * Distortion related plugins
4 * Copyright (C) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald Johansen and others
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.
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.
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 02111-1307, USA.
21 #ifndef CALF_MODULES_DIST_H
22 #define CALF_MODULES_DIST_H
31 #include "plugin_tools.h"
33 namespace calf_plugins
{
35 /**********************************************************************
36 * SATURATOR by Markus Schmidt
37 **********************************************************************/
39 class saturator_audio_module
: public audio_module
<saturator_metadata
> {
41 float hp_pre_freq_old
, lp_pre_freq_old
;
42 float hp_post_freq_old
, lp_post_freq_old
;
43 float p_level_old
, p_freq_old
, p_q_old
;
45 dsp::biquad_d2 lp
[2][4], hp
[2][4];
47 dsp::tap_distortion dist
[2];
53 saturator_audio_module();
56 void params_changed();
57 void set_sample_rate(uint32_t sr
);
58 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
61 /**********************************************************************
62 * EXCITER by Markus Schmidt
63 **********************************************************************/
65 class exciter_audio_module
: public audio_module
<exciter_metadata
> {
67 float freq_old
, ceil_old
;
70 dsp::biquad_d2 hp
[2][4];
71 dsp::biquad_d2 lp
[2][2];
72 dsp::tap_distortion dist
[2];
78 exciter_audio_module();
81 void params_changed();
82 void set_sample_rate(uint32_t sr
);
83 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
86 /**********************************************************************
87 * BASS ENHANCER by Markus Schmidt
88 **********************************************************************/
90 class bassenhancer_audio_module
: public audio_module
<bassenhancer_metadata
> {
92 float freq_old
, floor_old
;
93 bool floor_active_old
;
95 dsp::biquad_d2 lp
[2][4];
96 dsp::biquad_d2 hp
[2][2];
97 dsp::tap_distortion dist
[2];
103 bassenhancer_audio_module();
106 void params_changed();
107 void set_sample_rate(uint32_t sr
);
108 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
111 /**********************************************************************
112 * TAPESIMULATOR by Markus Schmidt
113 **********************************************************************/
115 class tapesimulator_audio_module
:
116 public audio_module
<tapesimulator_metadata
>, public frequency_response_line_graph
118 typedef tapesimulator_audio_module AM
;
120 uint32_t clip_inL
, clip_inR
, clip_outL
, clip_outR
;
121 float meter_inL
, meter_inR
, meter_outL
, meter_outR
;
123 dsp::biquad_d2 lp
[2][2];
124 dsp::biquad_d2 noisefilters
[2][3];
125 dsp::transients transients
;
127 const static int channels
= 2;
128 dsp::simple_lfo lfo1
, lfo2
;
130 mutable float rms
, input
;
133 tapesimulator_audio_module();
134 void params_changed();
136 void set_sample_rate(uint32_t sr
);
138 float freq_gain(int index
, double freq
) const;
139 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
140 bool get_graph(int index
, int subindex
, int phase
, float *data
, int points
, cairo_iface
*context
, int *mode
) const;
141 bool get_dot(int index
, int subindex
, int phase
, float &x
, float &y
, int &size
, cairo_iface
*context
) const;
142 bool get_gridline(int index
, int subindex
, int phase
, float &pos
, bool &vertical
, std::string
&legend
, cairo_iface
*context
) const;
143 bool get_layers(int index
, int generation
, unsigned int &layers
) const;
146 /**********************************************************************
147 * CRUSHER by Markus Schmidt and Christian Holschuh
148 **********************************************************************/
150 class crusher_audio_module
:
151 public audio_module
<crusher_metadata
>, public line_graph_iface
155 dsp::bitreduction bitreduction
;
156 dsp::samplereduction samplereduction
[2];
162 crusher_audio_module();
163 void set_sample_rate(uint32_t sr
);
166 void params_changed();
167 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
168 bool get_graph(int index
, int subindex
, int phase
, float *data
, int points
, cairo_iface
*context
, int *mode
) const;
169 bool get_layers(int index
, int generation
, unsigned int &layers
) const;
170 bool get_gridline(int index
, int subindex
, int phase
, float &pos
, bool &vertical
, std::string
&legend
, cairo_iface
*context
) const;