33
44Matrix_sequencer::Matrix_sequencer () : _current_step(0 , 0 , 0 ), _run(true ), _reset(false )
55{
6+ _sequence_algorithms = {
7+ new LeftRight_UpDown (),
8+ new SpiralSequence ()
9+ };
10+
611 {
712 config (PARAMS_LEN, INPUTS_LEN, OUTPUTS_LEN, LIGHTS_LEN);
813 configParam (X1_Y1_KNOB_PARAM, -10 .f , 10 .f , 0 .f , " (1; 1)" , " V" );
@@ -21,9 +26,11 @@ Matrix_sequencer::Matrix_sequencer() : _current_step(0, 0, 0), _run(true), _rese
2126 configParam (X2_Y4_KNOB_PARAM, -10 .f , 10 .f , 0 .f , " (2; 4)" , " V" );
2227 configParam (X3_Y4_KNOB_PARAM, -10 .f , 10 .f , 0 .f , " (3; 4)" , " V" );
2328 configParam (X4_Y4_KNOB_PARAM, -10 .f , 10 .f , 0 .f , " (4; 4)" , " V" );
29+ configParam (ALGORITHM_KNOB_PARAM, 0 .f , _sequence_algorithms.size () - 1 , 0 .f , " Algorithm" );
2430 configInput (CLOCK_IN_INPUT, " Clock" );
2531 configInput (RUN_IN_INPUT, " Start sequence" );
2632 configInput (RESET_IN_INPUT, " Reset sequence" );
33+ configInput (ALGORITHM_FM_INPUT, " Control algorithms" );
2734 configOutput (Y1_OUT_OUTPUT, " Out Y:1" );
2835 configOutput (Y2_OUT_OUTPUT, " Out Y:2" );
2936 configOutput (Y3_OUT_OUTPUT, " Out Y:3" );
@@ -34,6 +41,15 @@ Matrix_sequencer::Matrix_sequencer() : _current_step(0, 0, 0), _run(true), _rese
3441 configOutput (X4_OUT_OUTPUT, " Out X:4" );
3542 configOutput (TOTAL_PITCH_OUT_OUTPUT, " Sequence output" );
3643 }
44+
45+ paramQuantities[ALGORITHM_KNOB_PARAM]->snapEnabled = true ;
46+ }
47+
48+
49+ Matrix_sequencer::~Matrix_sequencer ()
50+ {
51+ for (auto alg_ptr : _sequence_algorithms)
52+ delete alg_ptr;
3753}
3854
3955
@@ -59,7 +75,8 @@ void Matrix_sequencer::process(const ProcessArgs& args)
5975 lights[translateCoords ()].setBrightness (0 );
6076
6177 // ------------ Current Step = chosen callback algorithm ------------//
62- _current_step = static_cast <sequence_t >(SequnceAlgorithm_base (_current_step));
78+ // _current_step = static_cast<sequence_t>(SequnceAlgorithm_base(_current_step));
79+ _sequence_algorithms.at (params[ALGORITHM_KNOB_PARAM].getValue ())->callback (_current_step);
6380 float param_voltage = params[translateCoords ()].getValue ();
6481
6582 outputs[_current_step.y ].setVoltage (param_voltage);
@@ -78,7 +95,8 @@ inline uint8_t Matrix_sequencer::translateCoords()
7895}
7996
8097
81- Matrix_sequencerWidget::Matrix_sequencerWidget (Matrix_sequencer* module ) {
98+ Matrix_sequencerWidget::Matrix_sequencerWidget (Matrix_sequencer* module )
99+ {
82100 setModule (module );
83101 setPanel (createPanel (asset::plugin (pluginInstance, " res/matrix-sequencer.svg" )));
84102
@@ -87,53 +105,56 @@ Matrix_sequencerWidget::Matrix_sequencerWidget(Matrix_sequencer* module) {
87105 addChild (createWidget<ScrewSilver>(Vec (RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
88106 addChild (createWidget<ScrewSilver>(Vec (box.size .x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
89107
90- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (35.56 , 20.32 )), module , Matrix_sequencer::X1_Y1_KNOB_PARAM));
91- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (63.5 , 20.32 )), module , Matrix_sequencer::X2_Y1_KNOB_PARAM));
92- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (91.44 , 20.32 )), module , Matrix_sequencer::X3_Y1_KNOB_PARAM));
93- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (119.38 , 20.32 )), module , Matrix_sequencer::X4_Y1_KNOB_PARAM));
94- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (35.56 , 43.18 )), module , Matrix_sequencer::X1_Y2_KNOB_PARAM));
95- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (63.5 , 43.18 )), module , Matrix_sequencer::X2_Y2_KNOB_PARAM));
96- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (91.44 , 43.18 )), module , Matrix_sequencer::X3_Y2_KNOB_PARAM));
97- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (119.38 , 43.18 )), module , Matrix_sequencer::X4_Y2_KNOB_PARAM));
98- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (35.56 , 66.04 )), module , Matrix_sequencer::X1_Y3_KNOB_PARAM));
99- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (63.5 , 66.04 )), module , Matrix_sequencer::X2_Y3_KNOB_PARAM));
100- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (91.44 , 66.04 )), module , Matrix_sequencer::X3_Y3_KNOB_PARAM));
101- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (119.38 , 66.04 )), module , Matrix_sequencer::X4_Y3_KNOB_PARAM));
102- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (35.56 , 88.9 )), module , Matrix_sequencer::X1_Y4_KNOB_PARAM));
103- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (63.5 , 88.9 )), module , Matrix_sequencer::X2_Y4_KNOB_PARAM));
104- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (91.44 , 88.9 )), module , Matrix_sequencer::X3_Y4_KNOB_PARAM));
105- addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (119.38 , 88.9 )), module , Matrix_sequencer::X4_Y4_KNOB_PARAM));
106-
107- addInput (createInputCentered<PJ301MPort>(mm2px (Vec (12.7 , 25.4 )), module , Matrix_sequencer::CLOCK_IN_INPUT));
108- addInput (createInputCentered<PJ301MPort>(mm2px (Vec (12.7 , 43.18 )), module , Matrix_sequencer::RUN_IN_INPUT));
109- addInput (createInputCentered<PJ301MPort>(mm2px (Vec (12.7 , 60.96 )), module , Matrix_sequencer::RESET_IN_INPUT));
110-
111- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (137.16 , 20.32 )), module , Matrix_sequencer::Y1_OUT_OUTPUT));
112- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (137.16 , 43.18 )), module , Matrix_sequencer::Y2_OUT_OUTPUT));
113- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (137.16 , 66.04 )), module , Matrix_sequencer::Y3_OUT_OUTPUT));
114- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (137.16 , 88.9 )), module , Matrix_sequencer::Y4_OUT_OUTPUT));
115- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (35.56 , 119.38 )), module , Matrix_sequencer::X1_OUT_OUTPUT));
116- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (63.5 , 119.38 )), module , Matrix_sequencer::X2_OUT_OUTPUT));
117- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (91.44 , 119.38 )), module , Matrix_sequencer::X3_OUT_OUTPUT));
118- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (119.38 , 119.38 )), module , Matrix_sequencer::X4_OUT_OUTPUT));
119- addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (137.16 , 119.38 )), module , Matrix_sequencer::TOTAL_PITCH_OUT_OUTPUT));
120-
121- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (35.56 , 31.75 )), module , Matrix_sequencer::X1_Y1_LIGHT_LIGHT));
122- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (63.5 , 31.75 )), module , Matrix_sequencer::X2_Y1_LIGHT_LIGHT));
123- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (91.44 , 31.75 )), module , Matrix_sequencer::X3_Y1_LIGHT_LIGHT));
124- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (119.38 , 31.75 )), module , Matrix_sequencer::X4_Y1_LIGHT_LIGHT));
125- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (35.56 , 54.61 )), module , Matrix_sequencer::X1_Y2_LIGHT_LIGHT));
126- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (63.5 , 54.61 )), module , Matrix_sequencer::X2_Y2_LIGHT_LIGHT));
127- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (91.44 , 54.61 )), module , Matrix_sequencer::X3_Y2_LIGHT_LIGHT));
128- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (119.38 , 54.61 )), module , Matrix_sequencer::X4_Y2_LIGHT_LIGHT));
129- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (35.56 , 77.47 )), module , Matrix_sequencer::X1_Y3_LIGHT_LIGHT));
130- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (63.5 , 77.47 )), module , Matrix_sequencer::X2_Y3_LIGHT_LIGHT));
131- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (91.44 , 77.47 )), module , Matrix_sequencer::X3_Y3_LIGHT_LIGHT));
132- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (119.38 , 77.47 )), module , Matrix_sequencer::X4_Y3_LIGHT_LIGHT));
133- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (35.56 , 100.33 )), module , Matrix_sequencer::X1_Y4_LIGHT_LIGHT));
134- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (63.5 , 100.33 )), module , Matrix_sequencer::X2_Y4_LIGHT_LIGHT));
135- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (91.44 , 100.33 )), module , Matrix_sequencer::X3_Y4_LIGHT_LIGHT));
136- addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (119.38 , 100.33 )), module , Matrix_sequencer::X4_Y4_LIGHT_LIGHT));
108+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (43.18 , 20.32 )), module , Matrix_sequencer::X1_Y1_KNOB_PARAM));
109+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (71.12 , 20.32 )), module , Matrix_sequencer::X2_Y1_KNOB_PARAM));
110+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (99.06 , 20.32 )), module , Matrix_sequencer::X3_Y1_KNOB_PARAM));
111+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (127.0 , 20.32 )), module , Matrix_sequencer::X4_Y1_KNOB_PARAM));
112+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (43.18 , 43.18 )), module , Matrix_sequencer::X1_Y2_KNOB_PARAM));
113+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (71.12 , 43.18 )), module , Matrix_sequencer::X2_Y2_KNOB_PARAM));
114+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (99.06 , 43.18 )), module , Matrix_sequencer::X3_Y2_KNOB_PARAM));
115+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (127.0 , 43.18 )), module , Matrix_sequencer::X4_Y2_KNOB_PARAM));
116+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (43.18 , 66.04 )), module , Matrix_sequencer::X1_Y3_KNOB_PARAM));
117+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (71.12 , 66.04 )), module , Matrix_sequencer::X2_Y3_KNOB_PARAM));
118+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (99.06 , 66.04 )), module , Matrix_sequencer::X3_Y3_KNOB_PARAM));
119+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (127.0 , 66.04 )), module , Matrix_sequencer::X4_Y3_KNOB_PARAM));
120+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (43.18 , 88.9 )), module , Matrix_sequencer::X1_Y4_KNOB_PARAM));
121+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (71.12 , 88.9 )), module , Matrix_sequencer::X2_Y4_KNOB_PARAM));
122+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (99.06 , 88.9 )), module , Matrix_sequencer::X3_Y4_KNOB_PARAM));
123+ addParam (createParamCentered<RoundBlackKnob>(mm2px (Vec (127.0 , 88.9 )), module , Matrix_sequencer::X4_Y4_KNOB_PARAM));
124+
125+ addParam (createParamCentered<RoundHugeBlackKnob>(mm2px (Vec (20.32 , 88.9 )), module , Matrix_sequencer::ALGORITHM_KNOB_PARAM));
126+
127+ addInput (createInputCentered<PJ301MPort>(mm2px (Vec (20.32 , 25.4 )), module , Matrix_sequencer::CLOCK_IN_INPUT));
128+ addInput (createInputCentered<PJ301MPort>(mm2px (Vec (20.32 , 43.18 )), module , Matrix_sequencer::RUN_IN_INPUT));
129+ addInput (createInputCentered<PJ301MPort>(mm2px (Vec (20.32 , 60.96 )), module , Matrix_sequencer::RESET_IN_INPUT));
130+ addInput (createInputCentered<PJ301MPort>(mm2px (Vec (20.32 , 73.66 )), module , Matrix_sequencer::ALGORITHM_FM_INPUT));
131+
132+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (144.78 , 20.32 )), module , Matrix_sequencer::Y1_OUT_OUTPUT));
133+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (144.78 , 43.18 )), module , Matrix_sequencer::Y2_OUT_OUTPUT));
134+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (144.78 , 66.04 )), module , Matrix_sequencer::Y3_OUT_OUTPUT));
135+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (144.78 , 88.9 )), module , Matrix_sequencer::Y4_OUT_OUTPUT));
136+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (43.18 , 119.38 )), module , Matrix_sequencer::X1_OUT_OUTPUT));
137+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (71.12 , 119.38 )), module , Matrix_sequencer::X2_OUT_OUTPUT));
138+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (99.06 , 119.38 )), module , Matrix_sequencer::X3_OUT_OUTPUT));
139+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (127.0 , 119.38 )), module , Matrix_sequencer::X4_OUT_OUTPUT));
140+ addOutput (createOutputCentered<PJ301MPort>(mm2px (Vec (144.78 , 119.38 )), module , Matrix_sequencer::TOTAL_PITCH_OUT_OUTPUT));
141+
142+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (43.18 , 31.75 )), module , Matrix_sequencer::X1_Y1_LIGHT_LIGHT));
143+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (71.12 , 31.75 )), module , Matrix_sequencer::X2_Y1_LIGHT_LIGHT));
144+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (99.06 , 31.75 )), module , Matrix_sequencer::X3_Y1_LIGHT_LIGHT));
145+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (127.0 , 31.75 )), module , Matrix_sequencer::X4_Y1_LIGHT_LIGHT));
146+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (43.18 , 54.61 )), module , Matrix_sequencer::X1_Y2_LIGHT_LIGHT));
147+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (71.12 , 54.61 )), module , Matrix_sequencer::X2_Y2_LIGHT_LIGHT));
148+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (99.06 , 54.61 )), module , Matrix_sequencer::X3_Y2_LIGHT_LIGHT));
149+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (127.0 , 54.61 )), module , Matrix_sequencer::X4_Y2_LIGHT_LIGHT));
150+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (43.18 , 77.47 )), module , Matrix_sequencer::X1_Y3_LIGHT_LIGHT));
151+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (71.12 , 77.47 )), module , Matrix_sequencer::X2_Y3_LIGHT_LIGHT));
152+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (99.06 , 77.47 )), module , Matrix_sequencer::X3_Y3_LIGHT_LIGHT));
153+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (127.0 , 77.47 )), module , Matrix_sequencer::X4_Y3_LIGHT_LIGHT));
154+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (43.18 , 100.33 )), module , Matrix_sequencer::X1_Y4_LIGHT_LIGHT));
155+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (71.12 , 100.33 )), module , Matrix_sequencer::X2_Y4_LIGHT_LIGHT));
156+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (99.06 , 100.33 )), module , Matrix_sequencer::X3_Y4_LIGHT_LIGHT));
157+ addChild (createLightCentered<MediumLight<GreenLight>>(mm2px (Vec (127.0 , 100.33 )), module , Matrix_sequencer::X4_Y4_LIGHT_LIGHT));
137158}
138159
139160
0 commit comments