aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-01-08 12:07:58 +0100
committerBad Diode <bd@badd10de.dev>2024-01-08 12:07:58 +0100
commitf6e253b14f7b4930f5a5e6e1d3ee2bd3009802dd (patch)
treeff76f0a8b12264a41cd39b498af7a91fe105a6b2
parent666135619b653accd72e940d4405871c6c5f453b (diff)
downloadstepper-f6e253b14f7b4930f5a5e6e1d3ee2bd3009802dd.tar.gz
stepper-f6e253b14f7b4930f5a5e6e1d3ee2bd3009802dd.zip
Make sure the current scale is saved as metadata
-rw-r--r--Makefile2
-rw-r--r--src/main.c5
-rw-r--r--src/save.h2
-rw-r--r--src/sequencer.c50
4 files changed, 48 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 0938c31..144c978 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS))
27INC_FLAGS += -I$(LIBGBA_SRC) 27INC_FLAGS += -I$(LIBGBA_SRC)
28 28
29# Output library names and executables. 29# Output library names and executables.
30TARGET := STEPPER-v1.8-dev-07 30TARGET := STEPPER-v1.8-dev-08
31ELF := $(BUILD_DIR)/$(TARGET).elf 31ELF := $(BUILD_DIR)/$(TARGET).elf
32BIN := $(BUILD_DIR)/$(TARGET).gba 32BIN := $(BUILD_DIR)/$(TARGET).gba
33 33
diff --git a/src/main.c b/src/main.c
index 597f01d..1fdaaa2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,9 +21,8 @@ WITH REGARD TO THIS SOFTWARE.
21// + Channel params should show if there are some already on all triggers and 21// + Channel params should show if there are some already on all triggers and
22// modify only the selected parameter, not all of them. 22// modify only the selected parameter, not all of them.
23// + Channel params (ALL) editing should only copy the value under the cursor. 23// + Channel params (ALL) editing should only copy the value under the cursor.
24// - Fix scale being active for noise channel (makes no sense) 24// + Fix scale being active for noise channel (makes no sense)
25// - Should scale mode be toggleable? 25// + Save scale on metadata
26// - Save scale on the bank
27// - Hold L/R retriggers at short intervals? 26// - Hold L/R retriggers at short intervals?
28// - Allow using B + dpad to nudge trigs. This will potentially mean switching 27// - Allow using B + dpad to nudge trigs. This will potentially mean switching
29// to key release to enable trigs. 28// to key release to enable trigs.
diff --git a/src/save.h b/src/save.h
index ccc190b..170e40f 100644
--- a/src/save.h
+++ b/src/save.h
@@ -11,6 +11,8 @@ typedef struct Metadata {
11 u32 initialized; 11 u32 initialized;
12 int current_bank; 12 int current_bank;
13 int current_pattern; 13 int current_pattern;
14 int current_scale;
15 int current_scale_root;
14 Settings settings; 16 Settings settings;
15} Metadata; 17} Metadata;
16 18
diff --git a/src/sequencer.c b/src/sequencer.c
index fed33cb..ee72389 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -107,9 +107,6 @@ select_bank(int i) {
107 if (settings.auto_save) { 107 if (settings.auto_save) {
108 save_bank(current_bank); 108 save_bank(current_bank);
109 } 109 }
110 metadata.current_pattern = current_pattern;
111 metadata.current_bank = i;
112 save_metadata();
113 if (current_bank != i) { 110 if (current_bank != i) {
114 load_bank(i); 111 load_bank(i);
115 } 112 }
@@ -123,6 +120,11 @@ select_bank(int i) {
123 current_pattern = 0; 120 current_pattern = 0;
124 next_pattern = 0; 121 next_pattern = 0;
125 } 122 }
123 metadata.current_scale = current_scale;
124 metadata.current_scale_root = current_scale_root;
125 metadata.current_pattern = current_pattern;
126 metadata.current_bank = i;
127 save_metadata();
126 current_bank = i; 128 current_bank = i;
127 redraw_pattern_buttons = true; 129 redraw_pattern_buttons = true;
128 redraw_trigs = true; 130 redraw_trigs = true;
@@ -454,7 +456,14 @@ handle_channel_selection(void) {
454 case 3: { trig = &pat->ch4.notes[i]; } break; 456 case 3: { trig = &pat->ch4.notes[i]; } break;
455 default: {trig = &pat->ch1.notes[i]; } break; 457 default: {trig = &pat->ch1.notes[i]; } break;
456 } 458 }
457 trig->note = scale_note(trig->note, inc); 459 if (channel_selection_loc == 3) {
460 int tmp = current_scale;
461 current_scale = 0;
462 trig->note = scale_note(trig->note, inc);
463 current_scale = tmp;
464 } else {
465 trig->note = scale_note(trig->note, inc);
466 }
458 } 467 }
459 redraw_trigs = true; 468 redraw_trigs = true;
460 } else if (key_tap(KEY_R)) { 469 } else if (key_tap(KEY_R)) {
@@ -471,7 +480,14 @@ handle_channel_selection(void) {
471 case 3: { trig = &pat->ch4.notes[i]; } break; 480 case 3: { trig = &pat->ch4.notes[i]; } break;
472 default: {trig = &pat->ch1.notes[i]; } break; 481 default: {trig = &pat->ch1.notes[i]; } break;
473 } 482 }
474 trig->note = scale_note(trig->note, inc); 483 if (channel_selection_loc == 3) {
484 int tmp = current_scale;
485 current_scale = 0;
486 trig->note = scale_note(trig->note, inc);
487 current_scale = tmp;
488 } else {
489 trig->note = scale_note(trig->note, inc);
490 }
475 } 491 }
476 redraw_trigs = true; 492 redraw_trigs = true;
477 } 493 }
@@ -1493,7 +1509,14 @@ handle_trigger_selection(void) {
1493 } 1509 }
1494 // Decrease note. 1510 // Decrease note.
1495 if (trig->active && !empty) { 1511 if (trig->active && !empty) {
1496 trig->note = scale_note(trig->note, inc); 1512 if (channel_selection_loc == 3) {
1513 int tmp = current_scale;
1514 current_scale = 0;
1515 trig->note = scale_note(trig->note, inc);
1516 current_scale = tmp;
1517 } else {
1518 trig->note = scale_note(trig->note, inc);
1519 }
1497 } 1520 }
1498 redraw_trigs = true; 1521 redraw_trigs = true;
1499 } else if (key_tap(KEY_R)) { 1522 } else if (key_tap(KEY_R)) {
@@ -1503,7 +1526,14 @@ handle_trigger_selection(void) {
1503 } 1526 }
1504 // Increase note. 1527 // Increase note.
1505 if (trig->active && !empty) { 1528 if (trig->active && !empty) {
1506 trig->note = scale_note(trig->note, inc); 1529 if (channel_selection_loc == 3) {
1530 int tmp = current_scale;
1531 current_scale = 0;
1532 trig->note = scale_note(trig->note, inc);
1533 current_scale = tmp;
1534 } else {
1535 trig->note = scale_note(trig->note, inc);
1536 }
1507 } 1537 }
1508 redraw_trigs = true; 1538 redraw_trigs = true;
1509 } 1539 }
@@ -1584,6 +1614,10 @@ void
1584handle_sequencer_input(void) { 1614handle_sequencer_input(void) {
1585 if (key_tap(KEY_START)) { 1615 if (key_tap(KEY_START)) {
1586 if (key_hold(KEY_SELECT)) { 1616 if (key_hold(KEY_SELECT)) {
1617 metadata.current_bank = current_bank;
1618 metadata.current_pattern = current_pattern;
1619 metadata.current_scale = current_scale;
1620 metadata.current_scale_root = current_scale_root;
1587 save_bank(current_bank); 1621 save_bank(current_bank);
1588 save_metadata(); 1622 save_metadata();
1589 send_notif("SAVED BANK"); 1623 send_notif("SAVED BANK");
@@ -1682,6 +1716,8 @@ sequencer_init(void) {
1682 current_pattern = metadata.current_pattern; 1716 current_pattern = metadata.current_pattern;
1683 next_pattern = metadata.current_pattern; 1717 next_pattern = metadata.current_pattern;
1684 pattern_selection_loc = current_pattern; 1718 pattern_selection_loc = current_pattern;
1719 current_scale = metadata.current_scale;
1720 current_scale_root = metadata.current_scale_root;
1685 settings = metadata.settings; 1721 settings = metadata.settings;
1686 load_bank(metadata.current_bank); 1722 load_bank(metadata.current_bank);
1687 } 1723 }