From fcef6e404587accd09439739a7e660f1d94069a1 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sat, 6 Jan 2024 16:35:53 +0100 Subject: Add more sync in options --- src/sequencer.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'src/sequencer.c') diff --git a/src/sequencer.c b/src/sequencer.c index 9f7f1ad..e452822 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -362,7 +362,11 @@ sequencer_tick(void) { void set_time(int bpm) { - if (settings.sync == SYNC_IN_LINK) { + if (settings.sync == SYNC_IN_LINK_96BPQ || + settings.sync == SYNC_IN_LINK_48BPQ || + settings.sync == SYNC_IN_LINK_24BPQ || + settings.sync == SYNC_IN_LINK_12BPQ || + settings.sync == SYNC_IN_LINK_4BPQ) { return; } // We use a high resolution 96 PPQ clock for sequencing. With the following @@ -552,7 +556,11 @@ toggle_playing(void) { current_pattern = next_pattern; } - if (settings.sync == SYNC_IN_LINK) { + if (settings.sync == SYNC_IN_LINK_96BPQ || + settings.sync == SYNC_IN_LINK_48BPQ || + settings.sync == SYNC_IN_LINK_24BPQ || + settings.sync == SYNC_IN_LINK_12BPQ || + settings.sync == SYNC_IN_LINK_4BPQ) { return; } @@ -1503,17 +1511,54 @@ handle_sequencer_input(void) { } void -serial_irq(void) { +sync_in_96(void) { if (play_status) { - // 12bpq -> 96bpq? + sequencer_tick(); + } +} + +void +sync_in_48(void) { + if (play_status) { + // 48bpq -> 96bpq. + sequencer_tick(); + sequencer_tick(); + } +} + +void +sync_in_24(void) { + if (play_status) { + // 24bpq -> 96bpq. + sequencer_tick(); sequencer_tick(); sequencer_tick(); sequencer_tick(); + } +} + +void +sync_in_12(void) { + if (play_status) { + // 12bpq -> 96bpq. + sequencer_tick(); + sequencer_tick(); sequencer_tick(); sequencer_tick(); sequencer_tick(); sequencer_tick(); sequencer_tick(); + sequencer_tick(); + } +} + +void +sync_in_4(void) { + if (play_status) { + // 4bpq -> 96bpq. + for (size_t i = 0; i < 24; i++) { + sequencer_tick(); + } } } -- cgit v1.2.1