shithub: leaf

Download patch

ref: 2dcb4a2f94869c2a19325b8371ae2b010aca06e6
parent: d4b85ad07b1f1b47ffcddd59b7fb9fb943609ca4
author: Matthew Wang <Matthew@nat-oitwireless-inside-vapornet100-10-9-8-255.princeton.edu>
date: Tue Sep 3 13:38:23 EDT 2019

added getLatency function to oversampler

--- a/LEAF/Inc/leaf-oversampler.h
+++ b/LEAF/Inc/leaf-oversampler.h
@@ -24,8 +24,6 @@
 
 typedef struct _tOversampler
 {
-//    tFIR firUp;
-//    tFIR firDown;
     int ratio;
     float* pCoeffs;
     float* upState;
@@ -36,8 +34,9 @@
 
 void        tOversampler_init(tOversampler* const, int order, oBool extraQuality);
 void        tOversampler_upsample(tOversampler* const, float input, float* output);
-    float       tOversampler_downsample(tOversampler *const os, float* input);
+float       tOversampler_downsample(tOversampler *const os, float* input);
 float       tOversampler_tick(tOversampler* const, float input, float (*effectTick)(float));
+int         tOversampler_getLatency(tOversampler* const os);
 
 //==============================================================================
     
--- a/LEAF/Src/leaf-oversampler.c
+++ b/LEAF/Src/leaf-oversampler.c
@@ -19,6 +19,7 @@
 #endif
 
 // Oversampler
+// Latency is equal to the phase length (numTaps / ratio)
 void tOversampler_init(tOversampler* const os, int ratio, oBool extraQuality)
 {
     uint8_t offset = 0;
@@ -221,4 +222,9 @@
     }
     
     return output;
+}
+
+int tOversampler_getLatency(tOversampler* const os)
+{
+    return os->phaseLength;
 }