ref: 5e8c53ea42e1adb25289198c739f1257613d351f
parent: 373d274a2445df856201a97687c206bc40e117dd
author: Matthew Wang <Matthew@nat-oitwireless-inside-vapornet100-10-9-53-29.princeton.edu>
date: Fri Dec 20 10:39:41 EST 2019
restore oversampler changes
--- 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
@@ -207,9 +207,9 @@
// Oversampler
//============================================================================================================
// Latency is equal to the phase length (numTaps / ratio)
-void tOversampler_init(tOversampler* const os, int ratio, oBool extraQuality)
+void tOversampler_init(tOversampler* const osr, 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 os)
+void tOversampler_free(tOversampler* const osr)
{
-// _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 os, float input, float (*effectTick)(float))
+float tOversampler_tick(tOversampler* const osr, float input, float (*effectTick)(float))
{
-// _tOversampler* os = *osr;
+ _tOversampler* os = *osr;
float buf[os->ratio];
- tOversampler_upsample(os, input, buf);
+ tOversampler_upsample(osr, input, buf);
for (int i = 0; i < os->ratio; ++i) {
buf[i] = effectTick(buf[i]);
}
- return tOversampler_downsample(os, buf);
+ return tOversampler_downsample(osr, buf);
}
// From CMSIS DSP Library
-void tOversampler_upsample(tOversampler* const os, float input, float* output)
+void tOversampler_upsample(tOversampler* const osr, 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 os, float* input)
+float tOversampler_downsample(tOversampler *const osr, 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 os)
+int tOversampler_getLatency(tOversampler* const osr)
{
-// _tOversampler* os = *osr;
+ _tOversampler* os = *osr;
return os->phaseLength;
}