[SCM] calf/master: multiband limiter done except calculation bug in multi_coeff-buffer
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:40:43 UTC 2013
The following commit has been merged in the master branch:
commit 6057947a7fb4c150b120c063eff0bee3225db9b3
Author: Markus Schmidt <schmidt at boomshop.net>
Date: Wed Dec 7 01:48:08 2011 +0100
multiband limiter done except calculation bug in multi_coeff-buffer
diff --git a/gui/gui-multibandlimiter.xml b/gui/gui-multibandlimiter.xml
index 5a166f3..3fe6569 100644
--- a/gui/gui-multibandlimiter.xml
+++ b/gui/gui-multibandlimiter.xml
@@ -17,7 +17,7 @@
<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">
+ <vbox expand="0" attach-x="3" attach-y="0" expand-x="0" fill-x="0" fill="0" pad-x="25">
<label param="bypass"/>
<align><toggle param="bypass" shrink="1"/></align>
</vbox>
@@ -45,63 +45,63 @@
<frame label="X-Over" expand="0" fill="1">
<vbox>
<if cond="directlink">
- <line-graph refresh="1" width="160" height="90" param="limit" expand="0" fill="1"/>
+ <line-graph refresh="1" width="200" height="100" param="limit" expand="0" fill="0"/>
</if>
<hbox>
- <label param="mode" />
+ <label param="mode" expand="0" fill="0" />
<combo param="mode" />
</hbox>
<hbox>
<table rows="3" cols="2" spacing="0" border="0" expand="0" fill="0">
- <knob param="freq0" attach-x="0" attach-y="0" border="0" expand="0" fill="0" expand-x="0" fill-x="0" />
- <vbox attach-x="1" attach-y="0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
- <label param="freq0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
- <value param="freq0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
+ <knob param="freq0" attach-x="0" attach-y="0" border="0" expand-x="0" fill-x="0" />
+ <vbox attach-x="1" attach-y="0" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <label param="freq0" expand="0" fill="0" align-x="0.0" width="9" />
+ <value param="freq0" expand="0" fill="0" align-x="0.0" width="9" />
</vbox>
<hbox attach-x="0" attach-y="1" border="0" fill-x="0">
- <knob param="sep0" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
- <label param="sep0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <knob param="sep0" type="1" size="1" border="0" expand="0" fill="0" width="5" />
+ <label param="sep0" border="0" expand="0" fill="0" />
</hbox>
- <value param="sep0" attach-x="1" attach-y="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <value param="sep0" attach-x="1" attach-y="1" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="5" align-x="0.0" />
<hbox attach-x="0" attach-y="2" border="0" fill-x="0">
- <knob param="q0" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
- <label param="q0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <knob param="q0" type="1" size="1" border="0" expand="0" fill="0" />
+ <label param="q0" border="0" expand="0" fill="0" />
</hbox>
- <value param="q0" attach-x="1" attach-y="2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <value param="q0" attach-x="1" attach-y="2" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="5" align-x="0.0" />
</table>
<table rows="3" cols="2" spacing="0" border="0" expand="0" fill="0">
- <knob param="freq1" attach-x="0" attach-y="0" border="0" expand="0" fill="0" expand-x="0" fill-x="0" />
- <vbox attach-x="1" attach-y="0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
- <label param="freq1" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
- <value param="freq1" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <knob param="freq1" attach-x="0" attach-y="0" border="0" expand-x="0" fill-x="0" />
+ <vbox attach-x="1" attach-y="0" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <label param="freq1" expand="0" fill="0" align-x="0.0" width="9"/>
+ <value param="freq1" expand="0" fill="0" align-x="0.0" width="9" />
</vbox>
<hbox attach-x="0" attach-y="1" border="0" fill-x="0">
- <knob param="sep1" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
- <label param="sep1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <knob param="sep1" type="1" size="1" border="0" expand="0" fill="0" />
+ <label param="sep1" border="0" expand="0" fill="0" />
</hbox>
- <value param="sep1" attach-x="1" attach-y="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <value param="sep1" attach-x="1" attach-y="1" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="5" align-x="0.0" />
<hbox attach-x="0" attach-y="2" border="0" fill-x="0">
- <knob param="q1" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
- <label param="q1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <knob param="q1" type="1" size="1" border="0" expand="0" fill="0" />
+ <label param="q1" border="0" expand="0" fill="0" />
</hbox>
- <value param="q1" attach-x="1" attach-y="2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <value param="q1" attach-x="1" attach-y="2" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="5" align-x="0.0" />
</table>
<table rows="3" cols="2" spacing="0" border="0" expand="0" fill="0">
- <knob param="freq2" attach-x="0" attach-y="0" border="0" expand="0" fill="0" expand-x="0" fill-x="0" />
- <vbox attach-x="1" attach-y="0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
- <label param="freq2" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
- <value param="freq2" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
+ <knob param="freq2" attach-x="0" attach-y="0" border="0" expand-x="0" fill-x="0" />
+ <vbox attach-x="1" attach-y="0" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <label param="freq2" expand="0" fill="0" align-x="0.0" width="9" />
+ <value param="freq2" expand="0" fill="0" align-x="0.0" width="9" />
</vbox>
<hbox attach-x="0" attach-y="1" border="0" fill-x="0">
- <knob param="sep2" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
- <label param="sep2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <knob param="sep2" type="1" size="1" border="0" expand="0" fill="0" />
+ <label param="sep2" border="0" expand="0" fill="0" />
</hbox>
- <value param="sep2" attach-x="1" attach-y="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <value param="sep2" attach-x="1" attach-y="1" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="5" align-x="0.0" />
<hbox attach-x="0" attach-y="2" border="0" fill-x="0">
- <knob param="q2" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
- <label param="q2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <knob param="q2" type="1" size="1" border="0" expand="0" fill="0" />
+ <label param="q2" border="0" expand="0" fill="0" />
</hbox>
- <value param="q2" attach-x="1" attach-y="2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <value param="q2" attach-x="1" attach-y="2" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="5" align-x="0.0" />
</table>
</hbox>
</vbox>
diff --git a/src/audio_fx.cpp b/src/audio_fx.cpp
index f41d605..f979dcf 100644
--- a/src/audio_fx.cpp
+++ b/src/audio_fx.cpp
@@ -600,35 +600,39 @@ void lookahead_limiter::set_params(float l, float a, float r, float w, bool ar,
}
void lookahead_limiter::process(float &left, float &right, float * multi_buffer)
-{
+{
+ int in0 = 0;
+ int out0 = 0;
// write left and right to buffer
buffer[pos] = left;
buffer[pos + 1] = right;
// are we using multiband? get the multiband coefficient
float multi_coeff = (use_multi) ? multi_buffer[pos] : 1.f;
- //if(debug) printf("%03d: %.5f\n", pos, multi_coeff);
+ //if(debug and pos%10 == 0) printf("%03d: %.5f\n", pos, multi_buffer[pos]);
// input peak - impact in left or right channel?
peak = fabs(left) > fabs(right) ? fabs(left) : fabs(right);
// if we have a peak in input over our limit, check if delta to reach is
// more important than actual delta
- if(peak > limit * multi_coeff * weight) {
- _delta = ((limit * multi_coeff * weight) / peak - att) / buffer_size * channels;
+ if(peak > limit * multi_coeff * weight or multi_coeff < 1.f) {
+ in0 = 1;
+ _delta = ((limit * multi_coeff * weight) / peak - att) / (buffer_size / channels - channels);
if(_delta < delta) {
delta = _delta;
pos_next = pos;
}
- _delta = 0;
}
// switch left and right pointers to output
- left = buffer[(pos + 2) % buffer_size];
- right = buffer[(pos + 3) % buffer_size];
+ left = buffer[(pos + channels) % buffer_size];
+ right = buffer[(pos + channels + 1) % buffer_size];
// check multiband coefficient again for output pointer
- multi_coeff = (use_multi) ? multi_buffer[pos + 2] : 1.f;
+ multi_coeff = (use_multi) ? multi_buffer[(pos + channels) % buffer_size] : 1.f;
+
+ //if(pos % 20 == 2 and debug) printf("%+.5f | %3d\n", multi_coeff, pos);
// output peak - impact in left or right channel?
peak = fabs(left) > fabs(right) ? fabs(left) : fabs(right);
@@ -639,54 +643,61 @@ void lookahead_limiter::process(float &left, float &right, float * multi_buffer)
// output is over the limit?
if(peak > limit * multi_coeff * weight) {
+ delta = (1.0f - att) / (srate * release);
pos_next = -1;
unsigned int j;
- for(unsigned int i = 2; i < buffer_size; i += channels) {
- // iterate over buffer (ewxcept input and output pointer positions)
+ out0 = 1;
+ for(unsigned int i = channels; i < buffer_size; i += channels) {
+ // iterate over buffer (except input and output pointer positions)
// and search for maximum slope
- j = (i + pos + 2) % buffer_size;
- multi_coeff = (use_multi) ? multi_buffer[j] : 1.f;
+ j = (i + pos + channels) % buffer_size;
+ float _multi_coeff = (use_multi) ? multi_buffer[j] : 1.f;
float _peak = fabs(buffer[j]) > fabs(buffer[j + 1]) ? fabs(buffer[j]) : fabs(buffer[j + 1]);
// calculate steepness of slope
- if(_peak > limit * multi_coeff * weight) {
- _delta = ((limit * multi_coeff * weight) / peak - att) / i;
- }
- // if slope is steeper, use it, fucker.
- if(_delta < delta) {
- delta = _delta;
- pos_next = j;
- } else {
- // or do a normal release
- delta = (1.0f - att) / (srate * release);
+ if(_peak > limit * _multi_coeff * weight) {
+ _delta = ((limit * _multi_coeff * weight) / _peak - att) / (i / channels);
+ // if slope is steeper, use it, fucker.
+ if(_delta < delta) {
+ delta = _delta;
+ pos_next = j;
+ }
}
}
- _delta = 0;
}
// change the attenuation level
att += delta;
-
+ //if(debug and (pos%20 == 0 or in0 or out0)) printf("%03d: limit: %+.4f - att %+.4f - delta: %+.8f - in: %+.4f", pos, limit * multi_coeff * weight, att, delta, left);
// ...and calculate outpout from it
left *= att;
right *= att;
-
- // some security personnel pawing your values
+ // release time seems over
if (att > 1.0f) {
att = 1.0f;
delta = 0.0f;
}
-
+
+
+ //if(debug and (pos%20 == 0 or in0 or out0)) printf(" - out: %+.4f | in: %1d - out: %1d\n", left, in0, out0);
+// if(fabs(left) > limit * multi_coeff * weight or fabs(right) > limit * multi_coeff * weight)
+// printf("%+.5f - %+.5f | %+.5f\n", left, right, limit);
+
+ // security personnel pawing your values
if(att < 0.f) {
+ // if this happens we're doomed!!
+ // may happen on manually lowering attack
att = 0.0000000001;
delta = (1.0f - att) / (srate * release);
}
- if(1 - att < 0.00000001) {
+ if(att != 1.f and 1 - att < 0.0000000000001) {
+ // denormalize att
att = 1.f;
}
- if(fabs(delta) < 0.000000001) {
+ if(delta != 0.f and fabs(delta) < 0.00000000000001) {
+ // denormalize delta
delta = 0.f;
}
@@ -697,6 +708,7 @@ void lookahead_limiter::process(float &left, float &right, float * multi_buffer)
left = std::min(left, limit * multi_coeff * weight);
right = std::max(right, -limit * multi_coeff * weight);
right = std::min(right, limit * multi_coeff * weight);
+ //if(left > 0.001f) printf("%3d: left: %+.5f - limit: %+.5f - mc: %+.5f weight: %+.5f\n", pos, left, limit, multi_coeff, weight);
att_max = (att < att_max) ? att : att_max; // store max atten for meter output
diff --git a/src/calf/audio_fx.h b/src/calf/audio_fx.h
index 7f56472..d8e1e01 100644
--- a/src/calf/audio_fx.h
+++ b/src/calf/audio_fx.h
@@ -566,7 +566,8 @@ public:
};
-/// Lookahead Limiter by Markus Schmidt
+/// Lookahead Limiter by Markus Schmidt and Christian Holschuh
+
class lookahead_limiter {
private:
float limit, attack, release, weight;
@@ -588,6 +589,10 @@ private:
float over_c;
int pos_next;
bool use_multi;
+ static inline void denormal(volatile float *f) {
+ *f += 1e-18;
+ *f -= 1e-18;
+ }
public:
lookahead_limiter();
void set_multi(bool set);
@@ -597,10 +602,6 @@ public:
float get_attenuation();
void activate();
void deactivate();
- static inline void denormal(volatile float *f) {
- *f += 1e-18;
- *f -= 1e-18;
- }
};
#if 0
diff --git a/src/calf/modules_limit.h b/src/calf/modules_limit.h
index 2f8cae2..6735ea4 100644
--- a/src/calf/modules_limit.h
+++ b/src/calf/modules_limit.h
@@ -68,6 +68,7 @@ private:
float *buffer;
int channels;
float striprel[strips];
+ float weight[strips];
public:
uint32_t srate;
bool is_active;
diff --git a/src/metadata.cpp b/src/metadata.cpp
index 1f461a1..aefb9f2 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -566,9 +566,9 @@ CALF_PORT_PROPS(multibandlimiter) = {
{ 0.1f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "weight2", "Weight 3" },
{ 0.f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "weight3", "Weight 4" },
- { 0.2f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "release0", "Release 1" },
- { 0.f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "release1", "Release 2" },
- { -0.1f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "release2", "Release 3" },
+ { 0.4f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "release0", "Release 1" },
+ { 0.2f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "release1", "Release 2" },
+ { 0.f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "release2", "Release 3" },
{ -0.2f, -1.f, 1.f, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "release3", "Release 4" },
{ 1, 0.f, 1000, 0, PF_FLOAT | PF_UNIT_MSEC | PF_PROP_OUTPUT, NULL, "effrelease0", "Effectively Release 1" },
diff --git a/src/modules_limit.cpp b/src/modules_limit.cpp
index 030b306..cceef87 100644
--- a/src/modules_limit.cpp
+++ b/src/modules_limit.cpp
@@ -297,21 +297,31 @@ void multibandlimiter_audio_module::params_changed()
}
// set the params of all strips
float rel;
+
+ *params[param_weight0] = 0.f;
+ *params[param_weight1] = 0.f;
+ *params[param_weight2] = 0.f;
+ *params[param_weight3] = 0.f;
+
rel = *params[param_release] * pow(0.25, *params[param_release0] * -1);
rel = (*params[param_minrel] > 0.5) ? std::max(2500 * (1.f / 30), rel) : rel;
- strip[0].set_params(*params[param_limit], *params[param_attack], rel, pow(0.25, *params[param_weight0] * -1), true, true);
+ weight[0] = pow(0.25, *params[param_weight0] * -1);
+ strip[0].set_params(*params[param_limit], *params[param_attack], rel, weight[0], true, true);
*params[param_effrelease0] = rel;
rel = *params[param_release] * pow(0.25, *params[param_release1] * -1);
rel = (*params[param_minrel] > 0.5) ? std::max(2500 * (1.f / *params[param_freq0]), rel) : rel;
- strip[1].set_params(*params[param_limit], *params[param_attack], rel, pow(0.25, *params[param_weight1] * -1), true);
+ weight[1] = pow(0.25, *params[param_weight1] * -1);
+ strip[1].set_params(*params[param_limit], *params[param_attack], rel, weight[1], true);
*params[param_effrelease1] = rel;
rel = *params[param_release] * pow(0.25, *params[param_release2] * -1);
rel = (*params[param_minrel] > 0.5) ? std::max(2500 * (1.f / *params[param_freq1]), rel) : rel;
- strip[2].set_params(*params[param_limit], *params[param_attack], rel, pow(0.25, *params[param_weight2] * -1), true);
+ weight[2] = pow(0.25, *params[param_weight2] * -1);
+ strip[2].set_params(*params[param_limit], *params[param_attack], rel, weight[2], true);
*params[param_effrelease2] = rel;
rel = *params[param_release] * pow(0.25, *params[param_release3] * -1);
rel = (*params[param_minrel] > 0.5) ? std::max(2500 * (1.f / *params[param_freq2]), rel) : rel;
- strip[3].set_params(*params[param_limit], *params[param_attack], rel, pow(0.25, *params[param_weight3] * -1), true);
+ weight[3] = pow(0.25, *params[param_weight3] * -1);
+ strip[3].set_params(*params[param_limit], *params[param_attack], rel, weight[3], true);
*params[param_effrelease3] = rel;
// rebuild multiband buffer
@@ -411,6 +421,7 @@ uint32_t multibandlimiter_audio_module::process(uint32_t offset, uint32_t numsam
// send trough filters
switch(mode) {
+ // how many filter passes? (12/36dB)
case 0:
j1 = 0;
break;
@@ -420,53 +431,55 @@ uint32_t multibandlimiter_audio_module::process(uint32_t offset, uint32_t numsam
}
for (int j = 0; j <= j1; j++){
if(i + 1 < strips) {
+ // do lowpass on all bands except most high
left = lpL[i][j].process(left);
right = lpR[i][j].process(right);
lpL[i][j].sanitize();
lpR[i][j].sanitize();
}
if(i - 1 >= 0) {
+ // do highpass on all bands except most low
left = hpL[i - 1][j].process(left);
right = hpR[i - 1][j].process(right);
hpL[i - 1][j].sanitize();
hpR[i - 1][j].sanitize();
}
}
+
+ // remember filtered values for limiting
+ // (we need multiband_coeff before we can call the limiter bands)
_tmpL[i] = left;
_tmpR[i] = right;
- float k;
- switch (i) {
- case 0:
- k = pow(0.25, *params[param_weight0] * -1);
- break;
- case 1:
- k = pow(0.25, *params[param_weight1] * -1);
- break;
- case 2:
- k = pow(0.25, *params[param_weight2] * -1);
- break;
- case 3:
- k = pow(0.25, *params[param_weight3] * -1);
- break;
- }
-
- sum_left += left * k;
- sum_right += right * k;
+
+ //if(pos%20 == 0) printf("%+.5f - ", left);
+
+ // sum up for multiband coefficient
+ //sum_left += left * weight[i];
+ //sum_right += right * weight[i];
+ sum_left += ((fabs(left) > *params[param_limit]) ? *params[param_limit] * (fabs(left) / left) : left) * weight[i];
+ sum_right += ((fabs(right) > *params[param_limit]) ? *params[param_limit] * (fabs(right) / right) : right) * weight[i];
} // process single strip with filter
// write multiband coefficient to buffer
- buffer[pos] = *params[param_limit] / std::min(fabs(sum_left), fabs(sum_right));
- //printf("%03d: %.5f\n", pos, buffer[pos]);
+ //buffer[pos] = *params[param_limit] / std::min(fabs(sum_left), fabs(sum_right));
+ buffer[pos] = std::min(*params[param_limit] / std::min(fabs(sum_left), fabs(sum_right)), 1.0);
+
+ //if(pos%20 == 0) printf("| %+.5f | %+.5f : %3d\n", buffer[pos], std::max(fabs(sum_left), fabs(sum_right)), pos);
+ //if(pos%10 == 0) printf("%03d: %.5f\n", pos, buffer[pos]);
+ //float bufferSum = 0.f;
for (int i = 0; i < strips; i++) {
// process gain reduction
+ //bufferSum += strip[i].buffer[(pos + 2) % buffer_size];
strip[i].process(_tmpL[i], _tmpR[i], buffer);
- // sum up output
- // autolevel
- _tmpL[i] /= *params[param_limit];
- _tmpR[i] /= *params[param_limit];
+ // sum up output of limiters
outL += _tmpL[i];
outR += _tmpR[i];
} // process single strip again for limiter
+ //if(outL > 0.001f) printf("%3d: out: %+.5f - coeffOut: %+.5f - bufferSum: %+.5f\n", pos, outL, buffer[(pos + 2) % buffer_size], bufferSum);
+
+ // autolevel
+ outL /= *params[param_limit];
+ outR /= *params[param_limit];
// out level
outL *= *params[param_level_out];
@@ -477,10 +490,10 @@ uint32_t multibandlimiter_audio_module::process(uint32_t offset, uint32_t numsam
outs[1][offset] = outR;
// clip LED's
- if(inL > 1.f) {
+ if(ins[0][offset] > 1.f) {
clip_inL = srate >> 3;
}
- if(inR > 1.f) {
+ if(ins[1][offset] > 1.f) {
clip_inR = srate >> 3;
}
if(outL > 1.f) {
@@ -491,10 +504,10 @@ uint32_t multibandlimiter_audio_module::process(uint32_t offset, uint32_t numsam
}
// set up in / out meters
if(inL > meter_inL) {
- meter_inL = inL;
+ meter_inL = ins[0][offset];
}
if(inR > meter_inR) {
- meter_inR = inR;
+ meter_inR = ins[1][offset];
}
if(outL > meter_outL) {
meter_outL = outL;
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list