shithub: leaf

Download patch

ref: 20bce9c7a2c74e53b8859a6e896bd7b27d801b7e
parent: c624f310c5db0a0b03235531a73d6248276c45d3
author: Davis Polito <davispolito1@gmail.com>
date: Fri May 27 13:39:50 EDT 2022

Add Compressor Parameter settings

--- a/leaf/Inc/leaf-distortion.h
+++ b/leaf/Inc/leaf-distortion.h
@@ -145,6 +145,7 @@
     float   tOversampler_downsample     (tOversampler* const, float* input);
     float   tOversampler_tick           (tOversampler* const, float input, float* oversample,
                                          float (*effectTick)(float));
+
     void    tOversampler_setRatio       (tOversampler* const, int ratio);
     void    tOversampler_setQuality     (tOversampler* const, int quality);
     int     tOversampler_getLatency     (tOversampler* const);
--- a/leaf/Inc/leaf-dynamics.h
+++ b/leaf/Inc/leaf-dynamics.h
@@ -80,6 +80,7 @@
     void    tCompressor_free        (tCompressor* const);
     
     float   tCompressor_tick        (tCompressor* const, float input);
+void    tCompressor_setParams   (tCompressor* const comp, float thresh, float ratio, float knee, float makeup, float attack, float release);
     
     
     /*!
--- a/leaf/Src/leaf-dynamics.c
+++ b/leaf/Src/leaf-dynamics.c
@@ -60,8 +60,8 @@
     
     c->T = 0.0f; // Threshold
     c->R = 0.5f; // compression Ratio
-    c->M = 3.0f; // decibel Width of knee transition
-    c->W = 1.0f; // decibel Make-up gain
+    c->M = 3.0f; // decibel Make-up gain
+    c->W = 1.0f; // decibel Width of knee transition
     
     c->sampleRate = leaf->sampleRate;
 }
@@ -120,6 +120,26 @@
     float attenuation = powf(10.0f, ((c->M - c->y_T[0])/20.0f));
     
     return attenuation * in;
+}
+
+////c->tauAttack = 100;
+//c->tauRelease = 100;
+//
+//c->isActive = 0;
+//
+//c->T = 0.0f; // Threshold
+//c->R = 0.5f; // compression Ratio
+//c->M = 3.0f; // decibel Width of knee transition
+//c->W = 1.0f; // decibel Make-up gain
+void tCompressor_setParams(tCompressor* const comp, float thresh, float ratio, float knee, float makeup, float attack, float release)
+{
+    _tCompressor* c = *comp;
+    c->T = thresh;
+    c->R = ratio;
+    c->W = knee;
+    c->M = makeup;
+    c->tauAttack = attack;
+    c->tauRelease = release;
 }
 
 /* Feedback Leveler */