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
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
59union unholy_t { /* a union between a float and an integer */56union unholy_t { /* a union between a float and an integer */
60 float f;57 float f;
LEAF/Inc/leaf-mempool.h+1−1
@@ -51,7 +51,7 @@ extern "C" { · 50 unmodified lines
51//==============================================================================51//==============================================================================
52 52
53 53
54#define MPOOL_POOL_SIZE 5000054#define MPOOL_POOL_SIZE 50 000
55 55
56#define MPOOL_ALIGN_SIZE (8)56#define MPOOL_ALIGN_SIZE (8)
57 57
LEAF/Inc/leaf-pitch.h+10−8
@@ -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.0f28#define DEFPITCHRATIO 2.0f
@@ -52,8 +52,8 @@ typedef struct _tSOLAD · 23 unmodified lines
52 float jump; // read pointer jump length and direction52 float jump; // read pointer jump length and direction
53 float xfadelength; // crossfade length expressed at input sample rate53 float xfadelength; // crossfade length expressed at input sample rate
54 float xfadevalue; // crossfade phase and value54 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
87typedef struct _tSNAC87typedef 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
106void tSNAC_init (tSNAC* const, int overlaparg); // constructor108void tSNAC_init (tSNAC* const, int overlaparg); // constructor
107void tSNAC_free (tSNAC* const); // destructor109void tSNAC_free (tSNAC* const); // destructor
108 110
LEAF/Src/leaf-mempool.c+13−2
@@ -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 5046char memory[MPOOL_POOL_SIZE] __ATTR_RAM_D2;
43 47
48#else
44char memory[MPOOL_POOL_SIZE];49char memory[MPOOL_POOL_SIZE];
45mpool_pool_t blocks[NUM_BLOCKS]; // 50#endif
51
52
53mpool_pool_t blocks[NUM_BLOCKS];
54
55
56 //
46mpool_t leaf_pool;57mpool_t leaf_pool;
47 58
48/**59/**
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
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);
LEAF/Src/leaf-utilities.c+6−1
@@ -1411,7 +1411,7 @@ static void pitchup(tSOLAD *w, float *out); · 1410 unmodified lines
1411void tSOLAD_init(tSOLAD* const w)1411void 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);
LEAF/leaf.h+5−0
@@ -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#endif66#endif
64 67
68
69
65#ifdef __cplusplus70#ifdef __cplusplus
66extern "C" {71extern "C" {
67#endif72#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