CombFilterBank.h (1021B)
1 #include "../Misc/Allocator.h" 2 #include "../globals.h" 3 #include "../DSP/Value_Smoothing_Filter.h" 4 5 #pragma once 6 7 8 namespace zyn { 9 10 /**Comb Filter Bank for sympathetic Resonance*/ 11 class CombFilterBank 12 { 13 public: 14 CombFilterBank(Allocator *alloc, unsigned int samplerate_, int buffersize_, float initgain); 15 ~CombFilterBank(); 16 void filterout(float *smp); 17 18 float delays[NUM_SYMPATHETIC_STRINGS]={}; 19 float inputgain; 20 float outgain; 21 float gainbwd; 22 23 void setStrings(unsigned int nr, const float basefreq); 24 25 26 private: 27 static float tanhX(const float x); 28 float sampleLerp(const float *smp, const float pos) const; 29 30 float* string_smps[NUM_SYMPATHETIC_STRINGS] = {}; 31 float baseFreq; 32 unsigned int nrOfStrings=0; 33 unsigned int pos_writer = 0; 34 35 /* for smoothing gain jump when using binary valued sustain pedal */ 36 Value_Smoothing_Filter gain_smoothing; 37 38 Allocator &memory; 39 unsigned int mem_size=0; 40 int samplerate=0; 41 unsigned int buffersize=0; 42 43 44 }; 45 46 }