diff options
-rw-r--r-- | src/drawing.c | 33 | ||||
-rw-r--r-- | src/globals.c | 60 | ||||
-rw-r--r-- | src/main.c | 28 | ||||
-rw-r--r-- | src/sequencer.c | 17 |
4 files changed, 110 insertions, 28 deletions
diff --git a/src/drawing.c b/src/drawing.c index 3922e09..3aa5de8 100644 --- a/src/drawing.c +++ b/src/drawing.c | |||
@@ -409,8 +409,7 @@ draw_scale() { | |||
409 | draw_rect(x, y, x + R_COL_W - 2, y + SCALE_H - 3, COL_FG); | 409 | draw_rect(x, y, x + R_COL_W - 2, y + SCALE_H - 3, COL_FG); |
410 | txt_drawf_small("SCALE", x + 3, y - 10, COL_FG); | 410 | txt_drawf_small("SCALE", x + 3, y - 10, COL_FG); |
411 | 411 | ||
412 | // TODO: Switch for different scales here | 412 | txt_drawf(scale_short[current_scale], x + 2, y + 2, COL_FG); |
413 | txt_drawf("CHRM", x + 2, y + 2, COL_FG); | ||
414 | } | 413 | } |
415 | 414 | ||
416 | void | 415 | void |
@@ -1657,6 +1656,36 @@ draw_notif_bar() { | |||
1657 | } | 1656 | } |
1658 | return; | 1657 | return; |
1659 | } | 1658 | } |
1659 | if (input_handler == handle_right_col_selection) { | ||
1660 | switch (right_col_selection_loc) { | ||
1661 | case R_COL_BANK_A: { txt_drawf_small("BANK A", x0 + 2, y0 + 1, color); } break; | ||
1662 | case R_COL_BANK_B: { txt_drawf_small("BANK B", x0 + 2, y0 + 1, color); } break; | ||
1663 | case R_COL_BANK_C: { txt_drawf_small("BANK C", x0 + 2, y0 + 1, color); } break; | ||
1664 | case R_COL_BANK_D: { txt_drawf_small("BANK D", x0 + 2, y0 + 1, color); } break; | ||
1665 | case R_COL_BANK_E: { txt_drawf_small("BANK E", x0 + 2, y0 + 1, color); } break; | ||
1666 | case R_COL_BANK_F: { txt_drawf_small("BANK F", x0 + 2, y0 + 1, color); } break; | ||
1667 | case R_COL_STOP: { | ||
1668 | txt_drawf_small("STOP", x0 + 2, y0 + 1, color); | ||
1669 | } break; | ||
1670 | case R_COL_PLAY: { | ||
1671 | if (play_status == 0) { | ||
1672 | txt_drawf_small("PLAY", x0 + 2, y0 + 1, color); | ||
1673 | } else { | ||
1674 | txt_drawf_small("PAUSE", x0 + 2, y0 + 1, color); | ||
1675 | } | ||
1676 | } break; | ||
1677 | case R_COL_SETTINGS: { | ||
1678 | txt_drawf_small("SETTINGS", x0 + 2, y0 + 1, color); | ||
1679 | } break; | ||
1680 | case R_COL_SCALE: { | ||
1681 | txt_drawf_small("SCALE: %s", x0 + 2, y0 + 1, color, scale_long[current_scale]); | ||
1682 | } break; | ||
1683 | case R_COL_BPM: { | ||
1684 | txt_drawf_small("TEMPO: %d bpm", x0 + 2, y0 + 1, color, patterns[pattern_selection_loc].bpm); | ||
1685 | } break; | ||
1686 | } | ||
1687 | return; | ||
1688 | } | ||
1660 | 1689 | ||
1661 | if (chain.len != 0) { | 1690 | if (chain.len != 0) { |
1662 | u8 x = x0 + 2; | 1691 | u8 x = x0 + 2; |
diff --git a/src/globals.c b/src/globals.c index 23012c8..a971120 100644 --- a/src/globals.c +++ b/src/globals.c | |||
@@ -189,3 +189,63 @@ typedef enum Prob { | |||
189 | PROB_20, | 189 | PROB_20, |
190 | PROB_NUM, | 190 | PROB_NUM, |
191 | } Prob; | 191 | } Prob; |
192 | |||
193 | typedef enum Scales { | ||
194 | SCALE_CHRM, | ||
195 | SCALE_MAJR, | ||
196 | SCALE_MINR, | ||
197 | SCALE_PMAJ, | ||
198 | SCALE_PMIN, | ||
199 | SCALE_BLUE, | ||
200 | SCALE_DORI, | ||
201 | SCALE_PHYR, | ||
202 | SCALE_LYDI, | ||
203 | SCALE_MIXO, | ||
204 | SCALE_LOCR, | ||
205 | SCALE_PERS, | ||
206 | SCALE_HMIN, | ||
207 | SCALE_IWAT, | ||
208 | SCALE_INSN, | ||
209 | SCALE_HIRA, | ||
210 | SCALE_NUM, | ||
211 | } Scales; | ||
212 | |||
213 | char *scale_short[] = { | ||
214 | "CHRM", | ||
215 | "MAJR", | ||
216 | "MINR", | ||
217 | "PMAJ", | ||
218 | "PMIN", | ||
219 | "BLUE", | ||
220 | "DORI", | ||
221 | "PHYR", | ||
222 | "LYDI", | ||
223 | "MIXO", | ||
224 | "LOCR", | ||
225 | "PERS", | ||
226 | "HMIN", | ||
227 | "IWAT", | ||
228 | "INSN", | ||
229 | "HIRA", | ||
230 | }; | ||
231 | |||
232 | char *scale_long[] = { | ||
233 | "CHROMATIC", | ||
234 | "MAJOR", | ||
235 | "MINOR", | ||
236 | "PENTATONIC MAJOR", | ||
237 | "PENTATONIC MINOR", | ||
238 | "BLUES", | ||
239 | "DORIAN", | ||
240 | "PHYRGIAN", | ||
241 | "LYDIAN", | ||
242 | "MIXOLYDIAN", | ||
243 | "LOCRIAN", | ||
244 | "PERSIAN", | ||
245 | "HUNGARIAN MINOR", | ||
246 | "IWATO", | ||
247 | "IN-SEN", | ||
248 | "HIRAJOSHI", | ||
249 | }; | ||
250 | |||
251 | int current_scale = SCALE_CHRM; | ||
@@ -66,28 +66,6 @@ WITH REGARD TO THIS SOFTWARE. | |||
66 | // later. | 66 | // later. |
67 | // | 67 | // |
68 | 68 | ||
69 | // NOTE: (by catbeats) | ||
70 | // | ||
71 | // SCALES: | ||
72 | // | ||
73 | // CHRM - CHROMATIC | ||
74 | // MAJR - MAJOR (Ionian) | ||
75 | // MINR - MINOR (Aeolian) | ||
76 | // PMAJ - PENT MAJOR | ||
77 | // PMIN - PENT MINOR | ||
78 | // BLUE - BLUES | ||
79 | // DORI - DORIAN | ||
80 | // PHYR - PHYRGIAN | ||
81 | // LYDI - LYDIAN | ||
82 | // MIXO - MIXOLYDIAN | ||
83 | // LOCR - LOCRIAN | ||
84 | // PERS - PERSIAN | ||
85 | // HMIN - HUNGARIAN MINOR | ||
86 | // IWAT - IWATO | ||
87 | // INSN - IN-SEN | ||
88 | // HIRA - HIRAJOSHI | ||
89 | // | ||
90 | |||
91 | #include "gba/gba.h" | 69 | #include "gba/gba.h" |
92 | 70 | ||
93 | #include "renderer_m0.c" | 71 | #include "renderer_m0.c" |
@@ -124,11 +102,13 @@ render_sequencer(void) { | |||
124 | if (redraw_play_pause) { | 102 | if (redraw_play_pause) { |
125 | PROF(draw_play(), draw_btn_cycles); | 103 | PROF(draw_play(), draw_btn_cycles); |
126 | PROF(draw_stop(), draw_btn_cycles); | 104 | PROF(draw_stop(), draw_btn_cycles); |
127 | // TODO: Move to separate if condition | ||
128 | PROF(draw_settings(), draw_btn_cycles); | 105 | PROF(draw_settings(), draw_btn_cycles); |
129 | PROF(draw_scale(), draw_btn_cycles); | ||
130 | redraw_play_pause = false; | 106 | redraw_play_pause = false; |
131 | } | 107 | } |
108 | if (redraw_scale) { | ||
109 | PROF(draw_scale(), draw_btn_cycles); | ||
110 | redraw_scale = false; | ||
111 | } | ||
132 | if (redraw_piano_note) { | 112 | if (redraw_piano_note) { |
133 | PROF(draw_piano_notes(), draw_piano_cycles); | 113 | PROF(draw_piano_notes(), draw_piano_cycles); |
134 | redraw_piano_note = false; | 114 | redraw_piano_note = false; |
diff --git a/src/sequencer.c b/src/sequencer.c index 04dd848..ce09658 100644 --- a/src/sequencer.c +++ b/src/sequencer.c | |||
@@ -16,6 +16,7 @@ bool redraw_bank_buttons = true; | |||
16 | bool redraw_params = true; | 16 | bool redraw_params = true; |
17 | bool redraw_bpm = true; | 17 | bool redraw_bpm = true; |
18 | bool redraw_piano_note = true; | 18 | bool redraw_piano_note = true; |
19 | bool redraw_scale = true; | ||
19 | bool update_bpm = false; | 20 | bool update_bpm = false; |
20 | u8 bar_counter = 0; | 21 | u8 bar_counter = 0; |
21 | 22 | ||
@@ -677,7 +678,13 @@ handle_right_col_selection(void) { | |||
677 | clear_pattern(pattern_selection_loc); | 678 | clear_pattern(pattern_selection_loc); |
678 | } | 679 | } |
679 | } break; | 680 | } break; |
680 | // TODO: Scale. | 681 | case R_COL_SCALE: { |
682 | current_scale--; | ||
683 | if (current_scale < 0) { | ||
684 | current_scale = SCALE_NUM - 1; | ||
685 | } | ||
686 | redraw_scale = true; | ||
687 | } break; | ||
681 | } | 688 | } |
682 | } else if (key_tap(KEY_R)) { | 689 | } else if (key_tap(KEY_R)) { |
683 | switch (right_col_selection_loc) { | 690 | switch (right_col_selection_loc) { |
@@ -699,7 +706,13 @@ handle_right_col_selection(void) { | |||
699 | clear_pattern(pattern_selection_loc); | 706 | clear_pattern(pattern_selection_loc); |
700 | } | 707 | } |
701 | } break; | 708 | } break; |
702 | // TODO: Scale. | 709 | case R_COL_SCALE: { |
710 | current_scale++; | ||
711 | if (current_scale >= SCALE_NUM) { | ||
712 | current_scale = 0; | ||
713 | } | ||
714 | redraw_scale = true; | ||
715 | } break; | ||
703 | } | 716 | } |
704 | } else if (key_tap(KEY_B)) { | 717 | } else if (key_tap(KEY_B)) { |
705 | switch (right_col_selection_loc) { | 718 | switch (right_col_selection_loc) { |