Basic distortion plugin!

This commit is contained in:
Aleks Rutins 2023-04-14 11:31:15 -04:00
parent c226177453
commit a32ece06df
3 changed files with 12 additions and 3 deletions

View file

@ -44,7 +44,7 @@
lv2:index 3 ; lv2:index 3 ;
lv2:symbol "threshold" ; lv2:symbol "threshold" ;
lv2:name "Threshold" ; lv2:name "Threshold" ;
lv2:default 1.0 ; lv2:default 10.0 ;
lv2:minimum -20.0 ; lv2:minimum 0.0 ;
lv2:maximum 60.0 ; lv2:maximum 1.0 ;
]. ].

View file

@ -13,6 +13,9 @@ namespace Dynamite {
case DRIVE: case DRIVE:
drive = (const float *)data; drive = (const float *)data;
break; break;
case THRESHOLD:
threshold = (const float *)data;
break;
} }
} }
@ -21,6 +24,11 @@ namespace Dynamite {
for(uint32_t pos = 0; pos < n_samples; pos++) { for(uint32_t pos = 0; pos < n_samples; pos++) {
output[pos] = input[pos] * coeff; output[pos] = input[pos] * coeff;
if(output[pos] > *threshold) {
output[pos] = *threshold;
} else if (output[pos] < -*threshold) {
output[pos] = -*threshold;
}
} }
} }
} }

View file

@ -11,6 +11,7 @@ namespace Dynamite {
class Drive : public Plugin<Drive> { class Drive : public Plugin<Drive> {
const float *drive; const float *drive;
const float *threshold;
const float *input; const float *input;
float *output; float *output;
public: public: