1 /* Calf DSP plugin pack
2 * Limiter 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_LIMIT_H
22 #define CALF_MODULES_LIMIT_H
31 #include "plugin_tools.h"
34 namespace calf_plugins
{
36 /**********************************************************************
37 * LIMITER by Christian Holschuh and Markus Schmidt
38 **********************************************************************/
40 class limiter_audio_module
: public audio_module
<limiter_metadata
>, public line_graph_iface
{
42 typedef limiter_audio_module AM
;
44 int mode
, mode_old
, oversampling_old
;
45 dsp::lookahead_limiter limiter
;
46 dsp::resampleN resampler
[2];
55 limiter_audio_module();
58 void params_changed();
60 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
61 void set_sample_rate(uint32_t sr
);
64 /**********************************************************************
65 * MULTIBAND LIMITER by Markus Schmidt and Christian Holschuh
66 **********************************************************************/
68 class multibandlimiter_audio_module
: public audio_module
<multibandlimiter_metadata
>, public frequency_response_line_graph
{
70 typedef multibandlimiter_audio_module AM
;
71 static const int strips
= 4;
72 uint32_t asc_led
, cnt
;
76 dsp::lookahead_limiter strip
[strips
];
77 dsp::lookahead_limiter broadband
;
78 dsp::resampleN resampler
[strips
][2];
79 dsp::crossover crossover
;
83 unsigned int buffer_size
;
84 unsigned int overall_buffer_size
;
87 float striprel
[strips
];
89 float weight_old
[strips
];
93 float oversampling_old
;
99 multibandlimiter_audio_module();
100 ~multibandlimiter_audio_module();
103 void params_changed();
105 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
106 void set_sample_rate(uint32_t sr
);
107 bool get_graph(int index
, int subindex
, int phase
, float *data
, int points
, cairo_iface
*context
, int *mode
) const;
108 bool get_layers(int index
, int generation
, unsigned int &layers
) const;
111 class sidechainlimiter_audio_module
: public audio_module
<sidechainlimiter_metadata
>, public frequency_response_line_graph
{
113 typedef sidechainlimiter_audio_module AM
;
114 static const int strips
= 5;
115 uint32_t asc_led
, cnt
;
119 dsp::lookahead_limiter strip
[strips
];
120 dsp::lookahead_limiter broadband
;
121 dsp::resampleN resampler
[strips
][2];
122 dsp::crossover crossover
;
126 unsigned int buffer_size
;
127 unsigned int overall_buffer_size
;
130 float striprel
[strips
];
131 float weight
[strips
];
132 float weight_old
[strips
];
136 float oversampling_old
;
142 sidechainlimiter_audio_module();
143 ~sidechainlimiter_audio_module();
146 void params_changed();
148 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
149 void set_sample_rate(uint32_t sr
);
150 bool get_graph(int index
, int subindex
, int phase
, float *data
, int points
, cairo_iface
*context
, int *mode
) const;
151 bool get_layers(int index
, int generation
, unsigned int &layers
) const;