History

minor distortion fixes; revert oversampler to not use mempool for struct

Matthew Wang committed 6 years ago

Commit 373d2741 parent 0a2afe14 files · +18 −18Browse files

Unified · Split

4 files
  1. .DS_Store +0 −0
  2. LEAF/Inc/leaf-distortion.h +2 −2
  3. LEAF/Src/leaf-distortion.c +15 −15
  4. LEAF/leaf.h +2 −2
.DS_Store+0−0

Binary file not shown.

LEAF/Inc/leaf-distortion.h+2−2
@@ -81,9 +81,9 @@ extern "C" { · 80 unmodified lines
81 float* downState;81 float* downState;
82 int numTaps;82 int numTaps;
83 int phaseLength;83 int phaseLength;
84 } _tOversampler;84 } tOversampler;
85 85
86 typedef _tOversampler* tOversampler;86// typedef _tOversampler* tOversampler;
87 87
88 void tOversampler_init(tOversampler* const, int order, oBool extraQuality);88 void tOversampler_init(tOversampler* const, int order, oBool extraQuality);
89 void tOversampler_free(tOversampler* const);89 void tOversampler_free(tOversampler* const);
LEAF/Src/leaf-distortion.c+15−15
@@ -30,7 +30,7 @@ void tLockhartWavefolder_init(tLockhartWavefolder* const wf) · 29 unmodified lines
30 w->xn1 = 0.0f;30 w->xn1 = 0.0f;
31}31}
32 32
33void tLockhardWavefolder_free(tLockhartWavefolder* const wf)33void tLockhartWavefolder_free(tLockhartWavefolder* const wf)
34{34{
35 _tLockhartWavefolder* w = *wf;35 _tLockhartWavefolder* w = *wf;
36 36
@@ -207,9 +207,9 @@ void tCrusher_setSamplingRatio (tCrusher* const cr, float ratio) · 170 unmodified lines
207// Oversampler207// Oversampler
208//============================================================================================================208//============================================================================================================
209// Latency is equal to the phase length (numTaps / ratio)209// Latency is equal to the phase length (numTaps / ratio)
210void tOversampler_init(tOversampler* const osr, int ratio, oBool extraQuality)210void tOversampler_init(tOversampler* const os, int ratio, oBool extraQuality)
211{211{
212 _tOversampler* os = *osr = (_tOversampler*) leaf_alloc(sizeof(_tOversampler));212// _tOversampler* os = *osr = (_tOversampler*) leaf_alloc(sizeof(_tOversampler));
213 213
214 uint8_t offset = 0;214 uint8_t offset = 0;
215 if (extraQuality) offset = 6;215 if (extraQuality) offset = 6;
@@ -226,34 +226,34 @@ void tOversampler_init(tOversampler* const osr, int ratio, oBool extraQuality) · 10 unmodified lines
226 }226 }
227}227}
228 228
229void tOversampler_free(tOversampler* const osr)229void tOversampler_free(tOversampler* const os)
230{230{
231 _tOversampler* os = *osr;231// _tOversampler* os = *osr;
232 232
233 leaf_free(os->upState);233 leaf_free(os->upState);
234 leaf_free(os->downState);234 leaf_free(os->downState);
235 leaf_free(os);235 leaf_free(os);
236}236}
237 237
238float tOversampler_tick(tOversampler* const osr, float input, float (*effectTick)(float))238float tOversampler_tick(tOversampler* const os, float input, float (*effectTick)(float))
239{239{
240 _tOversampler* os = *osr;240// _tOversampler* os = *osr;
241 241
242 float buf[os->ratio];242 float buf[os->ratio];
243 243
244 tOversampler_upsample(osr, input, buf);244 tOversampler_upsample(os, input, buf);
245 245
246 for (int i = 0; i < os->ratio; ++i) {246 for (int i = 0; i < os->ratio; ++i) {
247 buf[i] = effectTick(buf[i]);247 buf[i] = effectTick(buf[i]);
248 }248 }
249 249
250 return tOversampler_downsample(osr, buf);250 return tOversampler_downsample(os, buf);
251}251}
252 252
253// From CMSIS DSP Library253// From CMSIS DSP Library
254void tOversampler_upsample(tOversampler* const osr, float input, float* output)254void tOversampler_upsample(tOversampler* const os, float input, float* output)
255{255{
256 _tOversampler* os = *osr;256// _tOversampler* os = *osr;
257 257
258 float *pState = os->upState; /* State pointer */258 float *pState = os->upState; /* State pointer */
259 const float *pCoeffs = os->pCoeffs; /* Coefficient pointer */259 const float *pCoeffs = os->pCoeffs; /* Coefficient pointer */
@@ -344,9 +344,9 @@ void tOversampler_upsample(tOversampler* const osr, float input, float* output) · 84 unmodified lines
344}344}
345 345
346// From CMSIS DSP Library346// From CMSIS DSP Library
347float tOversampler_downsample(tOversampler *const osr, float* input)347float tOversampler_downsample(tOversampler *const os, float* input)
348{348{
349 _tOversampler* os = *osr;349// _tOversampler* os = *osr;
350 350
351 float *pState = os->downState; /* State pointer */351 float *pState = os->downState; /* State pointer */
352 const float *pCoeffs = os->pCoeffs; /* Coefficient pointer */352 const float *pCoeffs = os->pCoeffs; /* Coefficient pointer */
@@ -428,8 +428,8 @@ float tOversampler_downsample(tOversampler *const osr, float* input) · 75 unmodified lines
428 return output;428 return output;
429}429}
430 430
431int tOversampler_getLatency(tOversampler* const osr)431int tOversampler_getLatency(tOversampler* const os)
432{432{
433 _tOversampler* os = *osr;433// _tOversampler* os = *osr;
434 return os->phaseLength;434 return os->phaseLength;
435}435}
LEAF/leaf.h+2−2
@@ -23,7 +23,7 @@ · 22 unmodified lines
23#include ".\Inc\leaf-math.h"23#include ".\Inc\leaf-math.h"
24#include ".\Inc\leaf-mempool.h"24#include ".\Inc\leaf-mempool.h"
25#include ".\Inc\leaf-tables.h"25#include ".\Inc\leaf-tables.h"
26#include ".\Inc\leaf-tables.h"26#include ".\Inc\leaf-distortion.h"
27#include ".\Inc\leaf-oscillators.h"27#include ".\Inc\leaf-oscillators.h"
28#include ".\Inc\leaf-filters.h"28#include ".\Inc\leaf-filters.h"
29#include ".\Inc\leaf-delay.h"29#include ".\Inc\leaf-delay.h"
@@ -44,7 +44,7 @@ · 14 unmodified lines
44#include "./Inc/leaf-math.h"44#include "./Inc/leaf-math.h"
45#include "./Inc/leaf-mempool.h"45#include "./Inc/leaf-mempool.h"
46#include "./Inc/leaf-tables.h"46#include "./Inc/leaf-tables.h"
47#include "./Inc/leaf-tables.h"47#include "./Inc/leaf-distortion.h"
48#include "./Inc/leaf-oscillators.h"48#include "./Inc/leaf-oscillators.h"
49#include "./Inc/leaf-filters.h"49#include "./Inc/leaf-filters.h"
50#include "./Inc/leaf-delay.h"50#include "./Inc/leaf-delay.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