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"
33 namespace calf_plugins
{
35 /**********************************************************************
36 * LIMITER by Christian Holschuh and Markus Schmidt
37 **********************************************************************/
39 class limiter_audio_module
: public audio_module
<limiter_metadata
>, public line_graph_iface
{
41 typedef limiter_audio_module AM
;
43 int mode
, mode_old
, oversampling_old
;
44 dsp::lookahead_limiter limiter
;
45 dsp::resampleN resampler
[2];
53 limiter_audio_module();
56 void params_changed();
58 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
59 void set_sample_rate(uint32_t sr
);
62 /**********************************************************************
63 * MULTIBAND LIMITER by Markus Schmidt and Christian Holschuh
64 **********************************************************************/
66 class multibandlimiter_audio_module
: public audio_module
<multibandlimiter_metadata
>, public frequency_response_line_graph
{
68 typedef multibandlimiter_audio_module AM
;
69 static const int strips
= 4;
70 uint32_t asc_led
, cnt
;
74 dsp::lookahead_limiter strip
[strips
];
75 dsp::lookahead_limiter broadband
;
76 dsp::resampleN resampler
[strips
][2];
77 dsp::crossover crossover
;
80 unsigned int buffer_size
;
81 unsigned int overall_buffer_size
;
84 float striprel
[strips
];
86 float weight_old
[strips
];
90 float oversampling_old
;
96 multibandlimiter_audio_module();
97 ~multibandlimiter_audio_module();
100 void params_changed();
102 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
103 void set_sample_rate(uint32_t sr
);
104 bool get_graph(int index
, int subindex
, int phase
, float *data
, int points
, cairo_iface
*context
, int *mode
) const;
105 bool get_layers(int index
, int generation
, unsigned int &layers
) const;