1 /* Calf DSP plugin pack
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_TOOLS_H
22 #define CALF_MODULES_TOOLS_H
34 #include "plugin_tools.h"
37 namespace calf_plugins
{
39 struct ladspa_plugin_info
;
41 /**********************************************************************
42 * STEREO TOOLS by Markus Schmidt
43 **********************************************************************/
45 class stereo_audio_module
:
46 public audio_module
<stereo_metadata
>
48 typedef stereo_audio_module AM
;
53 float meter_inL
, meter_inR
, meter_outL
, meter_outR
, meter_phase
;
58 unsigned int buffer_size
;
59 static inline float sign(float x
) {
60 if(x
< 0) return -1.f
;
64 float _phase
, _phase_sin_coef
, _phase_cos_coef
, _sc_level
, _inv_atan_shape
;
66 stereo_audio_module();
67 ~stereo_audio_module();
68 void params_changed();
70 void set_sample_rate(uint32_t sr
);
72 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
75 /**********************************************************************
76 * MONO INPUT by Markus Schmidt
77 **********************************************************************/
79 class mono_audio_module
:
80 public audio_module
<mono_metadata
>
82 typedef mono_audio_module AM
;
86 float meter_in
, meter_outL
, meter_outR
;
91 unsigned int buffer_size
;
92 static inline float sign(float x
) {
93 if(x
< 0) return -1.f
;
97 float _phase
, _phase_sin_coef
, _phase_cos_coef
, _sc_level
, _inv_atan_shape
;
100 ~mono_audio_module();
101 void params_changed();
103 void set_sample_rate(uint32_t sr
);
105 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
108 /**********************************************************************
109 * ANALYZER by Markus Schmidt and Christian Holschuh
110 **********************************************************************/
112 class analyzer_audio_module
:
113 public audio_module
<analyzer_metadata
>, public phase_graph_iface
,
114 public frequency_response_line_graph
116 typedef analyzer_audio_module AM
;
122 uint32_t clip_L
, clip_R
;
123 float meter_L
, meter_R
;
126 analyzer_audio_module();
127 void params_changed();
129 void set_sample_rate(uint32_t sr
);
131 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
132 bool get_phase_graph(float ** _buffer
, int * _length
, int * _mode
, bool * _use_fade
, float * _fade
, int * _accuracy
, bool * _display
) const;
133 bool get_graph(int index
, int subindex
, int phase
, float *data
, int points
, cairo_iface
*context
, int *mode
) const;
134 bool get_moving(int index
, int subindex
, int &direction
, float *data
, int x
, int y
, int &offset
, uint32_t &color
) const;
135 bool get_gridline(int index
, int subindex
, int phase
, float &pos
, bool &vertical
, std::string
&legend
, cairo_iface
*context
) const;
136 bool get_layers(int index
, int generation
, unsigned int &layers
) const;
137 ~analyzer_audio_module();
139 static const int max_phase_buffer_size
= 8192;
140 int phase_buffer_size
;
146 /**********************************************************************
148 **********************************************************************/
150 class widgets_audio_module
:
151 public audio_module
<widgets_metadata
>
155 dsp::simple_lfo lfo_sin
, lfo_sqr
, lfo_tri
;
157 widgets_audio_module();
158 ~widgets_audio_module();
159 void params_changed();
160 void set_sample_rate(uint32_t sr
);
161 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);