1 /* 2 ** Surge Synthesizer is Free and Open Source Software 3 ** 4 ** Surge is made available under the Gnu General Public License, v3.0 5 ** https://www.gnu.org/licenses/gpl-3.0.en.html 6 ** 7 ** Copyright 2004-2020 by various individuals as described by the Git transaction log 8 ** 9 ** All source at: https://github.com/surge-synthesizer/surge.git 10 ** 11 ** Surge was a commercial product from 2004-2018, with Copyright and ownership 12 ** in that period held by Claes Johanson at Vember Audio. Claes made Surge 13 ** open source in September 2018. 14 */ 15 16 #pragma once 17 #include "../Effect.h" 18 #include "shared/SmoothedValue.h" 19 #include "shared/Oversampling.h" 20 #include <vt_dsp/lipol.h> 21 22 namespace chowdsp 23 { 24 25 /* 26 ** CHOW is a truculent distortion effect, with similar 27 ** characteristic and controls as a compressor. The original 28 ** implementation can be found at: https://github.com/Chowdhury-DSP/CHOW 29 */ 30 class CHOWEffect : public Effect 31 { 32 public: 33 enum chow_params 34 { 35 chow_thresh = 0, 36 chow_ratio, 37 chow_flip, 38 39 chow_mix, 40 41 chow_num_ctrls, 42 }; 43 44 CHOWEffect(SurgeStorage *storage, FxStorage *fxdata, pdata *pd); 45 virtual ~CHOWEffect(); 46 get_effectname()47 virtual const char *get_effectname() override { return "CHOW"; } 48 49 virtual void init() override; 50 virtual void process(float *dataL, float *dataR) override; 51 virtual void suspend() override; 52 53 virtual void init_ctrltypes() override; 54 virtual void init_default_values() override; 55 virtual const char *group_label(int id) override; 56 virtual int group_label_ypos(int id) override; 57 58 private: 59 void set_params(); 60 void process_block(float *dataL, float *dataR); 61 void process_block_os(float *dataL, float *dataR); 62 63 enum 64 { 65 SmoothSteps = 200, 66 }; 67 68 bool cur_os = true; 69 float L alignas(16)[BLOCK_SIZE], R alignas(16)[BLOCK_SIZE]; 70 lipol_ps makeup alignas(16), mix alignas(16); 71 Oversampling<2, BLOCK_SIZE> os; 72 SmoothedValue<float, ValueSmoothingTypes::Multiplicative> thresh_smooth, ratio_smooth; 73 }; 74 75 } // namespace chowdsp 76