summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2015-05-13 19:44:18 +1000
committerDamien Zammit <damien@zamaudio.com>2015-05-13 19:44:18 +1000
commit317a67a7c55facf144511837400a0b249f68fbd4 (patch)
treec0cb87681fefa6e870ab31a331cc34cce33c8979
parent22dc507d7cc2935ccd769afd5753fa8d05c63d6b (diff)
Fixed ZamChild670 parameter space
Signed-off-by: Damien Zammit <damien@zamaudio.com>
-rw-r--r--plugins/ZamChild670/ZamChild670Plugin.cpp46
-rw-r--r--plugins/ZamChild670/glue.h1
-rw-r--r--plugins/ZamChild670/wavechild670.h15
3 files changed, 36 insertions, 26 deletions
diff --git a/plugins/ZamChild670/ZamChild670Plugin.cpp b/plugins/ZamChild670/ZamChild670Plugin.cpp
index a8e6a4e..71a2378 100644
--- a/plugins/ZamChild670/ZamChild670Plugin.cpp
+++ b/plugins/ZamChild670/ZamChild670Plugin.cpp
@@ -25,10 +25,10 @@ ZamChild670Plugin::ZamChild670Plugin()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
- inputLevel = from_dB(-16.0);
- ACThreshold = from_dB(-3.f);
+ inputLevel = from_dB(-12.0);
+ ACThreshold = 0.2;
timeConstantSelect = 2;
- DCThreshold = from_dB(-6.f);
+ DCThreshold = 0.0;
outputGain = from_dB(0.0);
params = new Wavechild670Parameters(inputLevel,
ACThreshold, timeConstantSelect, DCThreshold,
@@ -56,27 +56,27 @@ void ZamChild670Plugin::d_initParameter(uint32_t index, Parameter& parameter)
parameter.name = "Input level";
parameter.symbol = "inlevel";
parameter.unit = "dB";
- parameter.ranges.def = -16.0f;
- parameter.ranges.min = -30.0f;
+ parameter.ranges.def = -12.0f;
+ parameter.ranges.min = -20.0f;
parameter.ranges.max = 0.0f;
break;
case paramAC:
parameter.hints = kParameterIsAutomable;
parameter.name = "AC Threshold";
parameter.symbol = "acthres";
- parameter.unit = "dB";
- parameter.ranges.def = -3.0f;
- parameter.ranges.min = -20.0f;
- parameter.ranges.max = 0.0f;
+ parameter.unit = "";
+ parameter.ranges.def = 0.2f;
+ parameter.ranges.min = 0.0f;
+ parameter.ranges.max = 1.0f;
break;
case paramDC:
parameter.hints = kParameterIsAutomable;
parameter.name = "DC Threshold";
parameter.symbol = "dcthres";
- parameter.unit = "dB";
- parameter.ranges.def = -6.0f;
- parameter.ranges.min = -20.0f;
- parameter.ranges.max = 0.0f;
+ parameter.unit = "";
+ parameter.ranges.def = 0.0f;
+ parameter.ranges.min = 0.0f;
+ parameter.ranges.max = 1.0f;
break;
case paramTau:
parameter.hints = kParameterIsAutomable | kParameterIsInteger;
@@ -93,8 +93,8 @@ void ZamChild670Plugin::d_initParameter(uint32_t index, Parameter& parameter)
parameter.symbol = "outlevel";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
- parameter.ranges.min = -30.0f;
- parameter.ranges.max = 0.0f;
+ parameter.ranges.min = -20.0f;
+ parameter.ranges.max = 20.0f;
break;
}
}
@@ -162,11 +162,11 @@ void ZamChild670Plugin::d_setProgram(uint32_t index)
return;
/* Default parameter values */
- inputLevel = -16.0;
- ACThreshold = -3.f;
+ inputLevel = from_dB(-12.0);
+ ACThreshold = 0.2;
timeConstantSelect = 2;
- DCThreshold = -6.f;
- outputGain = 0.0;
+ DCThreshold = 0.0;
+ outputGain = from_dB(0.0);
/* reset filter values */
d_activate();
@@ -178,9 +178,9 @@ void ZamChild670Plugin::d_setProgram(uint32_t index)
void ZamChild670Plugin::d_activate()
{
params->inputLevelA = params->inputLevelB = from_dB(inputLevel);
- params->ACThresholdA = params->ACThresholdB = from_dB(ACThreshold);
+ params->ACThresholdA = params->ACThresholdB = ACThreshold;
params->timeConstantSelectA = params->timeConstantSelectB = timeConstantSelect;
- params->DCThresholdA = params->DCThresholdB = from_dB(DCThreshold);
+ params->DCThresholdA = params->DCThresholdB = DCThreshold;
params->outputGain = from_dB(outputGain);
zamchild->setParameters(*params);
zamchild->warmUp();
@@ -189,9 +189,9 @@ void ZamChild670Plugin::d_activate()
void ZamChild670Plugin::d_run(const float** inputs, float** outputs, uint32_t frames)
{
params->inputLevelA = params->inputLevelB = from_dB(inputLevel);
- params->ACThresholdA = params->ACThresholdB = from_dB(ACThreshold);
+ params->ACThresholdA = params->ACThresholdB = ACThreshold;
params->timeConstantSelectA = params->timeConstantSelectB = timeConstantSelect;
- params->DCThresholdA = params->DCThresholdB = from_dB(DCThreshold);
+ params->DCThresholdA = params->DCThresholdB = DCThreshold;
params->outputGain = from_dB(outputGain);
zamchild->setParameters(*params);
diff --git a/plugins/ZamChild670/glue.h b/plugins/ZamChild670/glue.h
index 0ced6ca..da0b6d4 100644
--- a/plugins/ZamChild670/glue.h
+++ b/plugins/ZamChild670/glue.h
@@ -9,5 +9,4 @@
#define Confirm(x)
typedef double Real;
-
#endif
diff --git a/plugins/ZamChild670/wavechild670.h b/plugins/ZamChild670/wavechild670.h
index ab30f95..cef6737 100644
--- a/plugins/ZamChild670/wavechild670.h
+++ b/plugins/ZamChild670/wavechild670.h
@@ -38,6 +38,7 @@
#define LEVELTC_CIRCUIT_DEFAULT_R_R2 1e9
#define LEVELTC_CIRCUIT_DEFAULT_R_R3 1e9
+
class Wavechild670Parameters {
public:
Wavechild670Parameters(Real inputLevelA_, Real ACThresholdA_, uint timeConstantSelectA_, Real DCThresholdA_,
@@ -169,8 +170,8 @@ public:
VoutLeft = VoutA;
VoutRight = VoutB;
}
- VoutLeft = VoutLeft * outputGain;
- VoutRight = VoutRight * outputGain;
+ VoutLeft = clip(VoutLeft * outputGain);
+ VoutRight = clip(VoutRight * outputGain);
VoutInterleaved[0][i] = (float)VoutLeft;
VoutInterleaved[1][i] = (float)VoutRight;
@@ -206,6 +207,16 @@ protected:
}
}
+ static Real clip(Real in)
+ {
+ Real out = in;
+ if (in < -1.0)
+ out = -1.0;
+ if (in > 1.0)
+ out = 1.0;
+ return out;
+ }
+
protected:
Real sampleRate;
Real outputGain;