From 20b1b448b7a1c8e22cb2e0f2d6294533f7a220af Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Wed, 12 Jul 2023 18:24:46 +0200 Subject: Add a notification system and use it for save/copy/paste events --- src/sequencer.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/sequencer.c') diff --git a/src/sequencer.c b/src/sequencer.c index 5120805..a22c219 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -998,12 +998,37 @@ handle_trigger_selection(void) { } } +void +send_notif(char *msg) { + if (msg == NULL) { + return; + } + + char buf[32] = {0}; + size_t n_chars = 0; + for (size_t i = 0; i < 32; i++) { + if (*msg == '\0') { + break; + } + buf[i] = *msg++; + n_chars++; + } + if (n_chars == 0) { + return; + } + notif.time = NOTIF_TIME; + for (size_t i = 0; i < 32; i++) { + notif.msg[i] = buf[i]; + } +} + void handle_sequencer_input(void) { if (key_tap(KEY_START)) { if (key_hold(KEY_SELECT)) { save_bank(current_bank); save_metadata(); + send_notif("SAVED BANK"); return; } // Stop the sequencer or start playing from the beginning. -- cgit v1.2.1