CmpDist.hpp (2493B)
1 #pragma once 2 3 #include "bogaudio.hpp" 4 #include "dsp/signal.hpp" 5 6 extern Model* modelCmpDist; 7 8 using namespace bogaudio::dsp; 9 10 namespace bogaudio { 11 12 struct CmpDist : BGModule { 13 enum ParamsIds { 14 A_PARAM, 15 WINDOW_PARAM, 16 B_PARAM, 17 GT_MIX_PARAM, 18 EQ_MIX_PARAM, 19 LT_MIX_PARAM, 20 DRY_WET_PARAM, 21 A_DRY_PARAM, 22 B_DRY_PARAM, 23 NUM_PARAMS 24 }; 25 26 enum InputsIds { 27 GT_MIX_INPUT, 28 LT_MIX_INPUT, 29 WINDOW_INPUT, 30 DRY_WET_INPUT, 31 A_INPUT, 32 A_SCALE_INPUT, 33 B_INPUT, 34 B_SCALE_INPUT, 35 NUM_INPUTS 36 }; 37 38 enum OutputsIds { 39 GT_OUTPUT, 40 LT_OUTPUT, 41 EQ_OUTPUT, 42 MIX_OUTPUT, 43 NUM_OUTPUTS 44 }; 45 46 struct Engine { 47 float aScale = 0.0f; 48 float bScale = 0.0f; 49 float window = 0.0f; 50 float gtMix = 0.0f; 51 float eqMix = 0.0f; 52 float ltMix = 0.0f; 53 CrossFader dryWet; 54 }; 55 56 Engine* _engines[maxChannels] {}; 57 Amplifier _aDryAmplifier; 58 Amplifier _bDryAmplifier; 59 60 CmpDist() { 61 config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS); 62 configParam(A_PARAM, -1.0f, 1.0f, 1.0f, "A scaling", "%", 0.0f, 100.0f); 63 configParam(WINDOW_PARAM, 0.0f, 1.0f, 0.25f, "Window", " V", 0.0f, 10.0f); 64 configParam(B_PARAM, -1.0f, 1.0f, 0.0f, "B scaling", "%", 0.0f, 100.0f); 65 configParam(GT_MIX_PARAM, -1.0f, 1.0f, 1.0f, "Greater-than mix", "%", 0.0f, 100.0f); 66 configParam(EQ_MIX_PARAM, -1.0f, 1.0f, 0.0f, "Equal mix", "%", 0.0f, 100.0f); 67 configParam(LT_MIX_PARAM, -1.0f, 1.0f, 1.0f, "Less-than mix", "%", 0.0f, 100.0f); 68 configParam(DRY_WET_PARAM, -1.0f, 1.0f, 0.0f, "Dry/wet mix", "%", 0.0f, 100.0f); 69 configParam<AmplifierParamQuantity>(A_DRY_PARAM, 0.0f, 1.0f, 1.0f, "A dry level"); 70 configParam<AmplifierParamQuantity>(B_DRY_PARAM, 0.0f, 1.0f, 1.0f, "B dry level"); 71 72 configInput(GT_MIX_INPUT, "Greater-than mix CV"); 73 configInput(LT_MIX_INPUT, "Less-than mix CV"); 74 configInput(WINDOW_INPUT, "Window CV"); 75 configInput(DRY_WET_INPUT, "Dry/wet CV"); 76 configInput(A_INPUT, "Signal A"); 77 configInput(A_SCALE_INPUT, "Scale A CV"); 78 configInput(B_INPUT, "Signal B"); 79 configInput(B_SCALE_INPUT, "Scale B CV"); 80 81 configOutput(GT_OUTPUT, "Greater than"); 82 configOutput(LT_OUTPUT, "Less than"); 83 configOutput(EQ_OUTPUT, "Equal"); 84 configOutput(MIX_OUTPUT, "Mix"); 85 } 86 87 bool active() override; 88 int channels() override; 89 void addChannel(int c) override; 90 void removeChannel(int c) override; 91 void modulate() override; 92 void modulateChannel(int c) override; 93 void processAlways(const ProcessArgs& args) override; 94 void processChannel(const ProcessArgs& args, int c) override; 95 }; 96 97 } // namespace bogaudio