Unified · Split
| @@ -52,9 +52,6 @@ extern LEAF leaf; // The global instance of LEAF. · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | #define DELAY_LENGTH 16000 // The maximum delay length of all Delay/DelayL/DelayA components. |
| 54 | 54 | // 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 | |
| 58 | 55 | |
| 59 | 56 | union unholy_t { /* a union between a float and an integer */ |
| 60 | 57 | float f; |
| @@ -51,7 +51,7 @@ extern "C" { · 50 unmodified lines | ||
| 51 | 51 | //============================================================================== |
| 52 | 52 | |
| 53 | 53 | |
| 54 | −#define MPOOL_POOL_SIZE 50000 | |
| 54 | +#define MPOOL_POOL_SIZE 50 000 | |
| 55 | 55 | |
| 56 | 56 | #define MPOOL_ALIGN_SIZE (8) |
| 57 | 57 | |
| @@ -22,7 +22,7 @@ extern "C" { · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | #include "leaf-filter.h" |
| 24 | 24 | #include "leaf-utilities.h" |
| 25 | − | |
| 25 | +#include "leaf.h" | |
| 26 | 26 | //============================================================================== |
| 27 | 27 | |
| 28 | 28 | #define DEFPITCHRATIO 2.0f |
| @@ -52,8 +52,8 @@ typedef struct _tSOLAD · 23 unmodified lines | ||
| 52 | 52 | float jump; // read pointer jump length and direction |
| 53 | 53 | float xfadelength; // crossfade length expressed at input sample rate |
| 54 | 54 | float xfadevalue; // crossfade phase and value |
| 55 | − | |
| 56 | − float delaybuf[LOOPSIZE+16]; | |
| 55 | + | |
| 56 | + float* delaybuf; | |
| 57 | 57 | |
| 58 | 58 | } tSOLAD; |
| 59 | 59 | |
| @@ -86,11 +86,10 @@ void tSOLAD_resetState (tSOLAD *w); · 26 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | typedef struct _tSNAC |
| 88 | 88 | { |
| 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; | |
| 94 | 93 | uint16_t timeindex; |
| 95 | 94 | uint16_t framesize; |
| 96 | 95 | uint16_t overlap; |
| @@ -103,6 +102,9 @@ typedef struct _tSNAC · 6 unmodified lines | ||
| 103 | 102 | |
| 104 | 103 | } tSNAC; |
| 105 | 104 | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 106 | 108 | void tSNAC_init (tSNAC* const, int overlaparg); // constructor |
| 107 | 109 | void tSNAC_free (tSNAC* const); // destructor |
| 108 | 110 | |
| @@ -36,13 +36,24 @@ · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | /* written with C99 style */ |
| 38 | 38 | |
| 39 | + | |
| 39 | 40 | #include "../Inc/leaf-mempool.h" |
| 41 | +#include "leaf.h" | |
| 42 | +#define NUM_BLOCKS 50 | |
| 40 | 43 | |
| 44 | +#ifdef STM32 | |
| 41 | 45 | |
| 42 | −#define NUM_BLOCKS 50 | |
| 46 | +char memory[MPOOL_POOL_SIZE] __ATTR_RAM_D2; | |
| 43 | 47 | |
| 48 | +#else | |
| 44 | 49 | 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 | + // | |
| 46 | 57 | mpool_t leaf_pool; |
| 47 | 58 | |
| 48 | 59 | /** |
| @@ -31,7 +31,7 @@ void tPitchShifter_init(tPitchShifter* const ps, float* in, float* out, int bufS · 30 unmodified lines | ||
| 31 | 31 | ps->hopSize = DEFHOPSIZE; |
| 32 | 32 | ps->windowSize = DEFWINDOWSIZE; |
| 33 | 33 | ps->fba = FBA; |
| 34 | − | |
| 34 | + | |
| 35 | 35 | tEnv_init(&ps->env, ps->windowSize, ps->hopSize, ps->frameSize); |
| 36 | 36 | |
| 37 | 37 | tSNAC_init(&ps->snac, DEFOVERLAP); |
| @@ -1411,7 +1411,7 @@ static void pitchup(tSOLAD *w, float *out); · 1410 unmodified lines | ||
| 1411 | 1411 | void tSOLAD_init(tSOLAD* const w) |
| 1412 | 1412 | { |
| 1413 | 1413 | w->pitchfactor = 1.; |
| 1414 | − | |
| 1414 | + w->delaybuf = (float*) leaf_alloc(sizeof(float) * (LOOPSIZE+16)); | |
| 1415 | 1415 | solad_init(w); |
| 1416 | 1416 | } |
| 1417 | 1417 | |
| @@ -1739,6 +1739,11 @@ void tSNAC_init(tSNAC* const s, int overlaparg) · 321 unmodified lines | ||
| 1739 | 1739 | s->fidelity = 0.; |
| 1740 | 1740 | s->minrms = DEFMINRMS; |
| 1741 | 1741 | 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); | |
| 1742 | 1747 | |
| 1743 | 1748 | snac_biasbuf(s); |
| 1744 | 1749 | tSNAC_setOverlap(s, overlaparg); |
| @@ -60,8 +60,13 @@ · 59 unmodified lines | ||
| 60 | 60 | #include "./Inc/leaf-tables.h" |
| 61 | 61 | #include "./Inc/leaf-WDF.h" |
| 62 | 62 | |
| 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 | + | |
| 63 | 66 | #endif |
| 64 | 67 | |
| 68 | + | |
| 69 | + | |
| 65 | 70 | #ifdef __cplusplus |
| 66 | 71 | extern "C" { |
| 67 | 72 | #endif |
Binary file not shown.