diff --git a/dynamite.ttl b/dynamite.ttl index e23cacc..7d48a35 100644 --- a/dynamite.ttl +++ b/dynamite.ttl @@ -44,7 +44,7 @@ lv2:index 3 ; lv2:symbol "threshold" ; lv2:name "Threshold" ; - lv2:default 1.0 ; - lv2:minimum -20.0 ; - lv2:maximum 60.0 ; + lv2:default 10.0 ; + lv2:minimum 0.0 ; + lv2:maximum 1.0 ; ]. \ No newline at end of file diff --git a/plugin.cc b/plugin.cc index 2603259..4ddfdb9 100644 --- a/plugin.cc +++ b/plugin.cc @@ -13,6 +13,9 @@ namespace Dynamite { case DRIVE: drive = (const float *)data; break; + case THRESHOLD: + threshold = (const float *)data; + break; } } @@ -21,6 +24,11 @@ namespace Dynamite { for(uint32_t pos = 0; pos < n_samples; pos++) { output[pos] = input[pos] * coeff; + if(output[pos] > *threshold) { + output[pos] = *threshold; + } else if (output[pos] < -*threshold) { + output[pos] = -*threshold; + } } } } \ No newline at end of file diff --git a/plugin.hh b/plugin.hh index 3af9681..919d59b 100644 --- a/plugin.hh +++ b/plugin.hh @@ -11,6 +11,7 @@ namespace Dynamite { class Drive : public Plugin { const float *drive; + const float *threshold; const float *input; float *output; public: