44Matrix_sequencer::Matrix_sequencer () : _current_step(0 , 0 , 0 ), _run(true ), _reset(false )
55{
66 _sequence_algorithms = {
7+ new StraightSequence (),
78 new LeftRight_UpDown (),
89 new SpiralSequence ()
910 };
@@ -43,6 +44,7 @@ Matrix_sequencer::Matrix_sequencer() : _current_step(0, 0, 0), _run(true), _rese
4344 }
4445
4546 paramQuantities[ALGORITHM_KNOB_PARAM ]->snapEnabled = true ;
47+ _algorithm_type = params[ALGORITHM_KNOB_PARAM ].getValue ();
4648}
4749
4850
@@ -68,15 +70,26 @@ void Matrix_sequencer::process(const ProcessArgs& args)
6870 _current_step = {0 , 0 , 0 };
6971 }
7072
73+ _algorithm_type = params[ALGORITHM_KNOB_PARAM ].getValue ();
74+ if (inputs[ALGORITHM_FM_INPUT ].isConnected ())
75+ {
76+ _algorithm_type = std::ceil (inputs[ALGORITHM_FM_INPUT ].getVoltage ());
77+
78+ if (_algorithm_type >= _sequence_algorithms.size ())
79+ _algorithm_type = _sequence_algorithms.size () - 1 ;
80+
81+ if (_algorithm_type < 0 )
82+ _algorithm_type = 0 ;
83+ }
84+
7185 // Process trigger clock
7286 if (clockTrigger.process (inputs[CLOCK_IN_INPUT ].getVoltage ()))
7387 {
7488 // Turn off current light
7589 lights[translateCoords ()].setBrightness (0 );
7690
7791 // ------------ Current Step = chosen callback algorithm ------------//
78- // _current_step = static_cast<sequence_t>(SequnceAlgorithm_base(_current_step));
79- _sequence_algorithms.at (params[ALGORITHM_KNOB_PARAM ].getValue ())->callback (_current_step);
92+ _sequence_algorithms.at (_algorithm_type)->callback (_current_step);
8093 float param_voltage = params[translateCoords ()].getValue ();
8194
8295 outputs[_current_step.y ].setVoltage (param_voltage);
0 commit comments