Here are the basics:
The UpdateSequencer() function runs in the loop.
The CheckUserInput() function reads the state of the buttons and the encoders and updates whatever parameter they are assigned to.
bool masterModeButtonState = digitalHw.GetDigitalState(MASTER_SLAVE_BUTTON);
the call to GetDigitalState returns the actual hardware state of each button and the parameter is the digital hardware ID, from 0 to the number of digitals your controller has.
A bit later:
seqSettings[currentSequencer].steps[step].currentNote = encoderHw.GetEncoderValue(NOTE_ENCODER);
Which is the same thing but for encoders.
You have a similar function as the
GetDigitalState() for the encoder switches which is
And also you have
GetEncoderSwitchValue(encoderIndex) which instead of giving you the physical state, will return the state of the input, which may differ to the physical state in the case of toggle configured switches or buttons.
To set feedback for the buttons you can use the following function:
feedbackHw.SetChangeDigitalFeedback(MASTER_SLAVE_BUTTON, MASTER_MODE_COLOR, true, NO_SHIFTER, NO_BANK_UPDATE);
- 1st parameter is the button ID
- 2nd parameter is the value for the feedback, for example the color table index in case of buttons that have their feedback set to Value to Color
- 3rd parameter is true for turning it ON and false for turning the LED off (might be some redundancy there, but for now it works like this)
- 4th and 5th parameters you’ll want to use NO_SHIFTER and NO_BANK_UPDATE most of the time.
The comms.ino file contains the handlers for the Clock, Start, Stop, etc messages which might come handy if you want to set your sequencer as slave.