shithub: leaf

Download patch

ref: 77f442e4ff86a02bd97e5a61e2cbffa6802c7f11
parent: ce517563012c1a25e86cea537304e9fd7c91c969
author: spiricom <jeff@snyderphonics.com>
date: Sun Oct 13 16:29:24 EDT 2019

put pitch shifter memory in mempool

--- a/LEAF/Inc/leaf-globals.h
+++ b/LEAF/Inc/leaf-globals.h
@@ -52,9 +52,6 @@
 
 #define     DELAY_LENGTH        16000   // The maximum delay length of all Delay/DelayL/DelayA components.
                                             // Feel free to change to suit memory constraints or desired delay max length / functionality.
-
-
-#define TALKBOX_BUFFER_LENGTH   1600    // Every talkbox instance introduces 5 buffers of this size
     
 union unholy_t { /* a union between a float and an integer */
     float f;
--- a/LEAF/Inc/leaf-mempool.h
+++ b/LEAF/Inc/leaf-mempool.h
@@ -51,7 +51,7 @@
 //==============================================================================
 
 
-#define MPOOL_POOL_SIZE   50000
+#define MPOOL_POOL_SIZE   50 000
 
 #define MPOOL_ALIGN_SIZE (8)
 
--- a/LEAF/Inc/leaf-pitch.h
+++ b/LEAF/Inc/leaf-pitch.h
@@ -22,7 +22,7 @@
 
 #include "leaf-filter.h"
 #include "leaf-utilities.h"
-
+#include "leaf.h"
 //==============================================================================
     
 #define DEFPITCHRATIO 2.0f
@@ -52,9 +52,9 @@
     float jump;               // read pointer jump length and direction
     float xfadelength;        // crossfade length expressed at input sample rate
     float xfadevalue;         // crossfade phase and value
+
+    float* delaybuf;
     
-    float delaybuf[LOOPSIZE+16];
-    
 } tSOLAD;
 
 void    tSOLAD_init             (tSOLAD* const);
@@ -86,11 +86,10 @@
 
 typedef struct _tSNAC
 {
-    float inputbuf[SNAC_FRAME_SIZE];
-    float processbuf[SNAC_FRAME_SIZE * 2];
-    float spectrumbuf[SNAC_FRAME_SIZE / 2];
-    float biasbuf[SNAC_FRAME_SIZE];
-    
+	float* inputbuf;
+	float* processbuf;
+	float* spectrumbuf;
+	float* biasbuf;
     uint16_t timeindex;
     uint16_t framesize;
     uint16_t overlap;
@@ -102,6 +101,9 @@
     float minrms;
     
 } tSNAC;
+
+
+
 
 void    tSNAC_init          (tSNAC* const, int overlaparg);    // constructor
 void    tSNAC_free          (tSNAC* const);    // destructor
--- a/LEAF/Src/leaf-mempool.c
+++ b/LEAF/Src/leaf-mempool.c
@@ -36,13 +36,24 @@
 
 /* written with C99 style */
 
+
 #include "../Inc/leaf-mempool.h"
+#include "leaf.h"
+#define NUM_BLOCKS 50
 
+#ifdef STM32
 
-#define NUM_BLOCKS 50
+char memory[MPOOL_POOL_SIZE] __ATTR_RAM_D2;
 
+#else
 char memory[MPOOL_POOL_SIZE];
-mpool_pool_t blocks[NUM_BLOCKS]; // 
+#endif
+
+
+mpool_pool_t blocks[NUM_BLOCKS];
+
+
+ //
 mpool_t leaf_pool;
 
 /**
--- a/LEAF/Src/leaf-pitch.c
+++ b/LEAF/Src/leaf-pitch.c
@@ -31,7 +31,7 @@
     ps->hopSize = DEFHOPSIZE;
     ps->windowSize = DEFWINDOWSIZE;
     ps->fba = FBA;
-    
+
     tEnv_init(&ps->env, ps->windowSize, ps->hopSize, ps->frameSize);
     
     tSNAC_init(&ps->snac, DEFOVERLAP);
--- a/LEAF/Src/leaf-utilities.c
+++ b/LEAF/Src/leaf-utilities.c
@@ -1411,7 +1411,7 @@
 void     tSOLAD_init(tSOLAD* const w)
 {
     w->pitchfactor = 1.;
-    
+    w->delaybuf = (float*) leaf_alloc(sizeof(float) * (LOOPSIZE+16));
     solad_init(w);
 }
 
@@ -1739,6 +1739,11 @@
     s->fidelity = 0.;
     s->minrms = DEFMINRMS;
     s->framesize = SNAC_FRAME_SIZE;
+
+    s->inputbuf = (float*) leaf_alloc(sizeof(float) * SNAC_FRAME_SIZE);
+    s->processbuf = (float*) leaf_alloc(sizeof(float) * (SNAC_FRAME_SIZE * 2));
+    s->spectrumbuf = (float*) leaf_alloc(sizeof(float) * (SNAC_FRAME_SIZE / 2));
+    s->biasbuf = (float*) leaf_alloc(sizeof(float) * SNAC_FRAME_SIZE);
     
     snac_biasbuf(s);
     tSNAC_setOverlap(s, overlaparg);
--- a/LEAF/leaf.h
+++ b/LEAF/leaf.h
@@ -60,7 +60,12 @@
 #include "./Inc/leaf-tables.h"
 #include "./Inc/leaf-WDF.h"
 
+#include "main.h"  // not sure this is a good idea. not all applications will have a main.h.  But doing this for now. It's so that there is a place to put the STM32 define -JS
+
+
 #endif
+
+
 
 #ifdef __cplusplus
 extern "C" {
binary files a/LEAF_JUCEPlugin/.DS_Store b/LEAF_JUCEPlugin/.DS_Store differ