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