aboutsummaryrefslogtreecommitdiffstats
path: root/src/sequencer.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-07-12 18:24:46 +0200
committerBad Diode <bd@badd10de.dev>2023-07-12 18:24:46 +0200
commit20b1b448b7a1c8e22cb2e0f2d6294533f7a220af (patch)
treee9a6c30530ec6d222e778d83f6f6bca49d0ca378 /src/sequencer.c
parentd2be261b88753c3e0fdeb7588057aa3f1648ead5 (diff)
downloadstepper-20b1b448b7a1c8e22cb2e0f2d6294533f7a220af.tar.gz
stepper-20b1b448b7a1c8e22cb2e0f2d6294533f7a220af.zip
Add a notification system and use it for save/copy/paste events
Diffstat (limited to 'src/sequencer.c')
-rw-r--r--src/sequencer.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sequencer.c b/src/sequencer.c
index 5120805..a22c219 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -999,11 +999,36 @@ handle_trigger_selection(void) {
999} 999}
1000 1000
1001void 1001void
1002send_notif(char *msg) {
1003 if (msg == NULL) {
1004 return;
1005 }
1006
1007 char buf[32] = {0};
1008 size_t n_chars = 0;
1009 for (size_t i = 0; i < 32; i++) {
1010 if (*msg == '\0') {
1011 break;
1012 }
1013 buf[i] = *msg++;
1014 n_chars++;
1015 }
1016 if (n_chars == 0) {
1017 return;
1018 }
1019 notif.time = NOTIF_TIME;
1020 for (size_t i = 0; i < 32; i++) {
1021 notif.msg[i] = buf[i];
1022 }
1023}
1024
1025void
1002handle_sequencer_input(void) { 1026handle_sequencer_input(void) {
1003 if (key_tap(KEY_START)) { 1027 if (key_tap(KEY_START)) {
1004 if (key_hold(KEY_SELECT)) { 1028 if (key_hold(KEY_SELECT)) {
1005 save_bank(current_bank); 1029 save_bank(current_bank);
1006 save_metadata(); 1030 save_metadata();
1031 send_notif("SAVED BANK");
1007 return; 1032 return;
1008 } 1033 }
1009 // Stop the sequencer or start playing from the beginning. 1034 // Stop the sequencer or start playing from the beginning.