[SCM] calf/master: save before testing own limiter
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:40:41 UTC 2013
The following commit has been merged in the master branch:
commit 4d8fd88ba6e84cb84aa687aad404579ac9c2b8e3
Author: Markus Schmidt <schmidt at boomshop.net>
Date: Sun Nov 27 08:51:26 2011 +0100
save before testing own limiter
diff --git a/gui/gui-limiter.xml b/gui/gui-limiter.xml
new file mode 100644
index 0000000..b4d3d13
--- /dev/null
+++ b/gui/gui-limiter.xml
@@ -0,0 +1,67 @@
+<table rows="3" cols="1">
+ <table attach-x="0" attach-y="0" expand-y="0" expand-x="1" spacing="5" rows="1" cols="7">
+ <vbox shrink-x="1" expand-x="0" fill-x="0" expand="0" fill="0" attach-x="0" attach-y="0">
+ <label param="level_in" />
+ <knob param="level_in" size="2" />
+ <value param="level_in" />
+ </vbox>
+ <vbox shrink-x="1" expand-x="1" fill-x="1" expand="0" fill="0" attach-x="1" attach-y="0">
+ <label param="meter_inL" />
+ <vumeter param="meter_inL" mode="0" hold="1.5" falloff="2.5" shrink-y="0" position="2" width="120" />
+ <vumeter param="meter_inR" mode="0" hold="1.5" falloff="2.5" shrink-y="0" position="2" />
+ <label param="meter_inR" />
+ </vbox>
+ <vbox shrink-x="1" expand-x="0" fill-x="0" expand="0" fill="0" attach-x="2" attach-y="0">
+ <label text="0dB" expand="0" fill="0" />
+ <led param="clip_inL" expand="0" fill="0" />
+ <led param="clip_inR" expand="0" fill="0" />
+ <label text="0dB" expand="0" fill="0" />
+ </vbox>
+ <vbox expand="0" attach-x="3" attach-y="0" expand-x="0" fill-x="0" fill="0" pad-x="2">
+ <label param="bypass"/>
+ <align><toggle param="bypass" shrink="1"/></align>
+ </vbox>
+ <vbox shrink-x="1" expand-x="1" fill-x="1" expand="0" fill="0" attach-x="4" attach-y="0">
+ <label param="meter_outL" />
+ <vumeter param="meter_outL" mode="0" hold="1.5" falloff="2.5" shrink-y="0" position="2" width="120" />
+ <vumeter param="meter_outR" mode="0" hold="1.5" falloff="2.5" shrink-y="0" position="2" />
+ <label param="meter_outR" />
+ </vbox>
+ <vbox shrink-x="1" expand-x="0" fill-x="0" expand="0" fill="0" attach-x="5" attach-y="0">
+ <label text="0dB" expand="0" fill="0" />
+ <led param="clip_outL" expand="0" mode="1" fill="0" />
+ <led param="clip_outR" expand="0" mode="1" fill="0" />
+ <label text="0dB" expand="0" fill="0" />
+ </vbox>
+ <vbox shrink-x="1" expand-x="0" fill-x="0" expand="0" fill="0" attach-x="6" attach-y="0">
+ <label param="level_out" />
+ <knob param="level_out" size="2" />
+ <value param="level_out" />
+ </vbox>
+ </table>
+
+ <frame attach-x="0" attach-y="1" label="Limit" expand="0" fill="1">
+ <hbox homogenous="1">
+ <vbox>
+ <label param="attack" />
+ <knob param="attack" size="3" />
+ <value param="attack" />
+ </vbox>
+ <vbox>
+ <label param="limit" />
+ <knob param="limit" size="5" type="2" />
+ <value param="limit" />
+ </vbox>
+ <vbox>
+ <label param="release" />
+ <knob param="release" size="3" />
+ <value param="release" />
+ </vbox>
+ </hbox>
+ </frame>
+
+ <frame attach-x="0" attach-y="2" label="Attenuation" expand="1" fill="1">
+ <vumeter param="att" mode="2" hold="1.5" falloff="2.5" position="2" />
+ </frame>
+
+</table>
diff --git a/src/audio_fx.cpp b/src/audio_fx.cpp
index 78e56bb..8e6e8c2 100644
--- a/src/audio_fx.cpp
+++ b/src/audio_fx.cpp
@@ -542,39 +542,43 @@ bool simple_lfo::get_dot(float &x, float &y, int &size, cairo_iface *context) co
lookahead_limiter::lookahead_limiter() {
is_active = false;
+
buffer_time = 0.0053;
- num_chunks = 16;
buffer_len = 128;
buffer_pos = 0;
-
+ num_chunks = 16; // length of chunks array
+
/* Find size for power-of-two interleaved delay buffer */
while(buffer_len < srate * buffer_time * 2) {
- buffer_len *= 2;
+ buffer_len *= 2; // (512 @ 48kHz) length of buffer array
}
buffer = (float*) calloc(buffer_len, sizeof(float));
- delay = (int)(0.005 * srate);
+ memset(buffer, 0, num_chunks * sizeof(float)); // reset buffer to zero
+ delay = (int)(0.005 * srate); // (240 @ 48kHz) delay of returned samples in buffer
- chunk_pos = 0;
- chunk_num = 0;
- chunk_size = srate / 2000;
+ chunk_pos = 0; // position in chunk
+ chunk_num = 0; // count of processed chunks
- /* find a chunk size (in smaples) thats roughly 0.5ms */
- //chunk_size = srate / 2000;
chunks = (float*) calloc(num_chunks, sizeof(float));
-
- peak = 0.0f;
- atten = 1.0f;
- atten_lp = 1.0f;
+
+
+ peak = 0.0f; // holds the latest maximum of the input values left and right
+ atten = 1.0f; // holds the "pure" attenuation level
+ atten_lp = 1.0f; // holds the calculated attenuation level
delta = 0.0f;
- atten_max = 1.0;
+
+ atten_max = 1.0; // holds the latest attenuation level since last get_attenuation()
}
void lookahead_limiter::activate()
{
is_active = true;
- memset(buffer, 0, num_chunks * sizeof(float));
+
+ memset(buffer, 0, num_chunks * sizeof(float)); // reset buffer to zero
+
chunk_pos = 0;
chunk_num = 0;
+
peak = 0.0f;
atten = 1.0f;
atten_lp = 1.0f;
@@ -598,75 +602,82 @@ float lookahead_limiter::get_attenuation()
void lookahead_limiter::set_sample_rate(uint32_t sr)
{
srate = sr;
+ /* find a chunk size (in smaples) thats roughly 0.5ms */
+ chunk_size = srate / 2000; // 24 @ 48kHz
}
-void lookahead_limiter::set_params(float l, float r, float g, uint32_t sr)
+void lookahead_limiter::set_params(float l, float r, float g, uint32_t sr, bool d)
{
limit = l;
- release = r / 1000;
+ release = r / 1000.f;
gain = g;
srate = sr;
+ debug = d;
}
void lookahead_limiter::process(float &left, float &right)
{
- const float trim = 1.f;
- float sig;
+ const float trim = 1.f; // output multiplicator (added on input)
+ float sig; // cache for choosing max between peak and max between left and right
unsigned int i;
-
if (chunk_pos++ == chunk_size) {
/* we've got a full chunk */
-
- delta = (1.0f - atten) / (srate * release);
+ // one chunk contains a peak inside [chunk_size] sample blocks
+ delta = (1.0f - atten) / (srate * release); // (0.002083 @ 48kHz/50ms)
round_to_zero(&delta);
+ if(debug) printf("%.5f\n", atten);
for (i=0; i<10; i++) {
+ // cycle over last 10 chunks
const int p = (chunk_num - 9 + i) & (num_chunks - 1);
- const float this_delta = (limit / chunks[p] - atten) /
- ((float)(i) * srate * 0.0005f + 1.0f);
-
+ const float this_delta = (limit / chunks[p] - atten) /
+ ((float)(i) * srate * 0.0005f + 1.0f);
+ if(debug) printf("%.5f - %.5f\n", this_delta, delta);
if (this_delta < delta) {
delta = this_delta;
}
}
+ if(debug) printf("%.5f\n", delta);
+ // store actual peak and reset peak to 0.f
chunks[chunk_num++ & (num_chunks - 1)] = peak;
peak = 0.0f;
+
chunk_pos = 0;
+ //if(debug) printf("\ratt: %.4f - - cnum: %d",
+ // atten, chunk_num);
}
-
+
+ // store left and right in buffer array
buffer[(buffer_pos * 2) & (buffer_len - 1)] = left * trim + 1.0e-30;
buffer[(buffer_pos * 2 + 1) & (buffer_len - 1)] = right * trim + 1.0e-30;
-
+
+ // find absolute max between left and right and store it in peak if bigger
sig = fabs(left) > fabs(right) ? fabs(left) : fabs(right);
sig += 1.0e-30;
if (sig * trim > peak) {
peak = sig * trim;
}
-
+
+ // calculate atten and atten_lp
atten += delta;
atten_lp = atten * 0.1f + atten_lp * 0.9f;
if (delta > 0.0f && atten > 1.0f) {
atten = 1.0f;
delta = 0.0f;
}
- atten_max = (atten < atten_max) ? atten : atten_max;
+
+ // return left and right from buffer and multiply with atten_lp
left = buffer[(buffer_pos * 2 - delay * 2) & (buffer_len - 1)] * atten_lp;
right = buffer[(buffer_pos * 2 - delay * 2 + 1) & (buffer_len - 1)] * atten_lp;
+
+ // post treatment (denormal, limit)
round_to_zero(&left);
round_to_zero(&right);
-
- if (left < -limit) {
- left = -limit;
- } else if (left > limit) {
- left = limit;
- }
- if (right < -limit) {
- right = -limit;
- } else if (right > limit) {
- right = limit;
- }
-
- left /= limit;
- right /= limit;
+ std::max(left, -limit);
+ std::min(left, limit);
+ std::max(right, -limit);
+ std::min(right, limit);
+
+ atten_max = (atten < atten_max) ? atten : atten_max; // store max atten for meter output
- buffer_pos++;
+ buffer_pos++; // iterator
}
diff --git a/src/calf/audio_fx.h b/src/calf/audio_fx.h
index 3400acf..7aa5480 100644
--- a/src/calf/audio_fx.h
+++ b/src/calf/audio_fx.h
@@ -600,12 +600,13 @@ private:
unsigned int chunk_size;
float * chunks;
bool is_active;
+ bool debug;
public:
int id;
lookahead_limiter();
void process(float &left, float &right);
void set_sample_rate(uint32_t sr);
- void set_params(float l, float r, float g, uint32_t sr);
+ void set_params(float l, float r, float g, uint32_t sr, bool d = false);
float get_attenuation();
void activate();
void deactivate();
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index b8c9d42..8723770 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -230,6 +230,18 @@ struct sidechaingate_metadata: public plugin_metadata<sidechaingate_metadata>
PLUGIN_NAME_ID_LABEL("sidechaingate", "sidechaingate", "Sidechain Gate")
};
+/// Markus's limiter - metadata
+struct limiter_metadata: public plugin_metadata<limiter_metadata>
+{
+ enum { in_count = 2, out_count = 2, ins_optional = 0, outs_optional = 0, support_midi = false, require_midi = false, rt_capable = true };
+ enum { param_bypass, param_level_in, param_level_out,
+ STEREO_VU_METER_PARAMS,
+ param_limit, param_attack, param_release,
+ param_att,
+ param_count };
+ PLUGIN_NAME_ID_LABEL("limiter", "limiter", "Limiter")
+};
+
/// Markus's multibandlimiter - metadata
struct multibandlimiter_metadata: public plugin_metadata<multibandlimiter_metadata>
{
diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index 1588921..780beff 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -15,6 +15,7 @@
PER_MODULE_ITEM(deesser, false, "deesser")
PER_MODULE_ITEM(gate, false, "gate")
PER_MODULE_ITEM(sidechaingate, false, "sidechaingate")
+ PER_MODULE_ITEM(limiter, false, "limiter")
PER_MODULE_ITEM(multibandlimiter, false, "multibandlimiter")
PER_MODULE_ITEM(pulsator, false, "pulsator")
PER_MODULE_ITEM(equalizer5band, false, "eq5")
diff --git a/src/calf/modules_limit.h b/src/calf/modules_limit.h
index 60b550a..8a20c35 100644
--- a/src/calf/modules_limit.h
+++ b/src/calf/modules_limit.h
@@ -32,7 +32,26 @@
namespace calf_plugins {
-/// Multiband Limiter by Markus Schmidt (based on Krzysztof's filters and Steve's lookahead limiter algorythm)
+/// Limiter by Markus Schmidt
+class limiter_audio_module: public audio_module<limiter_metadata>, public line_graph_iface {
+private:
+ typedef limiter_audio_module AM;
+ uint32_t clip_inL, clip_inR, clip_outL, clip_outR;
+ int mode, mode_old;
+ float meter_inL, meter_inR, meter_outL, meter_outR;
+ dsp::lookahead_limiter limiter;
+public:
+ uint32_t srate;
+ bool is_active;
+ limiter_audio_module();
+ void activate();
+ void deactivate();
+ void params_changed();
+ uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
+ void set_sample_rate(uint32_t sr);
+};
+
+/// Multiband Limiter by Markus Schmidt
class multibandlimiter_audio_module: public audio_module<multibandlimiter_metadata>, public line_graph_iface {
private:
typedef multibandlimiter_audio_module AM;
diff --git a/src/metadata.cpp b/src/metadata.cpp
index b2ea303..20e23ee 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -491,6 +491,34 @@ CALF_PLUGIN_INFO(sidechaingate) = { 0x8504, "Sidechaingate", "Calf Sidechain Gat
////////////////////////////////////////////////////////////////////////////
+CALF_PORT_NAMES(limiter) = {"In L", "In R", "Out L", "Out R"};
+
+CALF_PORT_PROPS(limiter) = {
+ { 0, 0, 1, 0, PF_BOOL | PF_CTL_TOGGLE, NULL, "bypass", "Bypass" },
+ { 1, 0, 64, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "level_in", "Input" },
+ { 1, 0, 64, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "level_out", "Output" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_inL", "Input L" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_inR", "Input R" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_outL", "Output L" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_outR", "Output R" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_inL", "0dB-InL" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_inR", "0dB-InR" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_outL", "0dB-OutL" },
+ { 0, 0, 1, 0, PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_outR", "0dB-OutR" },
+
+ { 1, 0.0625, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "limit", "Limit" },
+ { 2, 0.1, 10, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "attack", "Attack" },
+ { 50, 1, 1000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "release", "Release" },
+
+ { 1, 0.125, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_CTLO_REVERSE | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL| PF_PROP_GRAPH, NULL, "att", "Attenuation" },
+
+ {}
+};
+
+CALF_PLUGIN_INFO(limiter) = { 0x8521, "Limiter", "Calf Limiter", "Markus Schmidt", calf_plugins::calf_copyright_info, "LimiterPlugin" };
+
+////////////////////////////////////////////////////////////////////////////
+
CALF_PORT_NAMES(multibandlimiter) = {"In L", "In R", "Out L", "Out R"};
const char *multibandlimiter_filter_choices[] = { "12dB", "36dB"};
@@ -532,7 +560,7 @@ CALF_PORT_PROPS(multibandlimiter) = {
{}
};
-CALF_PLUGIN_INFO(multibandlimiter) = { 0x8520, "Multibandlimiter", "Calf Multiband Limiter", "Markus Schmidt / Steve Harris", calf_plugins::calf_copyright_info, "LimiterPlugin" };
+CALF_PLUGIN_INFO(multibandlimiter) = { 0x8520, "Multibandlimiter", "Calf Multiband Limiter", "Markus Schmidt", calf_plugins::calf_copyright_info, "LimiterPlugin" };
////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules_limit.cpp b/src/modules_limit.cpp
index 40005f7..a82f645 100644
--- a/src/modules_limit.cpp
+++ b/src/modules_limit.cpp
@@ -28,6 +28,160 @@ using namespace calf_plugins;
#define SET_IF_CONNECTED(name) if (params[AM::param_##name] != NULL) *params[AM::param_##name] = name;
+/// Limiter by Markus Schmidt
+///
+/// This module splits the signal in four different bands
+/// and sends them through multiple filters (implemented by
+/// Krzysztof). They are processed by a compressing routine
+/// (implemented by Steve Harris) afterwards and summed up to the
+/// final output again.
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+limiter_audio_module::limiter_audio_module()
+{
+ is_active = false;
+ srate = 0;
+ // zero all displays
+ clip_inL = 0.f;
+ clip_inR = 0.f;
+ clip_outL = 0.f;
+ clip_outR = 0.f;
+ meter_inL = 0.f;
+ meter_inR = 0.f;
+ meter_outL = 0.f;
+ meter_outR = 0.f;
+}
+
+void limiter_audio_module::activate()
+{
+ is_active = true;
+ // set all filters and strips
+ params_changed();
+ limiter.activate();
+}
+
+void limiter_audio_module::deactivate()
+{
+ is_active = false;
+ limiter.deactivate();
+}
+
+void limiter_audio_module::params_changed()
+{
+ limiter.set_params(*params[param_limit], *params[param_release], 1.f, srate);
+}
+
+void limiter_audio_module::set_sample_rate(uint32_t sr)
+{
+ srate = sr;
+ limiter.set_sample_rate(srate);
+}
+
+uint32_t limiter_audio_module::process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask)
+{
+ bool bypass = *params[param_bypass] > 0.5f;
+ numsamples += offset;
+ if(bypass) {
+ // everything bypassed
+ while(offset < numsamples) {
+ outs[0][offset] = ins[0][offset];
+ outs[1][offset] = ins[1][offset];
+ ++offset;
+ }
+ // displays, too
+ clip_inL = 0.f;
+ clip_inR = 0.f;
+ clip_outL = 0.f;
+ clip_outR = 0.f;
+ meter_inL = 0.f;
+ meter_inR = 0.f;
+ meter_outL = 0.f;
+ meter_outR = 0.f;
+ } else {
+ // let meters fall a bit
+ clip_inL -= std::min(clip_inL, numsamples);
+ clip_inR -= std::min(clip_inR, numsamples);
+ clip_outL -= std::min(clip_outL, numsamples);
+ clip_outR -= std::min(clip_outR, numsamples);
+ meter_inL = 0.f;
+ meter_inR = 0.f;
+ meter_outL = 0.f;
+ meter_outR = 0.f;
+ while(offset < numsamples) {
+ // cycle through samples
+ float inL = ins[0][offset];
+ float inR = ins[1][offset];
+ // in level
+ inR *= *params[param_level_in];
+ inL *= *params[param_level_in];
+ // out vars
+ float outL = inL;
+ float outR = inR;
+
+ // process gain reduction
+ limiter.process(outL, outR);
+
+ // out level
+ outL *= *params[param_level_out];
+ outR *= *params[param_level_out];
+
+ // send to output
+ outs[0][offset] = outL;
+ outs[1][offset] = outR;
+
+ // clip LED's
+ if(inL > 1.f) {
+ clip_inL = srate >> 3;
+ }
+ if(inR > 1.f) {
+ clip_inR = srate >> 3;
+ }
+ if(outL > 1.f) {
+ clip_outL = srate >> 3;
+ }
+ if(outR > 1.f) {
+ clip_outR = srate >> 3;
+ }
+ // set up in / out meters
+ if(inL > meter_inL) {
+ meter_inL = inL;
+ }
+ if(inR > meter_inR) {
+ meter_inR = inR;
+ }
+ if(outL > meter_outL) {
+ meter_outL = outL;
+ }
+ if(outR > meter_outR) {
+ meter_outR = outR;
+ }
+ // next sample
+ ++offset;
+ } // cycle trough samples
+
+ } // process (no bypass)
+
+ // draw meters
+ SET_IF_CONNECTED(clip_inL);
+ SET_IF_CONNECTED(clip_inR);
+ SET_IF_CONNECTED(clip_outL);
+ SET_IF_CONNECTED(clip_outR);
+ SET_IF_CONNECTED(meter_inL);
+ SET_IF_CONNECTED(meter_inR);
+ SET_IF_CONNECTED(meter_outL);
+ SET_IF_CONNECTED(meter_outR);
+
+ if (*params[param_att]) {
+ if(bypass)
+ *params[param_att] = 1.f;
+ else
+ *params[param_att] = limiter.get_attenuation();
+ }
+
+ // whatever has to be returned x)
+ return outputs_mask;
+}
+
/// Multiband Limiter by Markus Schmidt
///
/// This module splits the signal in four different bands
@@ -134,10 +288,10 @@ void multibandlimiter_audio_module::params_changed()
q_old[2] = *params[param_q2];
}
// set the params of all strips
- strip[0].set_params(*params[param_limit] * 0.66, std::min(1.f / 30, *params[param_release]), 1.f, srate);
- strip[1].set_params(*params[param_limit] * 0.66, std::min(1.f / *params[param_freq0], *params[param_release]), 1.f, srate);
- strip[2].set_params(*params[param_limit] * 0.66, std::min(1.f / *params[param_freq1], *params[param_release]), 1.f, srate);
- strip[3].set_params(*params[param_limit] * 0.66, std::min(1.f / *params[param_freq2], *params[param_release]), 1.f, srate);
+ strip[0].set_params(*params[param_limit], std::max(1.f / 30, *params[param_release]), 1.f, srate);
+ strip[1].set_params(*params[param_limit], std::max(1.f / *params[param_freq0], *params[param_release]), 1.f, srate);
+ strip[2].set_params(*params[param_limit], std::max(1.f / *params[param_freq1], *params[param_release]), 1.f, srate);
+ strip[3].set_params(*params[param_limit], std::max(1.f / *params[param_freq2], *params[param_release]), 1.f, srate, true);
}
void multibandlimiter_audio_module::set_sample_rate(uint32_t sr)
@@ -201,11 +355,14 @@ uint32_t multibandlimiter_audio_module::process(uint32_t offset, uint32_t numsam
// out vars
float outL = 0.f;
float outR = 0.f;
+ int j1;
+ float left;
+ float right;
for (int i = 0; i < strips; i++) {
- float left = inL;
- float right = inR;
+ left = inL;
+ right = inR;
// send trough filters
- int j1;
+
switch(mode) {
case 0:
j1 = 0;
@@ -316,11 +473,13 @@ bool multibandlimiter_audio_module::get_graph(int index, int subindex, float *da
{
if (!is_active or subindex > 3)
return false;
+ float ret;
+ double freq;
+ int j1;
for (int i = 0; i < points; i++)
{
- float ret = 1.f;
- double freq = 20.0 * pow (20000.0 / 20.0, i * 1.0 / points);
- int j1;
+ ret = 1.f;
+ freq = 20.0 * pow (20000.0 / 20.0, i * 1.0 / points);
switch(mode) {
case 0:
j1 = 0;
@@ -347,9 +506,14 @@ bool multibandlimiter_audio_module::get_graph(int index, int subindex, float *da
break;
}
}
- data[i] = dB_grid(ret, 32, 0);
+ data[i] = dB_grid(ret);
+ }
+ if (*params[param_bypass] > 0.5f)
+ context->set_source_rgba(0.35, 0.4, 0.2, 0.3);
+ else {
+ context->set_source_rgba(0.35, 0.4, 0.2, 1);
+ context->set_line_width(1.5);
}
- context->set_line_width(1.5);
return true;
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list