Offset.hpp (1094B)
1 #pragma once 2 3 #include "bogaudio.hpp" 4 #include "disable_output_limit.hpp" 5 6 extern Model* modelOffset; 7 8 namespace bogaudio { 9 10 struct Offset : DisableOutputLimitModule { 11 enum ParamsIds { 12 OFFSET_PARAM, 13 SCALE_PARAM, 14 NUM_PARAMS 15 }; 16 17 enum InputsIds { 18 OFFSET_INPUT, 19 SCALE_INPUT, 20 IN_INPUT, 21 NUM_INPUTS 22 }; 23 24 enum OutputsIds { 25 OUT_OUTPUT, 26 NUM_OUTPUTS 27 }; 28 29 bool _offsetFirst = false; 30 31 Offset() { 32 config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS); 33 configParam(OFFSET_PARAM, -1.0f, 1.0f, 0.0f, "Offset", " V", 0.0f, 10.0f); 34 configParam<TenXSquaringParamQuantity>(SCALE_PARAM, -1.0f, 1.0f, SQUARE_ROOT_ONE_TENTH, "Scale", "x"); 35 configBypass(IN_INPUT, OUT_OUTPUT); 36 37 configInput(OFFSET_INPUT, "Offset CV"); 38 configInput(SCALE_INPUT, "Scale CV"); 39 configInput(IN_INPUT, "Signal"); 40 41 configOutput(OUT_OUTPUT, "Signal"); 42 } 43 44 json_t* saveToJson(json_t* root) override; 45 void loadFromJson(json_t* root) override; 46 int channels() override; 47 void processChannel(const ProcessArgs& args, int c) override; 48 float knobValue(Param& knob, Input& cv, int c) const; 49 }; 50 51 } // namespace bogaudio