feat: Add external clock tick handler to reset sequencer or register tick based on clock source.
This commit is contained in:
@ -251,6 +251,23 @@ void ProcessSequencerTick(uint32_t tick) {
|
||||
}
|
||||
}
|
||||
|
||||
void HandleExtClockTick() {
|
||||
switch (selected_source) {
|
||||
case Clock::SOURCE_INTERNAL:
|
||||
case Clock::SOURCE_EXTERNAL_MIDI:
|
||||
// Use EXT as Reset when not used for clock source.
|
||||
for (int i = 0; i < 6; i++) {
|
||||
gravity.outputs[i].Low();
|
||||
}
|
||||
gravity.clock.Reset();
|
||||
current_step = 0;
|
||||
break;
|
||||
default:
|
||||
// Register EXT clock tick.
|
||||
gravity.clock.Tick();
|
||||
}
|
||||
}
|
||||
|
||||
void OnPlayPress() {
|
||||
if (!gravity.clock.IsPaused()) {
|
||||
gravity.clock.Stop();
|
||||
@ -604,6 +621,7 @@ void setup() {
|
||||
gravity.encoder.AttachPressRotateHandler(OnEncoderPressRotate);
|
||||
|
||||
gravity.clock.AttachIntHandler(ProcessSequencerTick);
|
||||
gravity.clock.AttachExtHandler(HandleExtClockTick);
|
||||
// Default to 120 BPM internal
|
||||
gravity.clock.SetTempo(120);
|
||||
gravity.clock.SetSource(Clock::SOURCE_INTERNAL);
|
||||
|
||||
Reference in New Issue
Block a user