History

put pitch shifter memory in mempool

spiricom committed 7 years ago

Commit 77f442e1 parent ce517568 files · +35 −15Browse files

Unified · Split

8 files
  1. LEAF/Inc/leaf-globals.h +0 −3
  2. LEAF/Inc/leaf-mempool.h +1 −1
  3. LEAF/Inc/leaf-pitch.h +10 −8
  4. LEAF/Src/leaf-mempool.c +13 −2
  5. LEAF/Src/leaf-pitch.c +1 −1
  6. LEAF/Src/leaf-utilities.c +6 −1
  7. LEAF/leaf.h +5 −0
  8. LEAF_JUCEPlugin/.DS_Store +0 −0
LEAF/Inc/leaf-globals.h+0−3
@@ -52,9 +52,6 @@ extern LEAF leaf; // The global instance of LEAF. · 51 unmodified lines
5252
5353 #define DELAY_LENGTH 16000 // The maximum delay length of all Delay/DelayL/DelayA components.
5454 // Feel free to change to suit memory constraints or desired delay max length / functionality.
55−
56−
57−#define TALKBOX_BUFFER_LENGTH 1600 // Every talkbox instance introduces 5 buffers of this size
5855
5956 union unholy_t { /* a union between a float and an integer */
6057 float f;
LEAF/Inc/leaf-mempool.h+1−1
@@ -51,7 +51,7 @@ extern "C" { · 50 unmodified lines
5151 //==============================================================================
5252
5353
54−#define MPOOL_POOL_SIZE 50000
54+#define MPOOL_POOL_SIZE 50 000
5555
5656 #define MPOOL_ALIGN_SIZE (8)
5757
LEAF/Inc/leaf-pitch.h+10−8
@@ -22,7 +22,7 @@ extern "C" { · 21 unmodified lines
2222
2323 #include "leaf-filter.h"
2424 #include "leaf-utilities.h"
25−
25+#include "leaf.h"
2626 //==============================================================================
2727
2828 #define DEFPITCHRATIO 2.0f
@@ -52,8 +52,8 @@ typedef struct _tSOLAD · 23 unmodified lines
5252 float jump; // read pointer jump length and direction
5353 float xfadelength; // crossfade length expressed at input sample rate
5454 float xfadevalue; // crossfade phase and value
55−
56− float delaybuf[LOOPSIZE+16];
55+
56+ float* delaybuf;
5757
5858 } tSOLAD;
5959
@@ -86,11 +86,10 @@ void tSOLAD_resetState (tSOLAD *w); · 26 unmodified lines
8686
8787 typedef struct _tSNAC
8888 {
89− float inputbuf[SNAC_FRAME_SIZE];
90− float processbuf[SNAC_FRAME_SIZE * 2];
91− float spectrumbuf[SNAC_FRAME_SIZE / 2];
92− float biasbuf[SNAC_FRAME_SIZE];
93−
89+ float* inputbuf;
90+ float* processbuf;
91+ float* spectrumbuf;
92+ float* biasbuf;
9493 uint16_t timeindex;
9594 uint16_t framesize;
9695 uint16_t overlap;
@@ -103,6 +102,9 @@ typedef struct _tSNAC · 6 unmodified lines
103102
104103 } tSNAC;
105104
105+
106+
107+
106108 void tSNAC_init (tSNAC* const, int overlaparg); // constructor
107109 void tSNAC_free (tSNAC* const); // destructor
108110
LEAF/Src/leaf-mempool.c+13−2
@@ -36,13 +36,24 @@ · 35 unmodified lines
3636
3737 /* written with C99 style */
3838
39+
3940 #include "../Inc/leaf-mempool.h"
41+#include "leaf.h"
42+#define NUM_BLOCKS 50
4043
44+#ifdef STM32
4145
42−#define NUM_BLOCKS 50
46+char memory[MPOOL_POOL_SIZE] __ATTR_RAM_D2;
4347
48+#else
4449 char memory[MPOOL_POOL_SIZE];
45−mpool_pool_t blocks[NUM_BLOCKS]; //
50+#endif
51+
52+
53+mpool_pool_t blocks[NUM_BLOCKS];
54+
55+
56+ //
4657 mpool_t leaf_pool;
4758
4859 /**
LEAF/Src/leaf-pitch.c+1−1
@@ -31,7 +31,7 @@ void tPitchShifter_init(tPitchShifter* const ps, float* in, float* out, int bufS · 30 unmodified lines
3131 ps->hopSize = DEFHOPSIZE;
3232 ps->windowSize = DEFWINDOWSIZE;
3333 ps->fba = FBA;
34−
34+
3535 tEnv_init(&ps->env, ps->windowSize, ps->hopSize, ps->frameSize);
3636
3737 tSNAC_init(&ps->snac, DEFOVERLAP);
LEAF/Src/leaf-utilities.c+6−1
@@ -1411,7 +1411,7 @@ static void pitchup(tSOLAD *w, float *out); · 1410 unmodified lines
14111411 void tSOLAD_init(tSOLAD* const w)
14121412 {
14131413 w->pitchfactor = 1.;
1414−
1414+ w->delaybuf = (float*) leaf_alloc(sizeof(float) * (LOOPSIZE+16));
14151415 solad_init(w);
14161416 }
14171417
@@ -1739,6 +1739,11 @@ void tSNAC_init(tSNAC* const s, int overlaparg) · 321 unmodified lines
17391739 s->fidelity = 0.;
17401740 s->minrms = DEFMINRMS;
17411741 s->framesize = SNAC_FRAME_SIZE;
1742+
1743+ s->inputbuf = (float*) leaf_alloc(sizeof(float) * SNAC_FRAME_SIZE);
1744+ s->processbuf = (float*) leaf_alloc(sizeof(float) * (SNAC_FRAME_SIZE * 2));
1745+ s->spectrumbuf = (float*) leaf_alloc(sizeof(float) * (SNAC_FRAME_SIZE / 2));
1746+ s->biasbuf = (float*) leaf_alloc(sizeof(float) * SNAC_FRAME_SIZE);
17421747
17431748 snac_biasbuf(s);
17441749 tSNAC_setOverlap(s, overlaparg);
LEAF/leaf.h+5−0
@@ -60,8 +60,13 @@ · 59 unmodified lines
6060 #include "./Inc/leaf-tables.h"
6161 #include "./Inc/leaf-WDF.h"
6262
63+#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
64+
65+
6366 #endif
6467
68+
69+
6570 #ifdef __cplusplus
6671 extern "C" {
6772 #endif
LEAF_JUCEPlugin/.DS_Store+0−0

Binary file not shown.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t