BogaudioModules

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

Test2.hpp (1910B)


      1 #pragma once
      2 
      3 #include "bogaudio.hpp"
      4 
      5 extern Model* modelTest2;
      6 
      7 // #define COMPLEX_BIQUAD 1
      8 // #define MULTIPOLE 1
      9 // #define ADSR_ENVELOPE 1
     10 // #define LIMITER 1
     11 // #define CHIRP 1
     12 #define CHIRP2 1
     13 
     14 #ifdef COMPLEX_BIQUAD
     15 #include "dsp/filters/filter.hpp"
     16 #elif MULTIPOLE
     17 #include "dsp/filters/experiments.hpp"
     18 #elif ADSR_ENVELOPE
     19 #include "dsp/envelope.hpp"
     20 #elif LIMITER
     21 #include "dsp/signal.hpp"
     22 #elif CHIRP
     23 #include "dsp/oscillator.hpp"
     24 #elif CHIRP2
     25 #include "dsp/oscillator.hpp"
     26 #elif
     27 #error what
     28 #endif
     29 
     30 using namespace bogaudio::dsp;
     31 
     32 namespace bogaudio {
     33 
     34 struct Test2 : BGModule {
     35 	enum ParamsIds {
     36 		PARAM1A_PARAM,
     37 		PARAM2A_PARAM,
     38 		PARAM3A_PARAM,
     39 		PARAM1B_PARAM,
     40 		PARAM2B_PARAM,
     41 		PARAM3B_PARAM,
     42 		NUM_PARAMS
     43 	};
     44 
     45 	enum InputsIds {
     46 		CV1A_INPUT,
     47 		CV2A_INPUT,
     48 		CV3A_INPUT,
     49 		CV1B_INPUT,
     50 		CV2B_INPUT,
     51 		CV3B_INPUT,
     52 		IN_INPUT,
     53 		NUM_INPUTS
     54 	};
     55 
     56 	enum OutputsIds {
     57 		OUT_OUTPUT,
     58 		OUT2_OUTPUT,
     59 		NUM_OUTPUTS
     60 	};
     61 
     62 #ifdef COMPLEX_BIQUAD
     63 	ComplexBiquadFilter _complexBiquad;
     64 #elif MULTIPOLE
     65 	MultipoleFilter _filter;
     66 	const int maxSteps = 10;
     67 	int _steps = maxSteps;
     68 #elif ADSR_ENVELOPE
     69 	ADSR _adsr;
     70 	Trigger _trigger;
     71 #elif LIMITER
     72 	Limiter _limiter;
     73 #elif CHIRP
     74 	TablePhasor _phasor;
     75 	float _time = 0.0f;
     76 #elif CHIRP2
     77 	ChirpOscillator _chirp;
     78 	rack::dsp::PulseGenerator _pulse;
     79 #endif
     80 
     81 	Test2()
     82 #ifdef CHIRP
     83 	: _phasor(StaticSineTable::table())
     84 #endif
     85 	{
     86 		config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
     87 		configParam(PARAM1A_PARAM, 0.0f, 1.0f, 0.0f, "param1a");
     88 		configParam(PARAM2A_PARAM, 0.0f, 1.0f, 0.0f, "param2a");
     89 		configParam(PARAM3A_PARAM, 0.0f, 1.0f, 0.0f, "param3a");
     90 		configParam(PARAM1B_PARAM, 0.0f, 1.0f, 0.0f, "param1b");
     91 		configParam(PARAM2B_PARAM, 0.0f, 1.0f, 0.0f, "param2b");
     92 		configParam(PARAM3B_PARAM, 0.0f, 1.0f, 0.0f, "param3b");
     93 	}
     94 
     95 	void reset() override;
     96 	void processAll(const ProcessArgs& args) override;
     97 	// float oscillatorPitch1A();
     98 };
     99 
    100 } // namespace bogaudio