BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

Slew.hpp (1321B)


      1 #pragma once
      2 
      3 #include "slew_common.hpp"
      4 
      5 extern Model* modelSlew;
      6 
      7 namespace bogaudio {
      8 
      9 struct Slew : BGModule {
     10 	enum ParamsIds {
     11 		RISE_PARAM,
     12 		RISE_SHAPE_PARAM,
     13 		FALL_PARAM,
     14 		FALL_SHAPE_PARAM,
     15 		SLOW_PARAM,
     16 		NUM_PARAMS
     17 	};
     18 
     19 	enum InputsIds {
     20 		RISE_INPUT,
     21 		FALL_INPUT,
     22 		IN_INPUT,
     23 		NUM_INPUTS
     24 	};
     25 
     26 	enum OutputsIds {
     27 		OUT_OUTPUT,
     28 		NUM_OUTPUTS
     29 	};
     30 
     31 	RiseFallShapedSlewLimiter _slew[maxChannels];
     32 	float _timeScale = 1.0f;
     33 
     34 	Slew() {
     35 		config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
     36 		configParam<EnvelopeSegmentParamQuantity>(RISE_PARAM, 0.0f, 1.0f, SQUARE_ROOT_ONE_TENTH, "Rise", " s");
     37 		configParam(RISE_SHAPE_PARAM, -1.0f, 1.0f, 0.0f, "Rise shape");
     38 		configParam<EnvelopeSegmentParamQuantity>(FALL_PARAM, 0.0f, 1.0f, SQUARE_ROOT_ONE_TENTH, "Fall", " s");
     39 		configParam(FALL_SHAPE_PARAM, -1.0f, 1.0f, 0.0f, "Fall shape");
     40 		configSwitch(SLOW_PARAM, 0.0f, 1.0f, 0.0f, "Slow mode", {"Disabled", "Enabled"});
     41 		configBypass(IN_INPUT, OUT_OUTPUT);
     42 
     43 		configInput(RISE_INPUT, "Rise CV");
     44 		configInput(FALL_INPUT, "Fall CV");
     45 		configInput(IN_INPUT, "Signal");
     46 
     47 		configOutput(OUT_OUTPUT, "Signal");
     48 	}
     49 
     50 	bool active() override;
     51 	int channels() override;
     52 	void modulate() override;
     53 	void modulateChannel(int c) override;
     54 	void processChannel(const ProcessArgs& args, int c) override;
     55 };
     56 
     57 } // namespace bogaudio