BogaudioModules

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

PEQ14XF.hpp (2171B)


      1 #pragma once
      2 
      3 #include "PEQ14_shared.hpp"
      4 
      5 namespace bogaudio {
      6 
      7 struct PEQ14XF : ExpanderModule<PEQ14ExpanderMessage, ExpandableModule<PEQ14ExpanderMessage, PEQXFBase>> {
      8 	enum ParamsIds {
      9 		DAMP_PARAM,
     10 		GAIN_PARAM,
     11 		NUM_PARAMS
     12 	};
     13 
     14 	enum InputsIds {
     15 		DAMP_INPUT,
     16 		GAIN_INPUT,
     17 		NUM_INPUTS
     18 	};
     19 
     20 	enum OutputsIds {
     21 		EF1_OUTPUT,
     22 		EF2_OUTPUT,
     23 		EF3_OUTPUT,
     24 		EF4_OUTPUT,
     25 		EF5_OUTPUT,
     26 		EF6_OUTPUT,
     27 		EF7_OUTPUT,
     28 		EF8_OUTPUT,
     29 		EF9_OUTPUT,
     30 		EF10_OUTPUT,
     31 		EF11_OUTPUT,
     32 		EF12_OUTPUT,
     33 		EF13_OUTPUT,
     34 		EF14_OUTPUT,
     35 		NUM_OUTPUTS
     36 	};
     37 
     38 	struct Engine {
     39 		EnvelopeFollower efs[14];
     40 		float response = -1.0f;
     41 		Amplifier gain;
     42 	};
     43 
     44 	Engine* _engines[maxChannels] {};
     45 	Saturator _saturator;
     46 	PEQ14ExpanderMessage* _baseMessage = NULL;
     47 
     48 	PEQ14XF() {
     49 		config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
     50 		configParam(DAMP_PARAM, 0.0f, 1.0f, 0.3f, "Envelope follower smoothing", "%", 0.0f, 100.0f);
     51 		configParam<EFGainParamQuantity>(GAIN_PARAM, -1.0f, 1.0f, 0.0f, "Envelope follower gain", " dB");
     52 
     53 		configInput(DAMP_INPUT, "Damp CV");
     54 		configInput(GAIN_INPUT, "Gain CV");
     55 
     56 		configOutput(EF1_OUTPUT, "Envelope 1");
     57 		configOutput(EF2_OUTPUT, "Envelope 2");
     58 		configOutput(EF3_OUTPUT, "Envelope 3");
     59 		configOutput(EF4_OUTPUT, "Envelope 4");
     60 		configOutput(EF5_OUTPUT, "Envelope 5");
     61 		configOutput(EF6_OUTPUT, "Envelope 6");
     62 		configOutput(EF7_OUTPUT, "Envelope 7");
     63 		configOutput(EF8_OUTPUT, "Envelope 8");
     64 		configOutput(EF9_OUTPUT, "Envelope 9");
     65 		configOutput(EF10_OUTPUT, "Envelope 10");
     66 		configOutput(EF11_OUTPUT, "Envelope 11");
     67 		configOutput(EF12_OUTPUT, "Envelope 12");
     68 		configOutput(EF13_OUTPUT, "Envelope 13");
     69 		configOutput(EF14_OUTPUT, "Envelope 14");
     70 
     71 		setBaseModelPredicate([](Model* m) { return m == modelPEQ14 || m == modelPEQ14XF || m == modelPEQ14XR  || m == modelPEQ14XV; });
     72 		setExpanderModelPredicate([](Model* m) { return m == modelPEQ14XF || m == modelPEQ14XR || m == modelPEQ14XV; });
     73 	}
     74 
     75 	void addChannel(int c) override;
     76 	void removeChannel(int c) override;
     77 	void modulateChannel(int c) override;
     78 	void processAll(const ProcessArgs& args) override;
     79 	void processChannel(const ProcessArgs& args, int c) override;
     80 };
     81 
     82 } // namespace bogaudio