BogaudioModules

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

mixer_expander.hpp (1375B)


      1 #pragma once
      2 
      3 #include "mixer.hpp"
      4 #include "expanders.hpp"
      5 #include "dsp/filters/equalizer.hpp"
      6 
      7 namespace bogaudio {
      8 
      9 template<int N>
     10 struct MixerExpanderMessage : ExpanderMessage {
     11 	bool active[N] {};
     12 	float preFader[N] {};
     13 	float postFader[N] {};
     14 	float postEQ[N] {};
     15 	float returnA[2] {};
     16 	float returnB[2] {};
     17 };
     18 
     19 struct MixerExpanderChannel {
     20 	Equalizer _eq;
     21 	Amplifier _sendAAmp;
     22 	Amplifier _sendBAmp;
     23 	bogaudio::dsp::SlewLimiter _sendASL;
     24 	bogaudio::dsp::SlewLimiter _sendBSL;
     25 
     26 	Param& _lowParam;
     27 	Param& _midParam;
     28 	Param& _highParam;
     29 	Param& _sendAParam;
     30 	Param& _sendBParam;
     31 	Param& _preAParam;
     32 	Param& _preBParam;
     33 	Input& _sendAInput;
     34 	Input& _sendBInput;
     35 
     36 	float postEQ = 0.0f;
     37 	float sendA = 0.0f;
     38 	float sendB = 0.0f;
     39 
     40 	MixerExpanderChannel(
     41 		Param& low,
     42 		Param& mid,
     43 		Param& high,
     44 		Param& sendA,
     45 		Param& sendB,
     46 		Param& preA,
     47 		Param& preB,
     48 		Input& cvA,
     49 		Input& cvB,
     50 		float sampleRate = 1000.0f
     51 	)
     52 	: _lowParam(low)
     53 	, _midParam(mid)
     54 	, _highParam(high)
     55 	, _sendAParam(sendA)
     56 	, _sendBParam(sendB)
     57 	, _preAParam(preA)
     58 	, _preBParam(preB)
     59 	, _sendAInput(cvA)
     60 	, _sendBInput(cvB)
     61 	{
     62 		setSampleRate(sampleRate);
     63 	}
     64 
     65 	void setSampleRate(float sampleRate);
     66 	float knobToDb(Param& p);
     67 	void modulate();
     68 	void next(float preFader, float postFader, bool sendAActive, bool sendBActive); // outputs on members postEQ, sendA, sendB
     69 };
     70 
     71 } // namespace bogaudio