summaryrefslogtreecommitdiff
path: root/plugins/ZamGate
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2016-04-17 16:32:11 +1000
committerDamien Zammit <damien@zamaudio.com>2016-04-17 16:32:11 +1000
commit956796adb8bb6a7ec1855afbd5963d268bdeda3a (patch)
treea8e6a756ec7e0e1d4d4c123c5f48c27d377faf17 /plugins/ZamGate
parent684588b2728df7e53f4ee696d06c01485e8b99e7 (diff)
Fix ZamGate* metering, and fix initial meter LEDs on comps and gates
Signed-off-by: Damien Zammit <damien@zamaudio.com>
Diffstat (limited to 'plugins/ZamGate')
-rw-r--r--plugins/ZamGate/ZamGatePlugin.cpp14
-rw-r--r--plugins/ZamGate/ZamGateUI.cpp2
2 files changed, 11 insertions, 5 deletions
diff --git a/plugins/ZamGate/ZamGatePlugin.cpp b/plugins/ZamGate/ZamGatePlugin.cpp
index 0d2a042..5afeb3a 100644
--- a/plugins/ZamGate/ZamGatePlugin.cpp
+++ b/plugins/ZamGate/ZamGatePlugin.cpp
@@ -243,12 +243,17 @@ void ZamGatePlugin::run(const float** inputs, float** outputs, uint32_t frames)
att = 1000.f / (attack * fs);
rel = 1000.f / (release * fs);
bool usesidechain = (sidechain < 0.5) ? false : true;
+ float in0;
+ float side;
+ float max = 0.f;
for(i = 0; i < frames; i++) {
+ in0 = inputs[0][i];
+ side = inputs[1][i];
if (usesidechain) {
- pushsamplel(samplesl, inputs[1][i]);
+ pushsamplel(samplesl, side);
} else {
- pushsamplel(samplesl, inputs[0][i]);
+ pushsamplel(samplesl, in0);
}
absample = averageabs(samplesl);
if (absample < from_dB(thresdb)) {
@@ -263,11 +268,12 @@ void ZamGatePlugin::run(const float** inputs, float** outputs, uint32_t frames)
gatestatel = gl;
- outputs[0][i] = gl * from_dB(makeup) * inputs[0][i];
+ outputs[0][i] = gl * from_dB(makeup) * in0;
gainr = (gl > 0) ? sanitize_denormal(-to_dB(gl)) : 40.0;
gainr = std::min(gainr, 40.f);
- outlevel = (absample > 0) ? to_dB(absample) - thresdb : -60.0;
+ max = (fabsf(outputs[0][i]) > max) ? fabsf(outputs[0][i]) : sanitize_denormal(max);
}
+ outlevel = (max == 0.f) ? -45.f : to_dB(max);
}
// -----------------------------------------------------------------------
diff --git a/plugins/ZamGate/ZamGateUI.cpp b/plugins/ZamGate/ZamGateUI.cpp
index 15f89cc..97682ca 100644
--- a/plugins/ZamGate/ZamGateUI.cpp
+++ b/plugins/ZamGate/ZamGateUI.cpp
@@ -40,7 +40,7 @@ ZamGateUI::ZamGateUI()
// led values
fLedRedValue = 0.0f;
- fLedYellowValue = 0.0f;
+ fLedYellowValue = -45.0f;
// knob
Image knobImage(ZamGateArtwork::knobData, ZamGateArtwork::knobWidth, ZamGateArtwork::knobHeight);