BogaudioModules

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

Pan.hpp (1277B)


      1 #pragma once
      2 
      3 #include "bogaudio.hpp"
      4 #include "dsp/signal.hpp"
      5 
      6 using namespace bogaudio::dsp;
      7 
      8 extern Model* modelPan;
      9 
     10 namespace bogaudio {
     11 
     12 struct Pan : BGModule {
     13 	enum ParamsIds {
     14 		PAN1_PARAM,
     15 		PAN2_PARAM,
     16 		NUM_PARAMS
     17 	};
     18 
     19 	enum InputsIds {
     20 		CV1_INPUT,
     21 		IN1_INPUT,
     22 		CV2_INPUT,
     23 		IN2_INPUT,
     24 		NUM_INPUTS
     25 	};
     26 
     27 	enum OutputsIds {
     28 		L_OUTPUT,
     29 		R_OUTPUT,
     30 		NUM_OUTPUTS
     31 	};
     32 
     33 	Panner _panner1[maxChannels];
     34 	Panner _panner2[maxChannels];
     35 	bogaudio::dsp::SlewLimiter _slew1[maxChannels];
     36 	bogaudio::dsp::SlewLimiter _slew2[maxChannels];
     37 	Saturator _saturatorLeft[maxChannels];
     38 	Saturator _saturatorRight[maxChannels];
     39 
     40 	Pan() {
     41 		config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
     42 		configParam(PAN1_PARAM, -1.0f, 1.0f, 0.0f, "Panning 1", "%", 0.0f, 100.0f);
     43 		configParam(PAN2_PARAM, -1.0f, 1.0f, 0.0f, "Panning 2", "%", 0.0f, 100.0f);
     44 
     45 		configInput(CV1_INPUT, "Pan 1 CV");
     46 		configInput(IN1_INPUT, "Signal 1");
     47 		configInput(CV2_INPUT, "Pan 2 CV");
     48 		configInput(IN2_INPUT, "Signal 2");
     49 
     50 		configOutput(L_OUTPUT, "Left signal");
     51 		configOutput(R_OUTPUT, "Right signal");
     52 
     53 		sampleRateChange();
     54 	}
     55 
     56 	bool active() override;
     57 	int channels() override;
     58 	void sampleRateChange() override;
     59 	void processChannel(const ProcessArgs& args, int c) override;
     60 };
     61 
     62 } // namespace bogaudio