History

use mempool for all large/variable size member and free function for every object

Matthew Wang committed 7 years ago

Commit 3b564d41 parent d6d64a942 files · +421 −347Browse files

Unified · Split

42 files
  1. LEAF/Inc/.DS_Store +0 −0
  2. LEAF/Inc/leaf-808.h +3 −3
  3. LEAF/Inc/leaf-WDF.h +1 −1
  4. LEAF/Inc/leaf-crusher.h +1 −1
  5. LEAF/Inc/leaf-delay.h +47 −48
  6. LEAF/Inc/leaf-filter.h +0 −3
  7. LEAF/Inc/leaf-formant.h +2 −1
  8. LEAF/Inc/leaf-global.h +37 −0
  9. LEAF/Inc/leaf-globals.h +0 −61
  10. LEAF/Inc/leaf-math.h +7 −0
  11. LEAF/Inc/leaf-mempool.h +0 −3
  12. LEAF/Inc/leaf-midi.h +3 −3
  13. LEAF/Inc/leaf-oscillator.h +10 −11
  14. LEAF/Inc/leaf-oversampler.h +2 −1
  15. LEAF/Inc/leaf-pitch.h +2 −2
  16. LEAF/Inc/leaf-reverb.h +1 −1
  17. LEAF/Inc/leaf-sample.h +1 −1
  18. LEAF/Inc/leaf-string.h +1 −1
  19. LEAF/Inc/leaf-tables.h +0 −1
  20. LEAF/Inc/leaf-utilities.h +2 −1
  21. LEAF/Inc/leaf-vocoder.h +1 −1
  22. LEAF/Inc/leaf-wavefolder.h +1 −1
  23. LEAF/Src/leaf-808.c +133 −93
  24. LEAF/Src/leaf-WDF.c +1 −1
  25. LEAF/Src/leaf-crusher.c +1 −1
  26. LEAF/Src/leaf-delay.c +0 −4
  27. LEAF/Src/leaf-filter.c +30 −29
  28. LEAF/Src/leaf-formant.c +0 −2
  29. LEAF/Src/leaf-mempool.c +1 −0
  30. LEAF/Src/leaf-midi.c +12 −14
  31. LEAF/Src/leaf-oscillator.c +17 −16
  32. LEAF/Src/leaf-oversampler.c +0 −1
  33. LEAF/Src/leaf-pitch.c +0 −7
  34. LEAF/Src/leaf-reverb.c +4 −5
  35. LEAF/Src/leaf-sample.c +0 −2
  36. LEAF/Src/leaf-string.c +0 −4
  37. LEAF/Src/leaf-tables.c +2 −2
  38. LEAF/Src/leaf-utilities.c +84 −16
  39. LEAF/Src/leaf-vocoder.c +5 −3
  40. LEAF/Src/leaf-wavefolder.c +5 −0
  41. LEAF/leaf.h +4 −2
  42. LEAF_JUCEPlugin/LEAF.jucer +1 −1
LEAF/Inc/.DS_Store+0−0

Binary file not shown.

