BogaudioModules

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

AMRM.hpp (1274B)


      1 #pragma once
      2 
      3 #include "bogaudio.hpp"
      4 #include "dsp/signal.hpp"
      5 
      6 using namespace bogaudio::dsp;
      7 
      8 extern Model* modelAMRM;
      9 
     10 namespace bogaudio {
     11 
     12 struct AMRM : BGModule {
     13 	enum ParamsIds {
     14 		RECTIFY_PARAM,
     15 		DRYWET_PARAM,
     16 		NUM_PARAMS
     17 	};
     18 
     19 	enum InputsIds {
     20 		MODULATOR_INPUT,
     21 		CARRIER_INPUT,
     22 		RECTIFY_INPUT,
     23 		DRYWET_INPUT,
     24 		NUM_INPUTS
     25 	};
     26 
     27 	enum OutputsIds {
     28 		OUT_OUTPUT,
     29 		RECTIFY_OUTPUT,
     30 		NUM_OUTPUTS
     31 	};
     32 
     33 	Saturator _saturator;
     34 	int _polyInputID = CARRIER_INPUT;
     35 
     36 	AMRM() {
     37 		config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
     38 		configParam(RECTIFY_PARAM, 0.0f, 1.0f, 0.0f, "Rectification", "%", 0.0f, 100.0f);
     39 		configParam(DRYWET_PARAM, 0.0f, 1.0f, 1.0f, "Wet mix", "%", 0.0f, 100.0f);
     40 		configBypass(CARRIER_INPUT, OUT_OUTPUT);
     41 
     42 		configInput(MODULATOR_INPUT, "Modulator signal");
     43 		configInput(CARRIER_INPUT, "Carrier signal");
     44 		configInput(RECTIFY_INPUT, "Rectify CV");
     45 		configInput(DRYWET_INPUT, "Dry/wet CV");
     46 
     47 		configOutput(OUT_OUTPUT, "Modulated carrier signal");
     48 		configOutput(RECTIFY_OUTPUT, "Rectified modulator signal");
     49 	}
     50 
     51 	json_t* saveToJson(json_t* root) override;
     52 	void loadFromJson(json_t* root) override;
     53 	bool active() override;
     54 	int channels() override;
     55 	void processChannel(const ProcessArgs& args, int c) override;
     56 };
     57 
     58 } // namespace bogaudio