BogaudioModules

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

EightOne.hpp (1854B)


      1 #pragma once
      2 
      3 #include "bogaudio.hpp"
      4 #include "addressable_sequence.hpp"
      5 #include "dsp/signal.hpp"
      6 
      7 using namespace bogaudio::dsp;
      8 
      9 extern Model* modelEightOne;
     10 
     11 namespace bogaudio {
     12 
     13 struct EightOne : AddressableSequenceModule {
     14 	enum ParamsIds {
     15 		STEPS_PARAM,
     16 		DIRECTION_PARAM,
     17 		SELECT_PARAM,
     18 		NUM_PARAMS
     19 	};
     20 
     21 	enum InputsIds {
     22 		IN1_INPUT,
     23 		IN2_INPUT,
     24 		IN3_INPUT,
     25 		IN4_INPUT,
     26 		IN5_INPUT,
     27 		IN6_INPUT,
     28 		IN7_INPUT,
     29 		IN8_INPUT,
     30 		CLOCK_INPUT,
     31 		RESET_INPUT,
     32 		SELECT_INPUT,
     33 		NUM_INPUTS
     34 	};
     35 
     36 	enum OutputsIds {
     37 		OUT_OUTPUT,
     38 		NUM_OUTPUTS
     39 	};
     40 
     41 	enum LightsIds {
     42 		IN1_LIGHT,
     43 		IN2_LIGHT,
     44 		IN3_LIGHT,
     45 		IN4_LIGHT,
     46 		IN5_LIGHT,
     47 		IN6_LIGHT,
     48 		IN7_LIGHT,
     49 		IN8_LIGHT,
     50 		NUM_LIGHTS
     51 	};
     52 
     53 	float _lightSums[8] {};
     54 
     55 	EightOne() {
     56 		config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
     57 		configParam(STEPS_PARAM, 1.0f, 8.0f, 8.0f, "Steps");
     58 		paramQuantities[STEPS_PARAM]->snapEnabled = true;
     59 		configSwitch(DIRECTION_PARAM, 0.0f, 1.0f, 1.0f, "Direction", {"Reverse", "Forward"});
     60 		configParam(SELECT_PARAM, 0.0f, 7.0f, 0.0f, "Select step");
     61 		paramQuantities[SELECT_PARAM]->snapEnabled = true;
     62 		setInputIDs(CLOCK_INPUT, SELECT_INPUT);
     63 		configBypass(IN1_INPUT, OUT_OUTPUT);
     64 
     65 		configInput(IN1_INPUT, "Signal 1");
     66 		configInput(IN2_INPUT, "Signal 2");
     67 		configInput(IN3_INPUT, "Signal 3");
     68 		configInput(IN4_INPUT, "Signal 4");
     69 		configInput(IN5_INPUT, "Signal 5");
     70 		configInput(IN6_INPUT, "Signal 6");
     71 		configInput(IN7_INPUT, "Signal 7");
     72 		configInput(IN8_INPUT, "Signal 8");
     73 		configInput(CLOCK_INPUT, "Clock");
     74 		configInput(RESET_INPUT, "Reset");
     75 		configInput(SELECT_INPUT, "Select CV");
     76 
     77 		configOutput(OUT_OUTPUT, "Signal");
     78 	}
     79 
     80 	void processAlways(const ProcessArgs& args) override;
     81 	void processChannel(const ProcessArgs& args, int c) override;
     82 	void postProcessAlways(const ProcessArgs& args) override;
     83 };
     84 
     85 } // namespace bogaudio