BogaudioModules

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

Matrix44Cvm.hpp (3293B)


      1 #pragma once
      2 
      3 #include "Matrix44_shared.hpp"
      4 
      5 namespace bogaudio {
      6 
      7 typedef ChainableExpanderModule<Matrix44ExpanderMessage, Matrix44Element, 1, MutesMatrixExpanderModule> Matrix44CvmBase;
      8 
      9 struct Matrix44Cvm : Matrix44CvmBase {
     10 	enum ParamsIds {
     11 		MUTE11_PARAM,
     12 		MUTE21_PARAM,
     13 		MUTE31_PARAM,
     14 		MUTE41_PARAM,
     15 		MUTE12_PARAM,
     16 		MUTE22_PARAM,
     17 		MUTE32_PARAM,
     18 		MUTE42_PARAM,
     19 		MUTE13_PARAM,
     20 		MUTE23_PARAM,
     21 		MUTE33_PARAM,
     22 		MUTE43_PARAM,
     23 		MUTE14_PARAM,
     24 		MUTE24_PARAM,
     25 		MUTE34_PARAM,
     26 		MUTE44_PARAM,
     27 		NUM_PARAMS
     28 	};
     29 
     30 	enum InputsIds {
     31 		CV11_INPUT,
     32 		CV21_INPUT,
     33 		CV31_INPUT,
     34 		CV41_INPUT,
     35 		CV12_INPUT,
     36 		CV22_INPUT,
     37 		CV32_INPUT,
     38 		CV42_INPUT,
     39 		CV13_INPUT,
     40 		CV23_INPUT,
     41 		CV33_INPUT,
     42 		CV43_INPUT,
     43 		CV14_INPUT,
     44 		CV24_INPUT,
     45 		CV34_INPUT,
     46 		CV44_INPUT,
     47 		NUM_INPUTS
     48 	};
     49 
     50 	enum OutputsIds {
     51 		NUM_OUTPUTS
     52 	};
     53 
     54 	Param** _mutes = NULL;
     55 	Input** _cvs = NULL;
     56 
     57 	Matrix44Cvm() {
     58 		const std::vector<std::string> muteLabels = {"Unmuted", "Muted", "Soloed", "Soloed"};
     59 		config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
     60 		configSwitch(MUTE11_PARAM, 0.0f, 3.0f, 0.0f, "Mute 1A", muteLabels);
     61 		configSwitch(MUTE21_PARAM, 0.0f, 3.0f, 0.0f, "Mute 2A", muteLabels);
     62 		configSwitch(MUTE31_PARAM, 0.0f, 3.0f, 0.0f, "Mute 3A", muteLabels);
     63 		configSwitch(MUTE41_PARAM, 0.0f, 3.0f, 0.0f, "Mute 4A", muteLabels);
     64 		configSwitch(MUTE12_PARAM, 0.0f, 3.0f, 0.0f, "Mute 1B", muteLabels);
     65 		configSwitch(MUTE22_PARAM, 0.0f, 3.0f, 0.0f, "Mute 2B", muteLabels);
     66 		configSwitch(MUTE32_PARAM, 0.0f, 3.0f, 0.0f, "Mute 3B", muteLabels);
     67 		configSwitch(MUTE42_PARAM, 0.0f, 3.0f, 0.0f, "Mute 4B", muteLabels);
     68 		configSwitch(MUTE13_PARAM, 0.0f, 3.0f, 0.0f, "Mute 1C", muteLabels);
     69 		configSwitch(MUTE23_PARAM, 0.0f, 3.0f, 0.0f, "Mute 2C", muteLabels);
     70 		configSwitch(MUTE33_PARAM, 0.0f, 3.0f, 0.0f, "Mute 3C", muteLabels);
     71 		configSwitch(MUTE43_PARAM, 0.0f, 3.0f, 0.0f, "Mute 4C", muteLabels);
     72 		configSwitch(MUTE14_PARAM, 0.0f, 3.0f, 0.0f, "Mute 1D", muteLabels);
     73 		configSwitch(MUTE24_PARAM, 0.0f, 3.0f, 0.0f, "Mute 2D", muteLabels);
     74 		configSwitch(MUTE34_PARAM, 0.0f, 3.0f, 0.0f, "Mute 3D", muteLabels);
     75 		configSwitch(MUTE44_PARAM, 0.0f, 3.0f, 0.0f, "Mute 4D", muteLabels);
     76 
     77 		configInput(CV11_INPUT, "Level 1A CV");
     78 		configInput(CV21_INPUT, "Level 2A CV");
     79 		configInput(CV31_INPUT, "Level 3A CV");
     80 		configInput(CV41_INPUT, "Level 4A CV");
     81 		configInput(CV12_INPUT, "Level 1B CV");
     82 		configInput(CV22_INPUT, "Level 2B CV");
     83 		configInput(CV32_INPUT, "Level 3B CV");
     84 		configInput(CV42_INPUT, "Level 4B CV");
     85 		configInput(CV13_INPUT, "Level 1C CV");
     86 		configInput(CV23_INPUT, "Level 2C CV");
     87 		configInput(CV33_INPUT, "Level 3C CV");
     88 		configInput(CV43_INPUT, "Level 4C CV");
     89 		configInput(CV14_INPUT, "Level 1D CV");
     90 		configInput(CV24_INPUT, "Level 2D CV");
     91 		configInput(CV34_INPUT, "Level 3D CV");
     92 		configInput(CV44_INPUT, "Level 4D CV");
     93 
     94 		_mutes = new Param*[16];
     95 		_cvs = new Input*[16];
     96 		for (int i = 0; i < 16; ++i) {
     97 			_mutes[i] = &params[MUTE11_PARAM + i];
     98 			_cvs[i] = &inputs[CV11_INPUT + i];
     99 		}
    100 		setLocalElements({new Matrix44Element(_mutes, _cvs, &_soloByColumns)});
    101 		setBaseModelPredicate([](Model* m) { return m == modelMatrix44; });
    102 	}
    103 	virtual ~Matrix44Cvm() {
    104 		delete[] _mutes;
    105 		delete[] _cvs;
    106 	}
    107 
    108 	void processAlways(const ProcessArgs& args) override;
    109 };
    110 
    111 } // namespace bogaudio