shithub: leaf

Download patch

ref: 373d274a2445df856201a97687c206bc40e117dd
parent: 0a2afe1224107c36481c4c050b3040591a9fc35c
author: Matthew Wang <Matthew@nat-oitwireless-inside-vapornet100-10-9-53-29.princeton.edu>
date: Fri Dec 20 10:20:24 EST 2019

minor distortion fixes; revert oversampler to not use mempool for struct

binary files a/.DS_Store b/.DS_Store differ
--- a/LEAF/Inc/leaf-distortion.h
+++ b/LEAF/Inc/leaf-distortion.h
@@ -81,9 +81,9 @@
         float* downState;
         int numTaps;
         int phaseLength;
-    } _tOversampler;
+    } tOversampler;
     
-    typedef _tOversampler* tOversampler;
+//    typedef _tOversampler* tOversampler;
     
     void        tOversampler_init(tOversampler* const, int order, oBool extraQuality);
     void        tOversampler_free(tOversampler* const);
--- a/LEAF/Src/leaf-distortion.c
+++ b/LEAF/Src/leaf-distortion.c
@@ -30,7 +30,7 @@
     w->xn1 = 0.0f;
 }
 
-void tLockhardWavefolder_free(tLockhartWavefolder* const wf)
+void tLockhartWavefolder_free(tLockhartWavefolder* const wf)
 {
     _tLockhartWavefolder* w = *wf;
     
@@ -207,9 +207,9 @@
 // Oversampler
 //============================================================================================================
 // Latency is equal to the phase length (numTaps / ratio)
-void tOversampler_init(tOversampler* const osr, int ratio, oBool extraQuality)
+void tOversampler_init(tOversampler* const os, int ratio, oBool extraQuality)
 {
-    _tOversampler* os = *osr = (_tOversampler*) leaf_alloc(sizeof(_tOversampler));
+//    _tOversampler* os = *osr = (_tOversampler*) leaf_alloc(sizeof(_tOversampler));
     
     uint8_t offset = 0;
     if (extraQuality) offset = 6;
@@ -226,9 +226,9 @@
     }
 }
 
-void tOversampler_free(tOversampler* const osr)
+void tOversampler_free(tOversampler* const os)
 {
-    _tOversampler* os = *osr;
+//    _tOversampler* os = *osr;
     
     leaf_free(os->upState);
     leaf_free(os->downState);
@@ -235,25 +235,25 @@
     leaf_free(os);
 }
 
-float tOversampler_tick(tOversampler* const osr, float input, float (*effectTick)(float))
+float tOversampler_tick(tOversampler* const os, float input, float (*effectTick)(float))
 {
-    _tOversampler* os = *osr;
+//    _tOversampler* os = *osr;
     
     float buf[os->ratio];
     
-    tOversampler_upsample(osr, input, buf);
+    tOversampler_upsample(os, input, buf);
     
     for (int i = 0; i < os->ratio; ++i) {
         buf[i] = effectTick(buf[i]);
     }
     
-    return tOversampler_downsample(osr, buf);
+    return tOversampler_downsample(os, buf);
 }
 
 // From CMSIS DSP Library
-void tOversampler_upsample(tOversampler* const osr, float input, float* output)
+void tOversampler_upsample(tOversampler* const os, float input, float* output)
 {
-    _tOversampler* os = *osr;
+//    _tOversampler* os = *osr;
     
     float *pState = os->upState;                 /* State pointer */
     const float *pCoeffs = os->pCoeffs;               /* Coefficient pointer */
@@ -344,9 +344,9 @@
 }
 
 // From CMSIS DSP Library
-float tOversampler_downsample(tOversampler *const osr, float* input)
+float tOversampler_downsample(tOversampler *const os, float* input)
 {
-    _tOversampler* os = *osr;
+//    _tOversampler* os = *osr;
     
     float *pState = os->downState;                 /* State pointer */
     const float *pCoeffs = os->pCoeffs;               /* Coefficient pointer */
@@ -428,8 +428,8 @@
     return output;
 }
 
-int tOversampler_getLatency(tOversampler* const osr)
+int tOversampler_getLatency(tOversampler* const os)
 {
-    _tOversampler* os = *osr;
+//    _tOversampler* os = *osr;
     return os->phaseLength;
 }
--- a/LEAF/leaf.h
+++ b/LEAF/leaf.h
@@ -23,7 +23,7 @@
 #include ".\Inc\leaf-math.h"
 #include ".\Inc\leaf-mempool.h"
 #include ".\Inc\leaf-tables.h"
-#include ".\Inc\leaf-tables.h"
+#include ".\Inc\leaf-distortion.h"
 #include ".\Inc\leaf-oscillators.h"
 #include ".\Inc\leaf-filters.h"
 #include ".\Inc\leaf-delay.h"
@@ -44,7 +44,7 @@
 #include "./Inc/leaf-math.h"
 #include "./Inc/leaf-mempool.h"
 #include "./Inc/leaf-tables.h"
-#include "./Inc/leaf-tables.h"
+#include "./Inc/leaf-distortion.h"
 #include "./Inc/leaf-oscillators.h"
 #include "./Inc/leaf-filters.h"
 #include "./Inc/leaf-delay.h"