diff options
author | Damien Zammit <damien@zamaudio.com> | 2016-04-20 12:47:30 +1000 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2016-04-20 12:47:30 +1000 |
commit | 63e6ea7e43949ec907f78cf58931c1343d0ed00e (patch) | |
tree | 3ede9498045edc44bc174e370717e77bd62044cf /plugins/ZaMaximX2/ZaMaximX2Plugin.hpp | |
parent | fa60d65bd5c0c5523ebc83de20c8ae8d140139d5 (diff) |
Fixed MAJOR bug with ZaMaximX2 limiter, now no clipping step and
improved algorithm for limiting
Signed-off-by: Damien Zammit <damien@zamaudio.com>
Diffstat (limited to 'plugins/ZaMaximX2/ZaMaximX2Plugin.hpp')
-rw-r--r-- | plugins/ZaMaximX2/ZaMaximX2Plugin.hpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/plugins/ZaMaximX2/ZaMaximX2Plugin.hpp b/plugins/ZaMaximX2/ZaMaximX2Plugin.hpp index 68cf7c7..b162d2e 100644 --- a/plugins/ZaMaximX2/ZaMaximX2Plugin.hpp +++ b/plugins/ZaMaximX2/ZaMaximX2Plugin.hpp @@ -20,10 +20,8 @@ #include "DistrhoPlugin.hpp" -#define MAX_SAMPLES 64 -#define MAX(a,b) ((a) < (b) ? (b) : (a)) -#define MIN(a,b) ((a) > (b) ? (b) : (a)) - +#define MAX_DELAY 24 +#define MAX_AVG 12 START_NAMESPACE_DISTRHO @@ -119,12 +117,11 @@ protected: void activate() override; void deactivate() override; void run(const float** inputs, float** outputs, uint32_t frames) override; - double normalise(double in, double gainr); + double normalise(double in); double clip(double in); double avgall(double in[]); double maxsample(double in[]); - void pushsample(double in[], double sample, int *pos); - void pushall(double in[], double sample, int *pos); + void pushsample(double in[], double sample, int *pos, int maxsamples); double getoldsample(double in[], int pos); // ------------------------------------------------------------------- @@ -132,11 +129,11 @@ protected: private: float release,ceiling,thresdb,gainred,outlevel;//parameters int pose[2], posz[2], posc[2]; - double cn[2][MAX_SAMPLES]; - double emaxn[2][MAX_SAMPLES]; - double z[2][MAX_SAMPLES]; + double cn[2][MAX_DELAY]; + double emaxn[2][MAX_AVG]; + double z[2][MAX_DELAY]; double emax_old[2]; - double eavg_old[2]; + double e_old[2]; }; // ----------------------------------------------------------------------- |