LEAF/Inc/leaf-808.h+3−3
@@ -15,9 +15,7 @@ extern "C" { · 14 unmodified lines
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"
19#include "leaf-math.h"18#include "leaf-math.h"
20
21#include "leaf-oscillator.h"19#include "leaf-oscillator.h"
22#include "leaf-utilities.h"20#include "leaf-utilities.h"
23#include "leaf-filter.h"21#include "leaf-filter.h"
@@ -37,10 +35,11 @@ typedef struct _t808Cowbell { · 13 unmodified lines
37 tHighpass highpass;35 tHighpass highpass;
38 float oscMix;36 float oscMix;
39 float filterCutoff;37 float filterCutoff;
38 oBool useStick;
40 39
41} t808Cowbell;40} t808Cowbell;
42 41
43void t808Cowbell_init (t808Cowbell* const);42void t808Cowbell_init (t808Cowbell* const, int useStick);
44void t808Cowbell_free (t808Cowbell* const);43void t808Cowbell_free (t808Cowbell* const);
45float t808Cowbell_tick (t808Cowbell* const);44float t808Cowbell_tick (t808Cowbell* const);
46void t808Cowbell_on (t808Cowbell* const, float vel);45void t808Cowbell_on (t808Cowbell* const, float vel);
@@ -49,6 +48,7 @@ void t808Cowbell_setHighpassFreq (t808Cowbell* const, float freq); · 2 unmodified lines
49void t808Cowbell_setBandpassFreq (t808Cowbell* const, float freq);48void t808Cowbell_setBandpassFreq (t808Cowbell* const, float freq);
50void t808Cowbell_setFreq (t808Cowbell* const, float freq);49void t808Cowbell_setFreq (t808Cowbell* const, float freq);
51void t808Cowbell_setOscMix (t808Cowbell* const, float oscMix);50void t808Cowbell_setOscMix (t808Cowbell* const, float oscMix);
51void t808Cowbell_setStick (t808Cowbell* const, int useStick);
52 52
53//==============================================================================53//==============================================================================
54 54
LEAF/Inc/leaf-WDF.h+1−1
@@ -14,7 +14,7 @@ extern "C" { · 13 unmodified lines
14 14
15//==============================================================================15//==============================================================================
16 16
17#include "leaf-globals.h"17#include "leaf-global.h"
18#include "leaf-math.h"18#include "leaf-math.h"
19 19
20//==============================================================================20//==============================================================================
LEAF/Inc/leaf-crusher.h+1−1
@@ -18,7 +18,7 @@ extern "C" { · 17 unmodified lines
18 18
19//==============================================================================19//==============================================================================
20 20
21#include "leaf-globals.h"21#include "leaf-global.h"
22#include "leaf-math.h"22#include "leaf-math.h"
23 23
24//==============================================================================24//==============================================================================
LEAF/Inc/leaf-delay.h+47−48
@@ -7,18 +7,17 @@ · 6 unmodified lines
7==============================================================================*/7==============================================================================*/
8 8
9#ifndef LEAF_DELAY_H_INCLUDED9#ifndef LEAF_DELAY_H_INCLUDED
10#define LEAF_DELAY_H_INCLUDED10#define LEAF_DELAY_H_INCLUDED
11 11
12#ifdef __cplusplus12#ifdef __cplusplus
13extern "C" {13extern "C" {
14#endif14#endif
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"
19#include "leaf-math.h"18#include "leaf-math.h"
20 19
21//==============================================================================20//==============================================================================
22 21
23/* Non-interpolating delay, reimplemented from STK (Cook and Scavone). */22/* Non-interpolating delay, reimplemented from STK (Cook and Scavone). */
24typedef struct _tDelay23typedef struct _tDelay
@@ -46,7 +45,7 @@ float tDelay_tick (tDelay* const, float sample); · 21 unmodified lines
46float tDelay_getLastOut (tDelay* const);45float tDelay_getLastOut (tDelay* const);
47float tDelay_getLastIn (tDelay* const);46float tDelay_getLastIn (tDelay* const);
48 47
49//==============================================================================48//==============================================================================
50 49
51/* Linearly-interpolating delay, reimplemented from STK (Cook and Scavone). */50/* Linearly-interpolating delay, reimplemented from STK (Cook and Scavone). */
52typedef struct _tDelayL51typedef struct _tDelayL
@@ -80,7 +79,7 @@ float tDelayL_tickOut (tDelayL* const d); · 27 unmodified lines
80float tDelayL_getLastOut (tDelayL* const);79float tDelayL_getLastOut (tDelayL* const);
81float tDelayL_getLastIn (tDelayL* const);80float tDelayL_getLastIn (tDelayL* const);
82 81
83//==============================================================================82//==============================================================================
84 83
85/* Allpass-interpolating delay, reimplemented from STK (Cook and Scavone). */84/* Allpass-interpolating delay, reimplemented from STK (Cook and Scavone). */
86typedef struct _tDelayA85typedef struct _tDelayA
@@ -103,7 +102,7 @@ typedef struct _tDelayA · 16 unmodified lines
103} tDelayA;102} tDelayA;
104 103
105void tDelayA_init (tDelayA* const, float delay, uint32_t maxDelay);104void tDelayA_init (tDelayA* const, float delay, uint32_t maxDelay);
106void tDelayA_free (tDelayA* const);105void tDelayA_free (tDelayA* const);
107 106
108int tDelayA_setDelay (tDelayA* const, float delay);107int tDelayA_setDelay (tDelayA* const, float delay);
109float tDelayA_getDelay (tDelayA* const);108float tDelayA_getDelay (tDelayA* const);
@@ -114,44 +113,44 @@ float tDelayA_tick (tDelayA* const, float sample); · 4 unmodified lines
114float tDelayA_getLastOut (tDelayA* const);113float tDelayA_getLastOut (tDelayA* const);
115float tDelayA_getLastIn (tDelayA* const);114float tDelayA_getLastIn (tDelayA* const);
116 115
117//==============================================================================116//==============================================================================
118 117
119/* Linear interpolating delay with fixed read and write pointers, variable rate. */118/* Linear interpolating delay with fixed read and write pointers, variable rate. */
120typedef struct _tTapeDelay119typedef struct _tTapeDelay
121{120{
122 float gain;121 float gain;
123 float* buff;122 float* buff;
124 123
125 float lastOut, lastIn;124 float lastOut, lastIn;
126 125
127 uint32_t inPoint;126 uint32_t inPoint;
128 127
129 uint32_t maxDelay;128 uint32_t maxDelay;
130 129
131 float delay, inc, idx;130 float delay, inc, idx;
132 131
133 float apInput;132 float apInput;
134 133
135} tTapeDelay;134} tTapeDelay;
136 135
137void tTapeDelay_init (tTapeDelay* const, float delay, uint32_t maxDelay);136void tTapeDelay_init (tTapeDelay* const, float delay, uint32_t maxDelay);
138void tTapeDelay_free (tTapeDelay* const);137void tTapeDelay_free (tTapeDelay* const);
139 138
140int tTapeDelay_setDelay (tTapeDelay* const, float delay);139int tTapeDelay_setDelay (tTapeDelay* const, float delay);
141float tTapeDelay_getDelay (tTapeDelay* const);140float tTapeDelay_getDelay (tTapeDelay* const);
142void tTapeDelay_tapIn (tTapeDelay* const, float in, uint32_t tapDelay);141void tTapeDelay_tapIn (tTapeDelay* const, float in, uint32_t tapDelay);
143float tTapeDelay_tapOut (tTapeDelay* const d, float tapDelay);142float tTapeDelay_tapOut (tTapeDelay* const d, float tapDelay);
144float tTapeDelay_addTo (tTapeDelay* const, float value, uint32_t tapDelay);143float tTapeDelay_addTo (tTapeDelay* const, float value, uint32_t tapDelay);
145float tTapeDelay_tick (tTapeDelay* const, float sample);144float tTapeDelay_tick (tTapeDelay* const, float sample);
146float tTapeDelay_getLastOut (tTapeDelay* const);145float tTapeDelay_getLastOut (tTapeDelay* const);
147float tTapeDelay_getLastIn (tTapeDelay* const);146float tTapeDelay_getLastIn (tTapeDelay* const);
148 147
149//==============================================================================148//==============================================================================
150 149
151#ifdef __cplusplus150#ifdef __cplusplus
152}151}
153#endif152#endif
154 153
155#endif // LEAF_DELAY_H_INCLUDED154#endif // LEAF_DELAY_H_INCLUDED
156 155
157//==============================================================================156//==============================================================================
LEAF/Inc/leaf-filter.h+0−3
@@ -15,11 +15,8 @@ extern "C" { · 14 unmodified lines
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"
19#include "leaf-math.h"18#include "leaf-math.h"
20
21#include "leaf-delay.h"19#include "leaf-delay.h"
22
23#include "leaf-tables.h"20#include "leaf-tables.h"
24 21
25//==============================================================================22//==============================================================================
LEAF/Inc/leaf-formant.h+2−1
@@ -15,7 +15,8 @@ extern "C" { · 14 unmodified lines
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"18#include "leaf-global.h"
19#include "leaf-mempool.h"
19#include "leaf-math.h"20#include "leaf-math.h"
20 21
21//==============================================================================22//==============================================================================
LEAF/Inc/leaf-global.h+37−0
@@ -0,0 +1,37 @@
1/*
2 ==============================================================================
3
4 leaf-global.h
5 Created: 24 Oct 2019 2:24:38pm
6 Author: Matthew Wang
7
8 ==============================================================================
9*/
10
11#ifndef LEAF_GLOBAL_H_INCLUDED
12#define LEAF_GLOBAL_H_INCLUDED
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18typedef struct _LEAF
19{
20 float sampleRate;
21 float invSampleRate;
22 int blockSize;
23
24 float (*random)(void);
25} LEAF;
26
27extern LEAF leaf; // The global instance of LEAF.
28
29 //==============================================================================
30
31#ifdef __cplusplus
32}
33#endif
34
35#endif // LEAF_GLOBAL_H_INCLUDED
36
37//==============================================================================
LEAF/Inc/leaf-globals.h+0−61
@@ -1,61 +0,0 @@
1/*==============================================================================
2
3 leaf-globals.h
4 Created: 23 Jan 2017 10:34:10pm
5 Author: Michael R Mulshine
6
7==============================================================================*/
8
9#ifndef LEAF_GLOBALS_H_INCLUDED
10#define LEAF_GLOBALS_H_INCLUDED
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16//==============================================================================
17
18#include "leaf-mempool.h"
19
20//==============================================================================
21
22typedef struct _LEAF
23{
24 float sampleRate;
25 float invSampleRate;
26 int blockSize;
27
28
29 float* sinewave;
30 float* sawtooth[11];
31 float* square[11];
32 float* triangle[11];
33
34
35 float (*random)(void);
36} LEAF;
37
38//==============================================================================
39
40extern LEAF leaf; // The global instance of LEAF.
41
42//==============================================================================
43
44#define PS_FRAME_SIZE 1024 // SNAC_FRAME_SIZE in leaf-pitch.h should match (or be smaller than?) this
45#define ENV_WINDOW_SIZE 1024
46#define ENV_HOP_SIZE 256
47
48union unholy_t { /* a union between a float and an integer */
49 float f;
50 int i;
51};
52
53//==============================================================================
54
55#ifdef __cplusplus
56}
57#endif
58
59#endif // LEAF_GLOBALS_H_INCLUDED
60
61//==============================================================================
LEAF/Inc/leaf-math.h+7−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
13extern "C" {13extern "C" {
14#endif14#endif
15 15
16#include "leaf-global.h"
16#include "math.h"17#include "math.h"
17#include "stdint.h"18#include "stdint.h"
18#include "stdlib.h"19#include "stdlib.h"
@@ -26,6 +27,12 @@ typedef enum oBool · 7 unmodified lines
26 OTRUE = 1,27 OTRUE = 1,
27 OFALSE = 028 OFALSE = 0
28}oBool;29}oBool;
30
31// Allows for bitwise operations on floats
32union unholy_t { /* a union between a float and an integer */
33 float f;
34 int i;
35};
29 36
30#define SQRT8 2.82842712475f37#define SQRT8 2.82842712475f
31#define WSCALE 1.30612244898f38#define WSCALE 1.30612244898f
LEAF/Inc/leaf-mempool.h+0−3
@@ -50,9 +50,6 @@ extern "C" { · 49 unmodified lines
50 50
51//==============================================================================51//==============================================================================
52 52
53
54#define MPOOL_POOL_SIZE 50 000
55
56#define MPOOL_ALIGN_SIZE (8)53#define MPOOL_ALIGN_SIZE (8)
57 54
58//#define size_t unsigned long55//#define size_t unsigned long
LEAF/Inc/leaf-midi.h+3−3
@@ -15,9 +15,9 @@ extern "C" { · 14 unmodified lines
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"18#include "leaf-global.h"
19#include "leaf-mempool.h"
19#include "leaf-math.h"20#include "leaf-math.h"
20
21#include "leaf-utilities.h"21#include "leaf-utilities.h"
22 22
23//==============================================================================23//==============================================================================
@@ -28,7 +28,7 @@ typedef struct _tPoly · 4 unmodified lines
28 tStack stack;28 tStack stack;
29 tStack orderStack;29 tStack orderStack;
30 30
31 tRamp* ramp;31 tRamp* ramps;
32 float* rampVals;32 float* rampVals;
33 oBool* firstReceived;33 oBool* firstReceived;
34 float glideTime;34 float glideTime;
LEAF/Inc/leaf-oscillator.h+10−11
@@ -7,15 +7,14 @@ · 6 unmodified lines
7==============================================================================*/7==============================================================================*/
8 8
9#ifndef LEAF_OSCILLATOR_H_INCLUDED9#ifndef LEAF_OSCILLATOR_H_INCLUDED
10#define LEAF_OSCILLATOR_H_INCLUDED10#define LEAF_OSCILLATOR_H_INCLUDED
11 11
12#ifdef __cplusplus12#ifdef __cplusplus
13extern "C" {13extern "C" {
14#endif14#endif
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"
19#include "leaf-math.h"18#include "leaf-math.h"
20 19
21#include "leaf-filter.h"20#include "leaf-filter.h"
@@ -171,12 +170,12 @@ void tNoise_free (tNoise* const); · 149 unmodified lines
171 170
172float tNoise_tick (tNoise* const);171float tNoise_tick (tNoise* const);
173 172
174//==============================================================================173//==============================================================================
175 174
176#ifdef __cplusplus175#ifdef __cplusplus
177}176}
178#endif177#endif
179 178
180#endif // LEAF_OSCILLATOR_H_INCLUDED179#endif // LEAF_OSCILLATOR_H_INCLUDED
181 180
182//==============================================================================181//==============================================================================
LEAF/Inc/leaf-oversampler.h+2−1
@@ -16,7 +16,8 @@ extern "C" { · 15 unmodified lines
16 16
17//==============================================================================17//==============================================================================
18 18
19#include "leaf-globals.h"19#include "leaf-global.h"
20#include "leaf-mempool.h"
20#include "leaf-math.h"21#include "leaf-math.h"
21#include "leaf-filter.h"22#include "leaf-filter.h"
22 23
LEAF/Inc/leaf-pitch.h+2−2
@@ -17,12 +17,12 @@ extern "C" { · 16 unmodified lines
17 17
18//==============================================================================18//==============================================================================
19 19
20#include "leaf-globals.h"20#include "leaf-global.h"
21#include "leaf-math.h"21#include "leaf-math.h"
22 22
23#include "leaf-filter.h"23#include "leaf-filter.h"
24#include "leaf-utilities.h"24#include "leaf-utilities.h"
25#include "../leaf.h"25
26//==============================================================================26//==============================================================================
27 27
28#define DEFPITCHRATIO 2.0f28#define DEFPITCHRATIO 2.0f
LEAF/Inc/leaf-reverb.h+1−1
@@ -15,7 +15,7 @@ extern "C" { · 14 unmodified lines
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"18#include "leaf-global.h"
19#include "leaf-math.h"19#include "leaf-math.h"
20 20
21#include "leaf-delay.h"21#include "leaf-delay.h"
LEAF/Inc/leaf-sample.h+1−1
@@ -16,7 +16,7 @@ extern "C" { · 15 unmodified lines
16 16
17//==============================================================================17//==============================================================================
18 18
19#include "leaf-globals.h"19#include "leaf-global.h"
20#include "leaf-math.h"20#include "leaf-math.h"
21 21
22#include "leaf-utilities.h"22#include "leaf-utilities.h"
LEAF/Inc/leaf-string.h+1−1
@@ -17,7 +17,7 @@ extern "C" { · 16 unmodified lines
17 17
18//==============================================================================18//==============================================================================
19 19
20#include "leaf-globals.h"20#include "leaf-global.h"
21#include "leaf-math.h"21#include "leaf-math.h"
22 22
23#include "leaf-delay.h"23#include "leaf-delay.h"
LEAF/Inc/leaf-tables.h+0−1
@@ -15,7 +15,6 @@ extern "C" { · 14 unmodified lines
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"
19#include "leaf-math.h"18#include "leaf-math.h"
20 19
21//==============================================================================20//==============================================================================
LEAF/Inc/leaf-utilities.h+2−1
@@ -17,7 +17,6 @@ extern "C" { · 16 unmodified lines
17 17
18// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~18// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
19 19
20#include "leaf-globals.h"
21#include "leaf-math.h"20#include "leaf-math.h"
22#include "leaf-filter.h"21#include "leaf-filter.h"
23#include "leaf-delay.h"22#include "leaf-delay.h"
@@ -369,6 +368,8 @@ int tAtkDtk_detect (tAtkDtk* const, float *in); · 345 unmodified lines
369// ENV~ from PD, modified for LEAF368// ENV~ from PD, modified for LEAF
370#define MAXOVERLAP 32369#define MAXOVERLAP 32
371#define INITVSTAKEN 64370#define INITVSTAKEN 64
371#define ENV_WINDOW_SIZE 1024
372#define ENV_HOP_SIZE 256
372 373
373typedef struct _tEnv374typedef struct _tEnv
374{375{
LEAF/Inc/leaf-vocoder.h+1−1
@@ -15,7 +15,7 @@ extern "C" { · 14 unmodified lines
15 15
16//==============================================================================16//==============================================================================
17 17
18#include "leaf-globals.h"18#include "leaf-global.h"
19#include "leaf-math.h"19#include "leaf-math.h"
20 20
21//==============================================================================21//==============================================================================
LEAF/Inc/leaf-wavefolder.h+1−1
@@ -16,7 +16,7 @@ extern "C" { · 15 unmodified lines
16 16
17//==============================================================================17//==============================================================================
18 18
19#include "leaf-globals.h"19#include "leaf-global.h"
20#include "leaf-math.h"20#include "leaf-math.h"
21 21
22//==============================================================================22//==============================================================================
LEAF/Src/leaf-808.c+133−93
@@ -16,16 +16,54 @@ · 15 unmodified lines
16 16
17#endif17#endif
18 18
19#define USE_STICK 019// ----------------- COWBELL ----------------------------//
20
21void t808Cowbell_init(t808Cowbell* const cowbell, int useStick) {
22
23 tSquare_init(&cowbell->p[0]);
24 tSquare_setFreq(&cowbell->p[0], 540.0f);
25
26 tSquare_init(&cowbell->p[1]);
27 tSquare_setFreq(&cowbell->p[1], 1.48148f * 540.0f);
28
29 cowbell->oscMix = 0.5f;
30
31 tSVF_init(&cowbell->bandpassOsc, SVFTypeBandpass, 2500, 1.0f);
32
33 tSVF_init(&cowbell->bandpassStick, SVFTypeBandpass, 1800, 1.0f);
34
35 tEnvelope_init(&cowbell->envGain, 5.0f, 100.0f, OFALSE);
36
37 tEnvelope_init(&cowbell->envFilter, 5.0, 100.0f, OFALSE);
38
39 tHighpass_init(&cowbell->highpass, 1000.0f);
40
41 tNoise_init(&cowbell->stick, WhiteNoise);
42
43 tEnvelope_init(&cowbell->envStick, 5.0f, 5.0f, 0);
44
45 cowbell->useStick = useStick;
46}
47
48void t808Cowebell_free(t808Cowbell* const cowbell)
49{
50 tSquare_free(&cowbell->p[0]);
51 tSquare_free(&cowbell->p[1]);
52 tSVF_free(&cowbell->bandpassOsc);
53 tSVF_free(&cowbell->bandpassStick);
54 tEnvelope_free(&cowbell->envGain);
55 tEnvelope_free(&cowbell->envFilter);
56 tHighpass_free(&cowbell->highpass);
57 tNoise_free(&cowbell->stick);
58 tEnvelope_free(&cowbell->envStick);
59}
60
20void t808Cowbell_on(t808Cowbell* const cowbell, float vel)61void t808Cowbell_on(t808Cowbell* const cowbell, float vel)
21{62{
22
23 tEnvelope_on(&cowbell->envGain, vel);63 tEnvelope_on(&cowbell->envGain, vel);
24 64
25#if USE_STICK65 if (cowbell->useStick)
26 tEnvelope_on(&cowbell->envStick,vel);66 tEnvelope_on(&cowbell->envStick,vel);
27#endif
28
29}67}
30 68
31float t808Cowbell_tick(t808Cowbell* const cowbell) {69float t808Cowbell_tick(t808Cowbell* const cowbell) {
@@ -41,9 +79,9 @@ float t808Cowbell_tick(t808Cowbell* const cowbell) { · 9 unmodified lines
41 79
42 sample *= (0.9f * tEnvelope_tick(&cowbell->envGain));80 sample *= (0.9f * tEnvelope_tick(&cowbell->envGain));
43 81
44#if USE_STICK82 if (cowbell->useStick)
45 sample += (0.1f * tEnvelope_tick(&cowbell->envStick) * tSVF_tick(&cowbell->bandpassStick, tNoise_tick(&cowbell->stick)));83 sample += (0.1f * tEnvelope_tick(&cowbell->envStick) * tSVF_tick(&cowbell->bandpassStick, tNoise_tick(&cowbell->stick)));
46#endif84
47 85
48 sample = tHighpass_tick(&cowbell->highpass, sample);86 sample = tHighpass_tick(&cowbell->highpass, sample);
49 87
@@ -77,30 +115,61 @@ void t808Cowbell_setOscMix(t808Cowbell* const cowbell, float oscMix) · 27 unmodified lines
77 cowbell->oscMix = oscMix;115 cowbell->oscMix = oscMix;
78}116}
79 117
80void t808Cowbell_init(t808Cowbell* const cowbell) {118void t808Cowbell_setStick(t808Cowbell* const cowbell, int useStick)
119{
120 cowbell->useStick = useStick;
121}
122
123// ----------------- HIHAT ----------------------------//
124
125void t808Hihat_init(t808Hihat* const hihat)
126{
127 for (int i = 0; i < 6; i++)
128 {
129 tSquare_init(&hihat->p[i]);
130 }
81 131
82 tSquare_init(&cowbell->p[0]);132 tNoise_init(&hihat->stick, PinkNoise);
83 tSquare_setFreq(&cowbell->p[0], 540.0f);133 tNoise_init(&hihat->n, WhiteNoise);
84 134
85 tSquare_init(&cowbell->p[1]);135 // need to fix SVF to be generic
86 tSquare_setFreq(&cowbell->p[1], 1.48148f * 540.0f);136 tSVF_init(&hihat->bandpassStick, SVFTypeBandpass,2500.0f,1.2f);
137 tSVF_init(&hihat->bandpassOsc, SVFTypeBandpass,3500.0f,0.3f);
87 138
88 cowbell->oscMix = 0.5f;139 tEnvelope_init(&hihat->envGain, 0.0f, 50.0f, OFALSE);
140 tEnvelope_init(&hihat->envStick, 0.0f, 7.0f, OFALSE);
89 141
90 tSVF_init(&cowbell->bandpassOsc, SVFTypeBandpass, 2500, 1.0f);
91 142
92 tSVF_init(&cowbell->bandpassStick, SVFTypeBandpass, 1800, 1.0f);143 tHighpass_init(&hihat->highpass, 7000.0f);
93 144
94 tEnvelope_init(&cowbell->envGain, 5.0f, 100.0f, OFALSE);145 hihat->freq = 40.0f;
146 hihat->stretch = 0.0f;
95 147
96 tEnvelope_init(&cowbell->envFilter, 5.0, 100.0f, OFALSE);148 tSquare_setFreq(&hihat->p[0], 2.0f * hihat->freq);
149 tSquare_setFreq(&hihat->p[1], 3.00f * hihat->freq);
150 tSquare_setFreq(&hihat->p[2], 4.16f * hihat->freq);
151 tSquare_setFreq(&hihat->p[3], 5.43f * hihat->freq);
152 tSquare_setFreq(&hihat->p[4], 6.79f * hihat->freq);
153 tSquare_setFreq(&hihat->p[5], 8.21f * hihat->freq);
154}
155
156void t808Hihat_free(t808Hihat* const hihat)
157{
158 for (int i = 0; i < 6; i++)
159 {
160 tSquare_free(&hihat->p[i]);
161 }
97 162
98 tHighpass_init(&cowbell->highpass, 1000.0f);163 tNoise_free(&hihat->stick);
164 tNoise_free(&hihat->n);
99 165
100#if USE_STICK166 // need to fix SVF to be generic
101 tNoise_init(&cowbell->stick, NoiseTypeWhite);167 tSVF_free(&hihat->bandpassStick);
102 tEnvelope_init(&cowbell->envStick, 5.0f, 5.0f, 0);168 tSVF_free(&hihat->bandpassOsc);
103#endif169 tEnvelope_free(&hihat->envGain);
170 tEnvelope_free(&hihat->envStick);
171
172 tHighpass_free(&hihat->highpass);
104}173}
105 174
106void t808Hihat_on(t808Hihat* const hihat, float vel) {175void t808Hihat_on(t808Hihat* const hihat, float vel) {
@@ -198,35 +267,50 @@ void t808Hihat_setOscFreq(t808Hihat* const hihat, float freq) · 91 unmodified lines
198 hihat->freq = freq;267 hihat->freq = freq;
199}268}
200 269
201void t808Hihat_init(t808Hihat* const hihat)270// ----------------- SNARE ----------------------------//
271
272void t808Snare_init(t808Snare* const snare)
202{273{
203 for (int i = 0; i < 6; i++)274 float ratio[2] = {1.0, 1.5};
275 for (int i = 0; i < 2; i++)
204 {276 {
205 tSquare_init(&hihat->p[i]);277 tTriangle_init(&snare->tone[i]);
278
279 tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f);
280 tSVF_init(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f);
281 tEnvelope_init(&snare->toneEnvOsc[i], 0.0f, 50.0f, OFALSE);
282 tEnvelope_init(&snare->toneEnvGain[i], 1.0f, 150.0f, OFALSE);
283 tEnvelope_init(&snare->toneEnvFilter[i], 1.0f, 2000.0f, OFALSE);
284
285 snare->toneGain[i] = 0.5f;
206 }286 }
207 287
208 tNoise_init(&hihat->stick, PinkNoise);288 snare->tone1Freq = ratio[0] * 100.0f;
209 tNoise_init(&hihat->n, WhiteNoise);289 snare->tone2Freq = ratio[1] * 100.0f;
210 290 snare->noiseFilterFreq = 3000.0f;
211 // need to fix SVF to be generic291 tNoise_init(&snare->noiseOsc, WhiteNoise);
212 tSVF_init(&hihat->bandpassStick, SVFTypeBandpass,2500.0f,1.2f);292 tSVF_init(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f);
213 tSVF_init(&hihat->bandpassOsc, SVFTypeBandpass,3500.0f,0.3f);293 tEnvelope_init(&snare->noiseEnvGain, 0.0f, 100.0f, OFALSE);
214 294 tEnvelope_init(&snare->noiseEnvFilter, 0.0f, 1000.0f, OFALSE);
215 tEnvelope_init(&hihat->envGain, 0.0f, 50.0f, OFALSE);295 snare->noiseGain = 1.0f;
216 tEnvelope_init(&hihat->envStick, 0.0f, 7.0f, OFALSE);296}
217
218 297
219 tHighpass_init(&hihat->highpass, 7000.0f);298void t808Snare_free (t808Snare* const snare)
299{
300 for (int i = 0; i < 2; i++)
301 {
302 tTriangle_free(&snare->tone[i]);
303 tSVF_free(&snare->toneLowpass[i]);
304 tEnvelope_free(&snare->toneEnvOsc[i]);
305 tEnvelope_free(&snare->toneEnvGain[i]);
306 tEnvelope_free(&snare->toneEnvFilter[i]);
307 }
220 308
221 hihat->freq = 40.0f;309
222 hihat->stretch = 0.0f;310 tNoise_free(&snare->noiseOsc);
223 311 tSVF_free(&snare->noiseLowpass);
224 tSquare_setFreq(&hihat->p[0], 2.0f * hihat->freq);312 tEnvelope_free(&snare->noiseEnvGain);
225 tSquare_setFreq(&hihat->p[1], 3.00f * hihat->freq);313 tEnvelope_free(&snare->noiseEnvFilter);
226 tSquare_setFreq(&hihat->p[2], 4.16f * hihat->freq);
227 tSquare_setFreq(&hihat->p[3], 5.43f * hihat->freq);
228 tSquare_setFreq(&hihat->p[4], 6.79f * hihat->freq);
229 tSquare_setFreq(&hihat->p[5], 8.21f * hihat->freq);
230}314}
231 315
232void t808Snare_on(t808Snare* const snare, float vel)316void t808Snare_on(t808Snare* const snare, float vel)
@@ -285,7 +369,6 @@ void t808Snare_setNoiseFilterQ(t808Snare* const snare, float noiseFilterQ) · 52 unmodified lines
285 tSVF_setQ(&snare->noiseLowpass, noiseFilterQ);369 tSVF_setQ(&snare->noiseLowpass, noiseFilterQ);
286}370}
287 371
288
289static float tone[2];372static float tone[2];
290 373
291float t808Snare_tick(t808Snare* const snare)374float t808Snare_tick(t808Snare* const snare)
@@ -308,50 +391,7 @@ float t808Snare_tick(t808Snare* const snare) · 16 unmodified lines
308 return sample;391 return sample;
309}392}
310 393
311void t808Snare_init(t808Snare* const snare)394// ----------------- KICK ----------------------------//
312{
313 float ratio[2] = {1.0, 1.5};
314 for (int i = 0; i < 2; i++)
315 {
316 tTriangle_init(&snare->tone[i]);
317
318 tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f);
319 tSVF_init(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f);
320 tEnvelope_init(&snare->toneEnvOsc[i], 0.0f, 50.0f, OFALSE);
321 tEnvelope_init(&snare->toneEnvGain[i], 1.0f, 150.0f, OFALSE);
322 tEnvelope_init(&snare->toneEnvFilter[i], 1.0f, 2000.0f, OFALSE);
323
324 snare->toneGain[i] = 0.5f;
325 }
326
327 snare->tone1Freq = ratio[0] * 100.0f;
328 snare->tone2Freq = ratio[1] * 100.0f;
329 snare->noiseFilterFreq = 3000.0f;
330 tNoise_init(&snare->noiseOsc, WhiteNoise);
331 tSVF_init(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f);
332 tEnvelope_init(&snare->noiseEnvGain, 0.0f, 100.0f, OFALSE);
333 tEnvelope_init(&snare->noiseEnvFilter, 0.0f, 1000.0f, OFALSE);
334 snare->noiseGain = 1.0f;
335}
336
337void t808Snare_free (t808Snare* const snare)
338{
339 for (int i = 0; i < 2; i++)
340 {
341 tTriangle_free(&snare->tone[i]);
342 tSVF_free(&snare->toneLowpass[i]);
343 tEnvelope_free(&snare->toneEnvOsc[i]);
344 tEnvelope_free(&snare->toneEnvGain[i]);
345 tEnvelope_free(&snare->toneEnvFilter[i]);
346 }
347
348
349 tNoise_free(&snare->noiseOsc);
350 tSVF_free(&snare->noiseLowpass);
351 tEnvelope_free(&snare->noiseEnvGain);
352 tEnvelope_free(&snare->noiseEnvFilter);
353}
354
355 395
356void t808Kick_init (t808Kick* const kick)396void t808Kick_init (t808Kick* const kick)
357{397{
@@ -369,7 +409,6 @@ void t808Kick_init (t808Kick* const kick) · 11 unmodified lines
369 kick->noiseGain = 0.3f;409 kick->noiseGain = 0.3f;
370}410}
371 411
372
373void t808Kick_free (t808Kick* const kick)412void t808Kick_free (t808Kick* const kick)
374{413{
375 tCycle_free(&kick->tone);414 tCycle_free(&kick->tone);
@@ -410,6 +449,7 @@ void t808Kick_setToneDecay (t808Kick* const kick, float decay) · 34 unmodified lines
410 tEnvelope_setDecay(&kick->toneEnvGain,decay);449 tEnvelope_setDecay(&kick->toneEnvGain,decay);
411 tEnvelope_setDecay(&kick->toneEnvGain,decay * 3.0f);450 tEnvelope_setDecay(&kick->toneEnvGain,decay * 3.0f);
412}451}
452
413void t808Kick_setNoiseDecay (t808Kick* const kick, float decay);453void t808Kick_setNoiseDecay (t808Kick* const kick, float decay);
414void t808Kick_setSighAmount (t808Kick* const kick, float sigh);454void t808Kick_setSighAmount (t808Kick* const kick, float sigh);
415void t808Kick_setChirpAmount (t808Kick* const kick, float chirp);455void t808Kick_setChirpAmount (t808Kick* const kick, float chirp);
LEAF/Src/leaf-WDF.c+1−1
@@ -154,7 +154,7 @@ void tWDF_init(tWDF* const r, WDFComponentType type, float value, tWDF* const rL · 153 unmodified lines
154 154
155void tWDF_free(tWDF* const r)155void tWDF_free(tWDF* const r)
156{156{
157 leaf_free(r);157
158}158}
159 159
160float tWDF_tick(tWDF* const r, float sample, tWDF* const outputPoint, uint8_t paramsChanged)160float tWDF_tick(tWDF* const r, float sample, tWDF* const outputPoint, uint8_t paramsChanged)
LEAF/Src/leaf-crusher.c+1−1
@@ -32,7 +32,7 @@ void tCrusher_init (tCrusher* const c) · 31 unmodified lines
32 32
33void tCrusher_free (tCrusher* const c)33void tCrusher_free (tCrusher* const c)
34{34{
35 leaf_free(c);35
36}36}
37 37
38float tCrusher_tick (tCrusher* const c, float input)38float tCrusher_tick (tCrusher* const c, float input)
LEAF/Src/leaf-delay.c+0−4
@@ -41,7 +41,6 @@ void tDelay_init (tDelay* const d, uint32_t delay, uint32_t maxDelay) · 40 unmodified lines
41void tDelay_free(tDelay* const d)41void tDelay_free(tDelay* const d)
42{42{
43 leaf_free(d->buff);43 leaf_free(d->buff);
44 leaf_free(d);
45}44}
46 45
47float tDelay_tick (tDelay* const d, float input)46float tDelay_tick (tDelay* const d, float input)
@@ -153,7 +152,6 @@ void tDelayL_init (tDelayL* const d, float delay, uint32_t maxDelay) · 105 unmodified lines
153void tDelayL_free(tDelayL* const d)152void tDelayL_free(tDelayL* const d)
154{153{
155 leaf_free(d->buff);154 leaf_free(d->buff);
156 leaf_free(d);
157}155}
158 156
159float tDelayL_tick (tDelayL* const d, float input)157float tDelayL_tick (tDelayL* const d, float input)
@@ -319,7 +317,6 @@ void tDelayA_init (tDelayA* const d, float delay, uint32_t maxDelay) · 159 unmodified lines
319void tDelayA_free(tDelayA* const d)317void tDelayA_free(tDelayA* const d)
320{318{
321 leaf_free(d->buff);319 leaf_free(d->buff);
322 leaf_free(d);
323}320}
324 321
325float tDelayA_tick (tDelayA* const d, float input)322float tDelayA_tick (tDelayA* const d, float input)
@@ -455,7 +452,6 @@ void tTapeDelay_init (tTapeDelay* const d, float delay, uint32_t maxDelay) · 129 unmodified lines
455void tTapeDelay_free(tTapeDelay* const d)452void tTapeDelay_free(tTapeDelay* const d)
456{453{
457 leaf_free(d->buff);454 leaf_free(d->buff);
458 leaf_free(d);
459}455}
460 456
461//#define SMOOTH_FACTOR 10.f457//#define SMOOTH_FACTOR 10.f
LEAF/Src/leaf-filter.c+30−29
@@ -30,15 +30,14 @@ void tAllpass_init(tAllpass* const f, float initDelay, uint32_t maxDelay) · 29 unmodified lines
30 tDelayL_init(&f->delay, initDelay, maxDelay);30 tDelayL_init(&f->delay, initDelay, maxDelay);
31}31}
32 32
33void tAllpass_setDelay(tAllpass* const f, float delay)33void tAllpass_free(tAllpass* const f)
34{34{
35 tDelayL_setDelay(&f->delay, delay);35 tDelayL_free(&f->delay);
36}36}
37 37
38void tAllpass_free(tAllpass* const f)38void tAllpass_setDelay(tAllpass* const f, float delay)
39{39{
40 leaf_free(&f->delay);40 tDelayL_setDelay(&f->delay, delay);
41 leaf_free(f);
42}41}
43 42
44void tAllpass_setGain(tAllpass* const f, float gain)43void tAllpass_setGain(tAllpass* const f, float gain)
@@ -81,8 +80,6 @@ void tButterworth_free(tButterworth* const f) · 36 unmodified lines
81 tSVF_free(&f->low[i]);80 tSVF_free(&f->low[i]);
82 tSVF_free(&f->high[i]);81 tSVF_free(&f->high[i]);
83 }82 }
84
85 leaf_free(f);
86}83}
87 84
88float tButterworth_tick(tButterworth* const f, float samp)85float tButterworth_tick(tButterworth* const f, float samp)
@@ -129,7 +126,7 @@ void tOneZero_init(tOneZero* const f, float theZero) · 40 unmodified lines
129 126
130void tOneZero_free(tOneZero* const f)127void tOneZero_free(tOneZero* const f)
131{128{
132 leaf_free(f);129
133}130}
134 131
135float tOneZero_tick(tOneZero* const f, float input)132float tOneZero_tick(tOneZero* const f, float input)
@@ -210,7 +207,7 @@ void tTwoZero_init(tTwoZero* const f) · 74 unmodified lines
210 207
211void tTwoZero_free(tTwoZero* const f)208void tTwoZero_free(tTwoZero* const f)
212{209{
213 leaf_free(f);210
214}211}
215 212
216float tTwoZero_tick(tTwoZero* const f, float input)213float tTwoZero_tick(tTwoZero* const f, float input)
@@ -287,7 +284,7 @@ void tOnePole_init(tOnePole* const f, float freq) · 70 unmodified lines
287 284
288void tOnePole_free(tOnePole* const f)285void tOnePole_free(tOnePole* const f)
289{286{
290 leaf_free(f);287
291}288}
292 289
293void tOnePole_setB0(tOnePole* const f, float b0)290void tOnePole_setB0(tOnePole* const f, float b0)
@@ -359,7 +356,7 @@ void tTwoPole_init(tTwoPole* const f) · 65 unmodified lines
359 356
360void tTwoPole_free(tTwoPole* const f)357void tTwoPole_free(tTwoPole* const f)
361{358{
362 leaf_free(f);359
363}360}
364 361
365float tTwoPole_tick(tTwoPole* const f, float input)362float tTwoPole_tick(tTwoPole* const f, float input)
@@ -450,7 +447,7 @@ void tPoleZero_init(tPoleZero* const f) · 84 unmodified lines
450 447
451void tPoleZero_free(tPoleZero* const f)448void tPoleZero_free(tPoleZero* const f)
452{449{
453 leaf_free(f);450
454}451}
455 452
456void tPoleZero_setB0(tPoleZero* const pzf, float b0)453void tPoleZero_setB0(tPoleZero* const pzf, float b0)
@@ -543,7 +540,7 @@ void tBiQuad_init(tBiQuad* const f) · 86 unmodified lines
543 540
544void tBiQuad_free(tBiQuad* const f)541void tBiQuad_free(tBiQuad* const f)
545{542{
546 leaf_free(f);543
547}544}
548 545
549float tBiQuad_tick(tBiQuad* const f, float input)546float tBiQuad_tick(tBiQuad* const f, float input)
@@ -655,6 +652,20 @@ void tBiQuadSampleRateChanged(tBiQuad* const f) · 105 unmodified lines
655}652}
656 653
657/* Highpass */654/* Highpass */
655void tHighpass_init(tHighpass* const f, float freq)
656{
657 f->R = (1.0f-((freq * 2.0f * 3.14f)* leaf.invSampleRate));
658 f->ys = 0.0f;
659 f->xs = 0.0f;
660
661 f->frequency = freq;
662}
663
664void tHighpass_free(tHighpass* const f)
665{
666
667}
668
658void tHighpass_setFreq(tHighpass* const f, float freq)669void tHighpass_setFreq(tHighpass* const f, float freq)
659{670{
660 f->frequency = freq;671 f->frequency = freq;
@@ -675,20 +686,6 @@ float tHighpass_tick(tHighpass* const f, float x) · 14 unmodified lines
675 return f->ys;686 return f->ys;
676}687}
677 688
678void tHighpass_init(tHighpass* const f, float freq)
679{
680 f->R = (1.0f-((freq * 2.0f * 3.14f)* leaf.invSampleRate));
681 f->ys = 0.0f;
682 f->xs = 0.0f;
683
684 f->frequency = freq;
685}
686
687void tHighpass_free(tHighpass* const f)
688{
689 leaf_free(f);
690}
691
692void tHighpassSampleRateChanged(tHighpass* const f)689void tHighpassSampleRateChanged(tHighpass* const f)
693{690{
694 f->R = (1.0f-((f->frequency * 2.0f * 3.14f) * leaf.invSampleRate));691 f->R = (1.0f-((f->frequency * 2.0f * 3.14f) * leaf.invSampleRate));
@@ -737,7 +734,7 @@ void tSVF_init(tSVF* const svf, SVFType type, float freq, float Q) · 42 unmodified lines
737 734
738void tSVF_free(tSVF* const svf)735void tSVF_free(tSVF* const svf)
739{736{
740 leaf_free(svf);737
741}738}
742 739
743int tSVF_setFreq(tSVF* const svf, float freq)740int tSVF_setFreq(tSVF* const svf, float freq)
@@ -782,6 +779,11 @@ void tSVFE_init(tSVFE* const svf, SVFType type, uint16_t input, float Q) · 38 unmodified lines
782 svf->a3 = a3;779 svf->a3 = a3;
783}780}
784 781
782void tSVFE_free(tSVFE* const svf)
783{
784
785}
786
785float tSVFE_tick(tSVFE* const svf, float v0)787float tSVFE_tick(tSVFE* const svf, float v0)
786{788{
787 float v1,v2,v3;789 float v1,v2,v3;
@@ -838,5 +840,4 @@ float tFIR_tick(tFIR* const fir, float input){ · 50 unmodified lines
838void tFIR_free(tFIR* const fir)840void tFIR_free(tFIR* const fir)
839{841{
840 leaf_free(fir->past);842 leaf_free(fir->past);
841 leaf_free(fir);
842}843}
LEAF/Src/leaf-formant.c+0−2
@@ -61,8 +61,6 @@ void tFormantShifter_free(tFormantShifter* const fs) · 60 unmodified lines
61 leaf_free(fs->fbuff[i]);61 leaf_free(fs->fbuff[i]);
62 }62 }
63 leaf_free(fs->fbuff);63 leaf_free(fs->fbuff);
64
65 leaf_free(fs);
66}64}
67 65
68 66
LEAF/Src/leaf-mempool.c+1−0
@@ -48,6 +48,7 @@ · 47 unmodified lines
48 48
49#endif49#endif
50 50
51// This might be too low.
51#define NUM_BLOCKS 5052#define NUM_BLOCKS 50
52 53
53mpool_pool_t blocks[NUM_BLOCKS];54mpool_pool_t blocks[NUM_BLOCKS];
LEAF/Src/leaf-midi.c+12−14
@@ -37,7 +37,7 @@ void tPoly_init(tPoly* const poly, int maxNumVoices) · 36 unmodified lines
37 37
38 poly->glideTime = 5.0f;38 poly->glideTime = 5.0f;
39 39
40 poly->ramp = (tRamp*) leaf_alloc(sizeof(tRamp) * poly->maxNumVoices);40 poly->ramps = (tRamp*) leaf_alloc(sizeof(tRamp) * poly->maxNumVoices);
41 poly->rampVals = (float*) leaf_alloc(sizeof(float) * poly->maxNumVoices);41 poly->rampVals = (float*) leaf_alloc(sizeof(float) * poly->maxNumVoices);
42 poly->firstReceived = (oBool*) leaf_alloc(sizeof(oBool) * poly->maxNumVoices);42 poly->firstReceived = (oBool*) leaf_alloc(sizeof(oBool) * poly->maxNumVoices);
43 poly->voices = (int**) leaf_alloc(sizeof(int*) * poly->maxNumVoices);43 poly->voices = (int**) leaf_alloc(sizeof(int*) * poly->maxNumVoices);
@@ -48,7 +48,7 @@ void tPoly_init(tPoly* const poly, int maxNumVoices) · 4 unmodified lines
48 poly->voices[i][0] = -1;48 poly->voices[i][0] = -1;
49 poly->firstReceived[i] = OFALSE;49 poly->firstReceived[i] = OFALSE;
50 50
51 tRamp_init(&poly->ramp[i], poly->glideTime, 1);51 tRamp_init(&poly->ramps[i], poly->glideTime, 1);
52 }52 }
53 53
54 poly->pitchBend = 0.0f;54 poly->pitchBend = 0.0f;
@@ -64,7 +64,7 @@ void tPoly_free(tPoly* const poly) · 9 unmodified lines
64{64{
65 for (int i = 0; i < poly->maxNumVoices; i++)65 for (int i = 0; i < poly->maxNumVoices; i++)
66 {66 {
67 tRamp_free(&poly->ramp[i]);67 tRamp_free(&poly->ramps[i]);
68 leaf_free(poly->voices[i]);68 leaf_free(poly->voices[i]);
69 }69 }
70 tRamp_free(&poly->pitchBendRamp);70 tRamp_free(&poly->pitchBendRamp);
@@ -72,11 +72,9 @@ void tPoly_free(tPoly* const poly) · 1 unmodified line
72 tStack_free(&poly->orderStack);72 tStack_free(&poly->orderStack);
73 73
74 leaf_free(poly->voices);74 leaf_free(poly->voices);
75 leaf_free(poly->ramp);75 leaf_free(poly->ramps);
76 leaf_free(poly->rampVals);76 leaf_free(poly->rampVals);
77 leaf_free(poly->firstReceived);77 leaf_free(poly->firstReceived);
78
79
80}78}
81 79
82void tPoly_tickPitch(tPoly* poly)80void tPoly_tickPitch(tPoly* poly)
@@ -89,7 +87,7 @@ void tPoly_tickPitchGlide(tPoly* poly) · 6 unmodified lines
89{87{
90 for (int i = 0; i < poly->maxNumVoices; ++i)88 for (int i = 0; i < poly->maxNumVoices; ++i)
91 {89 {
92 tRamp_tick(&poly->ramp[i]);90 tRamp_tick(&poly->ramps[i]);
93 }91 }
94}92}
95 93
@@ -122,7 +120,7 @@ int tPoly_noteOn(tPoly* const poly, int note, uint8_t vel) · 26 unmodified lines
122 {120 {
123 if (!poly->firstReceived[i] || !poly->pitchGlideIsActive)121 if (!poly->firstReceived[i] || !poly->pitchGlideIsActive)
124 {122 {
125 tRamp_setVal(&poly->ramp[i], note);123 tRamp_setVal(&poly->ramps[i], note);
126 poly->firstReceived[i] = OTRUE;124 poly->firstReceived[i] = OTRUE;
127 }125 }
128 126
@@ -134,7 +132,7 @@ int tPoly_noteOn(tPoly* const poly, int note, uint8_t vel) · 5 unmodified lines
134 poly->notes[note][0] = vel;132 poly->notes[note][0] = vel;
135 poly->notes[note][1] = i;133 poly->notes[note][1] = i;
136 134
137 tRamp_setDest(&poly->ramp[i], poly->voices[i][0]);135 tRamp_setDest(&poly->ramps[i], poly->voices[i][0]);
138 136
139 alteredVoice = i;137 alteredVoice = i;
140 break;138 break;
@@ -158,8 +156,8 @@ int tPoly_noteOn(tPoly* const poly, int note, uint8_t vel) · 17 unmodified lines
158 poly->notes[note][0] = vel;156 poly->notes[note][0] = vel;
159 poly->notes[note][1] = whichVoice;157 poly->notes[note][1] = whichVoice;
160 158
161 tRamp_setTime(&poly->ramp[whichVoice], poly->glideTime);159 tRamp_setTime(&poly->ramps[whichVoice], poly->glideTime);
162 tRamp_setDest(&poly->ramp[whichVoice], poly->voices[whichVoice][0]);160 tRamp_setDest(&poly->ramps[whichVoice], poly->voices[whichVoice][0]);
163 161
164 alteredVoice = whichVoice;162 alteredVoice = whichVoice;
165 163
@@ -214,7 +212,7 @@ int tPoly_noteOff(tPoly* const poly, uint8_t note) · 48 unmodified lines
214 if (poly->notes[noteToTest][1] < 0) //if there is a stolen note waiting (marked inactive but on the stack)212 if (poly->notes[noteToTest][1] < 0) //if there is a stolen note waiting (marked inactive but on the stack)
215 {213 {
216 poly->voices[deactivatedVoice][0] = noteToTest; //set the newly free voice to use the old stolen note214 poly->voices[deactivatedVoice][0] = noteToTest; //set the newly free voice to use the old stolen note
217 tRamp_setDest(&poly->ramp[deactivatedVoice], poly->voices[deactivatedVoice][0]);215 tRamp_setDest(&poly->ramps[deactivatedVoice], poly->voices[deactivatedVoice][0]);
218 poly->voices[deactivatedVoice][1] = poly->notes[noteToTest][0]; // set the velocity of the voice to be the velocity of that note216 poly->voices[deactivatedVoice][1] = poly->notes[noteToTest][0]; // set the velocity of the voice to be the velocity of that note
219 poly->notes[noteToTest][1] = deactivatedVoice; //mark that it is no longer stolen and is now active217 poly->notes[noteToTest][1] = deactivatedVoice; //mark that it is no longer stolen and is now active
220 return -1;218 return -1;
@@ -278,7 +276,7 @@ void tPoly_setPitchGlideTime(tPoly* const poly, float t) · 57 unmodified lines
278 poly->glideTime = t;276 poly->glideTime = t;
279 for (int i = 0; i < poly->maxNumVoices; ++i)277 for (int i = 0; i < poly->maxNumVoices; ++i)
280 {278 {
281 tRamp_setTime(&poly->ramp[i], poly->glideTime);279 tRamp_setTime(&poly->ramps[i], poly->glideTime);
282 }280 }
283}281}
284 282
@@ -289,7 +287,7 @@ int tPoly_getNumVoices(tPoly* const poly) · 4 unmodified lines
289 287
290float tPoly_getPitch(tPoly* const poly, uint8_t voice)288float tPoly_getPitch(tPoly* const poly, uint8_t voice)
291{289{
292 return tRamp_sample(&poly->ramp[voice]) + tRamp_sample(&poly->pitchBendRamp);290 return tRamp_sample(&poly->ramps[voice]) + tRamp_sample(&poly->pitchBendRamp);
293}291}
294 292
295int tPoly_getKey(tPoly* const poly, uint8_t voice)293int tPoly_getKey(tPoly* const poly, uint8_t voice)
LEAF/Src/leaf-oscillator.c+17−16
@@ -57,8 +57,6 @@ void tNeuron_init(tNeuron* const n) · 56 unmodified lines
57void tNeuron_free(tNeuron* const n)57void tNeuron_free(tNeuron* const n)
58{58{
59 tPoleZero_free(&n->f);59 tPoleZero_free(&n->f);
60
61 leaf_free(n);
62}60}
63 61
64void tNeuron_reset(tNeuron* const n)62void tNeuron_reset(tNeuron* const n)
@@ -226,7 +224,7 @@ void tCycle_init(tCycle* const c) · 161 unmodified lines
226 224
227void tCycle_free(tCycle* const c)225void tCycle_free(tCycle* const c)
228{226{
229 leaf_free(c);227
230}228}
231 229
232int tCycle_setFreq(tCycle* const c, float freq)230int tCycle_setFreq(tCycle* const c, float freq)
@@ -266,6 +264,17 @@ void tPhasorSampleRateChanged (tPhasor* const p) · 33 unmodified lines
266 p->inc = p->freq * leaf.invSampleRate;264 p->inc = p->freq * leaf.invSampleRate;
267};265};
268 266
267void tPhasor_init(tPhasor* const p)
268{
269 p->phase = 0.0f;
270 p->inc = 0.0f;
271}
272
273void tPhasor_free(tPhasor* const p)
274{
275
276}
277
269int tPhasor_setFreq(tPhasor* const p, float freq)278int tPhasor_setFreq(tPhasor* const p, float freq)
270{279{
271 if (freq < 0.0f) freq = 0.0f;280 if (freq < 0.0f) freq = 0.0f;
@@ -285,16 +294,7 @@ float tPhasor_tick(tPhasor* const p) · 13 unmodified lines
285 return p->phase;294 return p->phase;
286}295}
287 296
288void tPhasor_init(tPhasor* const p)
289{
290 p->phase = 0.0f;
291 p->inc = 0.0f;
292}
293 297
294void tPhasor_free(tPhasor* const p)
295{
296 leaf_free(p);
297}
298 298
299void tSawtooth_init(tSawtooth* const c)299void tSawtooth_init(tSawtooth* const c)
300{300{
@@ -304,7 +304,7 @@ void tSawtooth_init(tSawtooth* const c) · 3 unmodified lines
304 304
305void tSawtooth_free(tSawtooth* const c)305void tSawtooth_free(tSawtooth* const c)
306{306{
307 leaf_free(c);307
308}308}
309 309
310int tSawtooth_setFreq(tSawtooth* const c, float freq)310int tSawtooth_setFreq(tSawtooth* const c, float freq)
@@ -411,7 +411,8 @@ void tTriangle_init(tTriangle* const c) · 100 unmodified lines
411 411
412void tTriangle_free(tTriangle* const c)412void tTriangle_free(tTriangle* const c)
413{413{
414 leaf_free(c);}414
415}
415 416
416int tTriangle_setFreq(tTriangle* const c, float freq)417int tTriangle_setFreq(tTriangle* const c, float freq)
417{418{
@@ -513,7 +514,7 @@ void tSquare_init(tSquare* const c) · 95 unmodified lines
513 514
514void tSquare_free(tSquare* const c)515void tSquare_free(tSquare* const c)
515{516{
516 leaf_free(c);517
517}518}
518 519
519int tSquare_setFreq(tSquare* const c, float freq)520int tSquare_setFreq(tSquare* const c, float freq)
@@ -614,7 +615,7 @@ void tNoise_init(tNoise* const n, NoiseType type) · 94 unmodified lines
614 615
615void tNoise_free(tNoise* const n)616void tNoise_free(tNoise* const n)
616{617{
617 leaf_free(n);618
618}619}
619 620
620float tNoise_tick(tNoise* const n)621float tNoise_tick(tNoise* const n)
LEAF/Src/leaf-oversampler.c+0−1
@@ -41,7 +41,6 @@ void tOversampler_free(tOversampler* const os) · 40 unmodified lines
41{41{
42 leaf_free(os->upState);42 leaf_free(os->upState);
43 leaf_free(os->downState);43 leaf_free(os->downState);
44 leaf_free(os);
45}44}
46 45
47float tOversampler_tick(tOversampler* const os, float input, float (*effectTick)(float))46float tOversampler_tick(tOversampler* const os, float input, float (*effectTick)(float))
LEAF/Src/leaf-pitch.c+0−7
@@ -51,8 +51,6 @@ void tPitchShifter_free(tPitchShifter* const ps) · 50 unmodified lines
51 tSNAC_free(&ps->snac);51 tSNAC_free(&ps->snac);
52 tSOLAD_free(&ps->sola);52 tSOLAD_free(&ps->sola);
53 tHighpass_free(&ps->hp);53 tHighpass_free(&ps->hp);
54
55 leaf_free(ps);
56}54}
57 55
58float tPitchShifter_tick(tPitchShifter* ps, float sample)56float tPitchShifter_tick(tPitchShifter* ps, float sample)
@@ -94,7 +92,6 @@ float tPitchShifter_tick(tPitchShifter* ps, float sample) · 35 unmodified lines
94 tSOLAD_setPitchFactor(&ps->sola, ps->pitchFactor);92 tSOLAD_setPitchFactor(&ps->sola, ps->pitchFactor);
95 tSOLAD_ioSamples(&ps->sola, &(ps->inBuffer[i]), &(ps->outBuffer[i]), ps->frameSize);93 tSOLAD_ioSamples(&ps->sola, &(ps->inBuffer[i]), &(ps->outBuffer[i]), ps->frameSize);
96 94
97
98 }95 }
99 96
100 return out;97 return out;
@@ -368,8 +365,6 @@ void tPeriod_free (tPeriod* const p) · 267 unmodified lines
368{365{
369 tEnv_free(&p->env);366 tEnv_free(&p->env);
370 tSNAC_free(&p->snac);367 tSNAC_free(&p->snac);
371
372 leaf_free(p);
373}368}
374 369
375float tPeriod_findPeriod (tPeriod* p, float sample)370float tPeriod_findPeriod (tPeriod* p, float sample)
@@ -470,8 +465,6 @@ void tPitchShift_free(tPitchShift* const ps) · 94 unmodified lines
470{465{
471 tSOLAD_free(&ps->sola);466 tSOLAD_free(&ps->sola);
472 tHighpass_free(&ps->hp);467 tHighpass_free(&ps->hp);
473
474 leaf_free(ps);
475}468}
476 469
477float tPitchShift_shift (tPitchShift* ps)470float tPitchShift_shift (tPitchShift* ps)
LEAF/Src/leaf-reverb.c+4−5
@@ -58,7 +58,6 @@ void tPRCRev_free(tPRCRev* const r) · 57 unmodified lines
58 tDelay_free(&r->allpassDelays[0]);58 tDelay_free(&r->allpassDelays[0]);
59 tDelay_free(&r->allpassDelays[1]);59 tDelay_free(&r->allpassDelays[1]);
60 tDelay_free(&r->combDelay);60 tDelay_free(&r->combDelay);
61 leaf_free(r);
62}61}
63 62
64void tPRCRev_setT60(tPRCRev* const r, float t60)63void tPRCRev_setT60(tPRCRev* const r, float t60)
@@ -167,8 +166,6 @@ void tNRev_free(tNRev* const r) · 102 unmodified lines
167 {166 {
168 tDelay_free(&r->allpassDelays[i]);167 tDelay_free(&r->allpassDelays[i]);
169 }168 }
170
171 leaf_free(r);
172}169}
173 170
174void tNRev_setT60(tNRev* const r, float t60)171void tNRev_setT60(tNRev* const r, float t60)
@@ -334,6 +331,8 @@ void tDattorro_free (tDattorro* const r) · 159 unmodified lines
334 331
335 tOnePole_free(&r->f1_filter);332 tOnePole_free(&r->f1_filter);
336 333
334 tHighpass_free(&r->f2_hp);
335
337 tCycle_free(&r->f1_lfo);336 tCycle_free(&r->f1_lfo);
338 337
339 // FEEDBACK 2338 // FEEDBACK 2
@@ -345,9 +344,9 @@ void tDattorro_free (tDattorro* const r) · 5 unmodified lines
345 344
346 tOnePole_free(&r->f2_filter);345 tOnePole_free(&r->f2_filter);
347 346
348 tCycle_free(&r->f2_lfo);347 tHighpass_free(&r->f2_hp);
349 348
350 leaf_free(r);349 tCycle_free(&r->f2_lfo);
351}350}
352 351
353float tDattorro_tick (tDattorro* const r, float input)352float tDattorro_tick (tDattorro* const r, float input)
LEAF/Src/leaf-sample.c+0−2
@@ -39,7 +39,6 @@ void tBuffer_init (tBuffer* const s, uint32_t length) · 38 unmodified lines
39void tBuffer_free (tBuffer* const s)39void tBuffer_free (tBuffer* const s)
40{40{
41 leaf_free(s->buff);41 leaf_free(s->buff);
42 leaf_free(s);
43}42}
44 43
45void tBuffer_tick (tBuffer* const s, float sample)44void tBuffer_tick (tBuffer* const s, float sample)
@@ -136,7 +135,6 @@ void tSampler_init(tSampler* const p, tBuffer* const s) · 90 unmodified lines
136void tSampler_free (tSampler* const p)135void tSampler_free (tSampler* const p)
137{136{
138 tRamp_free(&p->gain);137 tRamp_free(&p->gain);
139 leaf_free(p);
140}138}
141 139
142float tSampler_tick (tSampler* const p)140float tSampler_tick (tSampler* const p)
LEAF/Src/leaf-string.c+0−4
@@ -38,8 +38,6 @@ void tPluck_free (tPluck* const p) · 37 unmodified lines
38 tOnePole_free(&p->pickFilter);38 tOnePole_free(&p->pickFilter);
39 tOneZero_free(&p->loopFilter);39 tOneZero_free(&p->loopFilter);
40 tDelayA_free(&p->delayLine);40 tDelayA_free(&p->delayLine);
41
42 leaf_free(p);
43}41}
44 42
45float tPluck_getLastOut (tPluck *p)43float tPluck_getLastOut (tPluck *p)
@@ -149,8 +147,6 @@ void tStifKarp_free (tStifKarp* const p) · 103 unmodified lines
149 {147 {
150 tBiQuad_free(&p->biquad[i]);148 tBiQuad_free(&p->biquad[i]);
151 }149 }
152
153 leaf_free(p);
154}150}
155 151
156float tStifKarp_getLastOut (tStifKarp* const p)152float tStifKarp_getLastOut (tStifKarp* const p)
LEAF/Src/leaf-tables.c+2−2
@@ -3,11 +3,11 @@ · 2 unmodified lines
3#if _WIN32 || _WIN643#if _WIN32 || _WIN64
4 4
5#include "..\Inc\leaf-tables.h"5#include "..\Inc\leaf-tables.h"
6#include "..\Inc\leaf-globals.h"6#include "..\Inc\leaf-global.h"
7#else7#else
8 8
9#include "../Inc/leaf-tables.h"9#include "../Inc/leaf-tables.h"
10#include "../Inc/leaf-globals.h"10#include "../Inc/leaf-global.h"
11 11
12#endif12#endif
13 13
LEAF/Src/leaf-utilities.c+84−16
@@ -126,7 +126,7 @@ void tEnv_init(tEnv* const x, int ws, int hs, int bs) · 125 unmodified lines
126 126
127void tEnv_free (tEnv* const x)127void tEnv_free (tEnv* const x)
128{128{
129 leaf_free(x);129
130}130}
131 131
132float tEnv_tick (tEnv* const x)132float tEnv_tick (tEnv* const x)
@@ -204,6 +204,11 @@ void tCompressor_init(tCompressor* const c) · 71 unmodified lines
204 c->W = 1.0f; // decibel Make-up gain204 c->W = 1.0f; // decibel Make-up gain
205}205}
206 206
207void tCompressor_free(tCompressor* const c)
208{
209
210}
211
207int ccount = 0;212int ccount = 0;
208float tCompressor_tick(tCompressor* const c, float in)213float tCompressor_tick(tCompressor* const c, float in)
209{214{
@@ -306,7 +311,7 @@ void tEnvelope_init(tEnvelope* const env, float attack, float decay, oBool lo · 96 unmodified lines
306 311
307void tEnvelope_free(tEnvelope* const env)312void tEnvelope_free(tEnvelope* const env)
308{313{
309 leaf_free(env);314
310}315}
311 316
312int tEnvelope_setAttack(tEnvelope* const env, float attack)317int tEnvelope_setAttack(tEnvelope* const env, float attack)
@@ -498,6 +503,11 @@ void tADSR_init(tADSR* const adsr, float attack, float decay, float sustain, · 185 unmodified lines
498 adsr->rampInc = adsr->inc_buff[rampIndex];503 adsr->rampInc = adsr->inc_buff[rampIndex];
499}504}
500 505
506void tADSR_free(tADSR* const adsr)
507{
508
509}
510
501int tADSR_setAttack(tADSR* const adsr, float attack)511int tADSR_setAttack(tADSR* const adsr, float attack)
502{512{
503 int32_t attackIndex;513 int32_t attackIndex;
@@ -683,6 +693,11 @@ void tEnvelopeFollower_init(tEnvelopeFollower* const e, float attackThreshold · 179 unmodified lines
683 e->d_coeff = decayCoeff;693 e->d_coeff = decayCoeff;
684}694}
685 695
696void tEnvelopeFollower_free(tEnvelopeFollower* const e)
697{
698
699}
700
686float tEnvelopeFollower_tick(tEnvelopeFollower* const ef, float x)701float tEnvelopeFollower_tick(tEnvelopeFollower* const ef, float x)
687{702{
688 if (x < 0.0f ) x = -x; /* Absolute value. */703 if (x < 0.0f ) x = -x; /* Absolute value. */
@@ -729,6 +744,11 @@ void tRamp_init(tRamp* const ramp, float time, int samples_per_tick) · 40 unmodified lines
729 ramp->inc = ((ramp->dest - ramp->curr) / ramp->time * ramp->inv_sr_ms) * (float)ramp->samples_per_tick;744 ramp->inc = ((ramp->dest - ramp->curr) / ramp->time * ramp->inv_sr_ms) * (float)ramp->samples_per_tick;
730}745}
731 746
747void tRamp_free(tRamp* const ramp)
748{
749
750}
751
732int tRamp_setTime(tRamp* const r, float time)752int tRamp_setTime(tRamp* const r, float time)
733{753{
734 if (time < r->minimum_time)754 if (time < r->minimum_time)
@@ -791,6 +811,11 @@ void tExpSmooth_init(tExpSmooth* const smooth, float val, float factor) · 56 unmodified lines
791 smooth->oneminusfactor=1.0f-factor;811 smooth->oneminusfactor=1.0f-factor;
792}812}
793 813
814void tExpSmooth_free(tExpSmooth* const smooth)
815{
816
817}
818
794int tExpSmooth_setFactor(tExpSmooth* const smooth, float factor)819int tExpSmooth_setFactor(tExpSmooth* const smooth, float factor)
795{ // factor is usually a value between 0 and 0.1. Lower value is slower. 0.01 for example gives you a smoothing time of about 10ms820{ // factor is usually a value between 0 and 0.1. Lower value is slower. 0.01 for example gives you a smoothing time of about 10ms
796 if (factor<0)821 if (factor<0)
@@ -835,6 +860,11 @@ void tPwrFollow_init(tPwrFollow* const p, float factor) · 38 unmodified lines
835 p->oneminusfactor=1.0f-factor;860 p->oneminusfactor=1.0f-factor;
836}861}
837 862
863void tPwrFollow_free(tPwrFollow* const p)
864{
865
866}
867
838int tPwrFollow_setFactor(tPwrFollow* const p, float factor)868int tPwrFollow_setFactor(tPwrFollow* const p, float factor)
839{869{
840 if (factor<0) factor=0;870 if (factor<0) factor=0;
@@ -866,6 +896,11 @@ void tFBleveller_init(tFBleveller* const p, float targetLevel, float factor, · 25 unmodified lines
866 p->strength=strength;896 p->strength=strength;
867}897}
868 898
899void tFBleveller_free(tFBleveller* const p)
900{
901 tPwrFollow_free(&p->pwrFlw);
902}
903
869int tFBleveller_setStrength(tFBleveller* const p, float strength)904int tFBleveller_setStrength(tFBleveller* const p, float strength)
870{ // strength is how strongly level diff is affecting the amp ratio905{ // strength is how strongly level diff is affecting the amp ratio
871 // try 0.125 for a start906 // try 0.125 for a start
@@ -972,6 +1007,15 @@ void tSimpleLivingString_init(tSimpleLivingString* const p, float freq, float · 100 unmodified lines
972 p->levMode=levMode;1007 p->levMode=levMode;
973}1008}
974 1009
1010void tSimpleLivingString_free(tSimpleLivingString* const p)
1011{
1012 tExpSmooth_free(&p->wlSmooth);
1013 tDelayL_free(&p->delayLine);
1014 tOnePole_free(&p->bridgeFilter);
1015 tHighpass_free(&p->DCblocker);
1016 tFBleveller_free(&p->fbLev);
1017}
1018
975int tSimpleLivingString_setFreq(tSimpleLivingString* const p, float freq)1019int tSimpleLivingString_setFreq(tSimpleLivingString* const p, float freq)
976{1020{
977 if (freq<20) freq=20;1021 if (freq<20) freq=20;
@@ -1068,6 +1112,24 @@ void tLivingString_init(tLivingString* const p, float freq, float pickPos, fl · 90 unmodified lines
1068 p->levMode=levMode;1112 p->levMode=levMode;
1069}1113}
1070 1114
1115void tLivingString_free(tLivingString* const p)
1116{
1117 tExpSmooth_free(&p->wlSmooth);
1118 tExpSmooth_free(&p->ppSmooth);
1119 tDelayL_free(&p->delLF);
1120 tDelayL_free(&p->delUF);
1121 tDelayL_free(&p->delUB);
1122 tDelayL_free(&p->delLB);
1123 tOnePole_free(&p->bridgeFilter);
1124 tOnePole_free(&p->nutFilter);
1125 tOnePole_free(&p->prepFilterU);
1126 tOnePole_free(&p->prepFilterL);
1127 tHighpass_free(&p->DCblockerU);
1128 tHighpass_free(&p->DCblockerL);
1129 tFBleveller_free(&p->fbLevU);
1130 tFBleveller_free(&p->fbLevL);
1131}
1132
1071int tLivingString_setFreq(tLivingString* const p, float freq)1133int tLivingString_setFreq(tLivingString* const p, float freq)
1072{ // NOTE: It is faster to set wavelength in samples directly1134{ // NOTE: It is faster to set wavelength in samples directly
1073 if (freq<20) freq=20;1135 if (freq<20) freq=20;
@@ -1189,6 +1251,21 @@ float tLivingString_sample(tLivingString* const p) · 115 unmodified lines
1189 1251
1190/* Stack */1252/* Stack */
1191 1253
1254void tStack_init(tStack* const ns)
1255{
1256 ns->ordered = OFALSE;
1257 ns->size = 0;
1258 ns->pos = 0;
1259 ns->capacity = STACK_SIZE;
1260
1261 for (int i = 0; i < STACK_SIZE; i++) ns->data[i] = -1;
1262}
1263
1264void tStack_free(tStack* const ns)
1265{
1266
1267}
1268
1192// If stack contains note, returns index. Else returns -1;1269// If stack contains note, returns index. Else returns -1;
1193int tStack_contains(tStack* const ns, uint16_t noteVal)1270int tStack_contains(tStack* const ns, uint16_t noteVal)
1194{1271{
@@ -1382,17 +1459,6 @@ int tStack_first(tStack* const ns) · 187 unmodified lines
1382{1459{
1383 return ns->data[0];1460 return ns->data[0];
1384}1461}
1385
1386void tStack_init(tStack* const ns)
1387{
1388 ns->ordered = OFALSE;
1389 ns->size = 0;
1390 ns->pos = 0;
1391 ns->capacity = STACK_SIZE;
1392
1393 for (int i = 0; i < STACK_SIZE; i++) ns->data[i] = -1;
1394}
1395
1396/******************************************************************************/1462/******************************************************************************/
1397/***************** static function declarations *******************************/1463/***************** static function declarations *******************************/
1398/******************************************************************************/1464/******************************************************************************/
@@ -1416,7 +1482,6 @@ void tSOLAD_init(tSOLAD* const w) · 17 unmodified lines
1416 1482
1417void tSOLAD_free(tSOLAD* const w)1483void tSOLAD_free(tSOLAD* const w)
1418{1484{
1419 leaf_free(w);
1420}1485}
1421 1486
1422// send one block of input samples, receive one block of output samples1487// send one block of input samples, receive one block of output samples
@@ -1750,7 +1815,10 @@ void tSNAC_init(tSNAC* const s, int overlaparg) · 327 unmodified lines
1750 1815
1751void tSNAC_free(tSNAC* const s)1816void tSNAC_free(tSNAC* const s)
1752{1817{
1753 leaf_free(s);1818 leaf_free(s->inputbuf);
1819 leaf_free(s->processbuf);
1820 leaf_free(s->spectrumbuf);
1821 leaf_free(s->biasbuf);
1754}1822}
1755/******************************************************************************/1823/******************************************************************************/
1756/************************** public access functions****************************/1824/************************** public access functions****************************/
@@ -2058,7 +2126,7 @@ void tAtkDtk_init_expanded(tAtkDtk* const a, int blocksize, int atk, int rel) · 301 unmodified lines
2058 2126
2059void tAtkDtk_free(tAtkDtk *a)2127void tAtkDtk_free(tAtkDtk *a)
2060{2128{
2061 leaf_free(a);2129
2062}2130}
2063 2131
2064/*******Public Functions***********/2132/*******Public Functions***********/
LEAF/Src/leaf-vocoder.c+5−3
@@ -51,8 +51,6 @@ void tTalkbox_free(tTalkbox* const v) · 50 unmodified lines
51 leaf_free(v->window);51 leaf_free(v->window);
52 leaf_free(v->buf0);52 leaf_free(v->buf0);
53 leaf_free(v->buf1);53 leaf_free(v->buf1);
54
55 leaf_free(v);
56}54}
57 55
58void tTalkbox_update(tTalkbox* const v) ///update internal parameters...56void tTalkbox_update(tTalkbox* const v) ///update internal parameters...
@@ -227,7 +225,6 @@ void tTalkbox_setQuality(tTalkbox* const v, float quality) · 168 unmodified lines
227 v->O = (int32_t)((0.0001f + 0.0004f * v->param[3]) * leaf.sampleRate);225 v->O = (int32_t)((0.0001f + 0.0004f * v->param[3]) * leaf.sampleRate);
228}226}
229 227
230
231void tVocoder_init (tVocoder* const v)228void tVocoder_init (tVocoder* const v)
232{229{
233 v->param[0] = 0.33f; //input select230 v->param[0] = 0.33f; //input select
@@ -242,6 +239,11 @@ void tVocoder_init (tVocoder* const v) · 8 unmodified lines
242 tVocoder_update(v);239 tVocoder_update(v);
243}240}
244 241
242void tVocoder_free (tVocoder* const v)
243{
244
245}
246
245void tVocoder_update (tVocoder* const v)247void tVocoder_update (tVocoder* const v)
246{248{
247 float tpofs = 6.2831853f * leaf.invSampleRate;249 float tpofs = 6.2831853f * leaf.invSampleRate;
LEAF/Src/leaf-wavefolder.c+5−0
@@ -23,6 +23,11 @@ void tLockhartWavefolder_init(tLockhartWavefolder* const w) · 22 unmodified lines
23 w->xn1 = 0.0f;23 w->xn1 = 0.0f;
24}24}
25 25
26void tLockhardWavefolder_free(tLockhartWavefolder* const w)
27{
28
29}
30
26double tLockhartWavefolderLambert(double x, double ln)31double tLockhartWavefolderLambert(double x, double ln)
27{32{
28 double thresh, w, expw, p, r, s, err;33 double thresh, w, expw, p, r, s, err;
LEAF/leaf.h+4−2
@@ -19,8 +19,9 @@ · 18 unmodified lines
19 19
20#if _WIN32 || _WIN6420#if _WIN32 || _WIN64
21 21
22#include ".\Inc\leaf-globals.h"22#include ".\Inc\leaf-global.h"
23#include ".\Inc\leaf-math.h"23#include ".\Inc\leaf-math.h"
24#include ".\Inc\leaf-mempool.h"
24#include ".\Inc\leaf-utilities.h"25#include ".\Inc\leaf-utilities.h"
25#include ".\Inc\leaf-delay.h"26#include ".\Inc\leaf-delay.h"
26#include ".\Inc\leaf-filter.h"27#include ".\Inc\leaf-filter.h"
@@ -40,8 +41,9 @@ · 13 unmodified lines
40 41
41#else42#else
42 43
43#include "./Inc/leaf-globals.h"44#include "./Inc/leaf-global.h"
44#include "./Inc/leaf-math.h"45#include "./Inc/leaf-math.h"
46#include "./Inc/leaf-mempool.h"
45#include "./Inc/leaf-utilities.h"47#include "./Inc/leaf-utilities.h"
46#include "./Inc/leaf-delay.h"48#include "./Inc/leaf-delay.h"
47#include "./Inc/leaf-filter.h"49#include "./Inc/leaf-filter.h"
LEAF_JUCEPlugin/LEAF.jucer+1−1
@@ -23,7 +23,7 @@ · 22 unmodified lines
23 <FILE id="Hu4b98" name="trigtbl.h" compile="0" resource="0" file="../LEAF/Externals/trigtbl.h"/>23 <FILE id="Hu4b98" name="trigtbl.h" compile="0" resource="0" file="../LEAF/Externals/trigtbl.h"/>
24 </GROUP>24 </GROUP>
25 <GROUP id="{0E2E673D-2AE5-AECB-4E28-A1EE29180BD2}" name="Inc">25 <GROUP id="{0E2E673D-2AE5-AECB-4E28-A1EE29180BD2}" name="Inc">
26 <FILE id="xaaxl7" name="leaf-globals.h" compile="0" resource="0" file="../LEAF/Inc/leaf-globals.h"/>26 <FILE id="IwBoc4" name="leaf-global.h" compile="0" resource="0" file="../LEAF/Inc/leaf-global.h"/>
27 <FILE id="cmehFw" name="leaf-math.h" compile="0" resource="0" file="../LEAF/Inc/leaf-math.h"/>27 <FILE id="cmehFw" name="leaf-math.h" compile="0" resource="0" file="../LEAF/Inc/leaf-math.h"/>
28 <FILE id="XQTGHV" name="leaf-mempool.h" compile="0" resource="0" file="../LEAF/Inc/leaf-mempool.h"/>28 <FILE id="XQTGHV" name="leaf-mempool.h" compile="0" resource="0" file="../LEAF/Inc/leaf-mempool.h"/>
29 <FILE id="k0yQ8k" name="leaf-808.h" compile="0" resource="0" file="../LEAF/Inc/leaf-808.h"/>29 <FILE id="k0yQ8k" name="leaf-808.h" compile="0" resource="0" file="../LEAF/Inc/leaf-808.h"/>

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