diff options
Diffstat (limited to 'src/sequencer.c')
-rw-r--r-- | src/sequencer.c | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/src/sequencer.c b/src/sequencer.c index f3dff04..07f3012 100644 --- a/src/sequencer.c +++ b/src/sequencer.c | |||
@@ -8,17 +8,6 @@ | |||
8 | 8 | ||
9 | void set_time(int bpm); | 9 | void set_time(int bpm); |
10 | 10 | ||
11 | bool redraw_pattern_buttons = true; | ||
12 | bool redraw_play_pause = true; | ||
13 | bool redraw_trigs = true; | ||
14 | bool redraw_channels = true; | ||
15 | bool redraw_bank_buttons = true; | ||
16 | bool redraw_params = true; | ||
17 | bool redraw_bpm = true; | ||
18 | bool redraw_scale = true; | ||
19 | bool update_bpm = false; | ||
20 | u8 bar_counter = 0; | ||
21 | |||
22 | void | 11 | void |
23 | clear_pattern(size_t idx) { | 12 | clear_pattern(size_t idx) { |
24 | Pattern *pat = &patterns[idx]; | 13 | Pattern *pat = &patterns[idx]; |
@@ -121,7 +110,9 @@ select_bank(int i) { | |||
121 | next_pattern = 0; | 110 | next_pattern = 0; |
122 | next_bank = i; | 111 | next_bank = i; |
123 | clipboard.type = CLIP_EMPTY; | 112 | clipboard.type = CLIP_EMPTY; |
124 | save_bank(current_bank); | 113 | if (settings.auto_save) { |
114 | save_bank(current_bank); | ||
115 | } | ||
125 | metadata.current_pattern = current_pattern; | 116 | metadata.current_pattern = current_pattern; |
126 | metadata.current_bank = i; | 117 | metadata.current_bank = i; |
127 | save_metadata(); | 118 | save_metadata(); |
@@ -552,7 +543,11 @@ toggle_playing(void) { | |||
552 | if (current_bank != next_bank) { | 543 | if (current_bank != next_bank) { |
553 | select_bank(next_bank); | 544 | select_bank(next_bank); |
554 | } | 545 | } |
555 | set_time(patterns[current_pattern].bpm); | 546 | if (settings.global_bpm) { |
547 | set_time(settings.bpm); | ||
548 | } else { | ||
549 | set_time(patterns[current_pattern].bpm); | ||
550 | } | ||
556 | play_step(); | 551 | play_step(); |
557 | } else { | 552 | } else { |
558 | TIMER_CTRL_2 ^= TIMER_CTRL_ENABLE; | 553 | TIMER_CTRL_2 ^= TIMER_CTRL_ENABLE; |
@@ -590,7 +585,11 @@ pause_playing(void) { | |||
590 | current_pattern = next_pattern; | 585 | current_pattern = next_pattern; |
591 | redraw_pattern_buttons = true; | 586 | redraw_pattern_buttons = true; |
592 | } | 587 | } |
593 | set_time(patterns[current_pattern].bpm); | 588 | if (settings.global_bpm) { |
589 | set_time(settings.bpm); | ||
590 | } else { | ||
591 | set_time(patterns[current_pattern].bpm); | ||
592 | } | ||
594 | play_step(); | 593 | play_step(); |
595 | } else { | 594 | } else { |
596 | TIMER_CTRL_2 ^= TIMER_CTRL_ENABLE; | 595 | TIMER_CTRL_2 ^= TIMER_CTRL_ENABLE; |
@@ -666,13 +665,18 @@ handle_right_col_selection(void) { | |||
666 | if (key_pressed(KEY_SELECT)) { | 665 | if (key_pressed(KEY_SELECT)) { |
667 | bpm_inc = -10; | 666 | bpm_inc = -10; |
668 | } | 667 | } |
669 | patterns[pattern_selection_loc].bpm = CLAMP( | 668 | if (settings.global_bpm) { |
670 | patterns[pattern_selection_loc].bpm + bpm_inc, | 669 | settings.bpm = CLAMP(settings.bpm + bpm_inc, 10, 300); |
671 | 10, | 670 | } else { |
672 | 300); | 671 | patterns[pattern_selection_loc].bpm = CLAMP(patterns[pattern_selection_loc].bpm + bpm_inc, 10, 300); |
672 | } | ||
673 | if ((TIMER_CTRL_2 & TIMER_CTRL_ENABLE) != 0 | 673 | if ((TIMER_CTRL_2 & TIMER_CTRL_ENABLE) != 0 |
674 | && current_pattern == pattern_selection_loc) { | 674 | && current_pattern == pattern_selection_loc) { |
675 | set_time(patterns[current_pattern].bpm); | 675 | if (settings.global_bpm) { |
676 | set_time(settings.bpm); | ||
677 | } else { | ||
678 | set_time(patterns[current_pattern].bpm); | ||
679 | } | ||
676 | } | 680 | } |
677 | redraw_bpm = true; | 681 | redraw_bpm = true; |
678 | if (patterns[pattern_selection_loc].empty) { | 682 | if (patterns[pattern_selection_loc].empty) { |
@@ -701,13 +705,18 @@ handle_right_col_selection(void) { | |||
701 | if (key_pressed(KEY_SELECT)) { | 705 | if (key_pressed(KEY_SELECT)) { |
702 | bpm_inc = 10; | 706 | bpm_inc = 10; |
703 | } | 707 | } |
704 | patterns[pattern_selection_loc].bpm = CLAMP( | 708 | if (settings.global_bpm) { |
705 | patterns[pattern_selection_loc].bpm + bpm_inc, | 709 | settings.bpm = CLAMP(settings.bpm + bpm_inc, 10, 300); |
706 | 10, | 710 | } else { |
707 | 300); | 711 | patterns[pattern_selection_loc].bpm = CLAMP(patterns[pattern_selection_loc].bpm + bpm_inc, 10, 300); |
712 | } | ||
708 | if ((TIMER_CTRL_2 & TIMER_CTRL_ENABLE) != 0 | 713 | if ((TIMER_CTRL_2 & TIMER_CTRL_ENABLE) != 0 |
709 | && current_pattern == pattern_selection_loc) { | 714 | && current_pattern == pattern_selection_loc) { |
710 | set_time(patterns[current_pattern].bpm); | 715 | if (settings.global_bpm) { |
716 | set_time(settings.bpm); | ||
717 | } else { | ||
718 | set_time(patterns[current_pattern].bpm); | ||
719 | } | ||
711 | } | 720 | } |
712 | redraw_bpm = true; | 721 | redraw_bpm = true; |
713 | if (patterns[pattern_selection_loc].empty) { | 722 | if (patterns[pattern_selection_loc].empty) { |