diff options
author | Bad Diode <bd@badd10de.dev> | 2024-01-06 16:35:53 +0100 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2024-01-06 16:35:53 +0100 |
commit | fcef6e404587accd09439739a7e660f1d94069a1 (patch) | |
tree | fe48b5a60f41374ac9f7a2368c3ebaf74658e472 /src/sequencer.c | |
parent | a5f47ed59a29486c7ad3ee60811c5928862b24f8 (diff) | |
download | stepper-fcef6e404587accd09439739a7e660f1d94069a1.tar.gz stepper-fcef6e404587accd09439739a7e660f1d94069a1.zip |
Add more sync in options
Diffstat (limited to 'src/sequencer.c')
-rw-r--r-- | src/sequencer.c | 53 |
1 files changed, 49 insertions, 4 deletions
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) { | |||
362 | 362 | ||
363 | void | 363 | void |
364 | set_time(int bpm) { | 364 | set_time(int bpm) { |
365 | if (settings.sync == SYNC_IN_LINK) { | 365 | if (settings.sync == SYNC_IN_LINK_96BPQ || |
366 | settings.sync == SYNC_IN_LINK_48BPQ || | ||
367 | settings.sync == SYNC_IN_LINK_24BPQ || | ||
368 | settings.sync == SYNC_IN_LINK_12BPQ || | ||
369 | settings.sync == SYNC_IN_LINK_4BPQ) { | ||
366 | return; | 370 | return; |
367 | } | 371 | } |
368 | // We use a high resolution 96 PPQ clock for sequencing. With the following | 372 | // We use a high resolution 96 PPQ clock for sequencing. With the following |
@@ -552,7 +556,11 @@ toggle_playing(void) { | |||
552 | current_pattern = next_pattern; | 556 | current_pattern = next_pattern; |
553 | } | 557 | } |
554 | 558 | ||
555 | if (settings.sync == SYNC_IN_LINK) { | 559 | if (settings.sync == SYNC_IN_LINK_96BPQ || |
560 | settings.sync == SYNC_IN_LINK_48BPQ || | ||
561 | settings.sync == SYNC_IN_LINK_24BPQ || | ||
562 | settings.sync == SYNC_IN_LINK_12BPQ || | ||
563 | settings.sync == SYNC_IN_LINK_4BPQ) { | ||
556 | return; | 564 | return; |
557 | } | 565 | } |
558 | 566 | ||
@@ -1503,17 +1511,54 @@ handle_sequencer_input(void) { | |||
1503 | } | 1511 | } |
1504 | 1512 | ||
1505 | void | 1513 | void |
1506 | serial_irq(void) { | 1514 | sync_in_96(void) { |
1507 | if (play_status) { | 1515 | if (play_status) { |
1508 | // 12bpq -> 96bpq? | 1516 | sequencer_tick(); |
1517 | } | ||
1518 | } | ||
1519 | |||
1520 | void | ||
1521 | sync_in_48(void) { | ||
1522 | if (play_status) { | ||
1523 | // 48bpq -> 96bpq. | ||
1524 | sequencer_tick(); | ||
1525 | sequencer_tick(); | ||
1526 | } | ||
1527 | } | ||
1528 | |||
1529 | void | ||
1530 | sync_in_24(void) { | ||
1531 | if (play_status) { | ||
1532 | // 24bpq -> 96bpq. | ||
1533 | sequencer_tick(); | ||
1509 | sequencer_tick(); | 1534 | sequencer_tick(); |
1510 | sequencer_tick(); | 1535 | sequencer_tick(); |
1511 | sequencer_tick(); | 1536 | sequencer_tick(); |
1537 | } | ||
1538 | } | ||
1539 | |||
1540 | void | ||
1541 | sync_in_12(void) { | ||
1542 | if (play_status) { | ||
1543 | // 12bpq -> 96bpq. | ||
1544 | sequencer_tick(); | ||
1545 | sequencer_tick(); | ||
1512 | sequencer_tick(); | 1546 | sequencer_tick(); |
1513 | sequencer_tick(); | 1547 | sequencer_tick(); |
1514 | sequencer_tick(); | 1548 | sequencer_tick(); |
1515 | sequencer_tick(); | 1549 | sequencer_tick(); |
1516 | sequencer_tick(); | 1550 | sequencer_tick(); |
1551 | sequencer_tick(); | ||
1552 | } | ||
1553 | } | ||
1554 | |||
1555 | void | ||
1556 | sync_in_4(void) { | ||
1557 | if (play_status) { | ||
1558 | // 4bpq -> 96bpq. | ||
1559 | for (size_t i = 0; i < 24; i++) { | ||
1560 | sequencer_tick(); | ||
1561 | } | ||
1517 | } | 1562 | } |
1518 | } | 1563 | } |
1519 | 1564 | ||