From f3653bcd920edd33e0a991d57661532624176f01 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 25 Apr 2023 17:56:21 +0200 Subject: Implement buttons --- x1k2-midi-osc.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/x1k2-midi-osc.c b/x1k2-midi-osc.c index 3f6c263..3a4f476 100644 --- a/x1k2-midi-osc.c +++ b/x1k2-midi-osc.c @@ -33,6 +33,23 @@ int fine_vals[] = {0, 0, 0, 0, 0, 0}; int fine_encoders[] = {1, 2, 3, 4, 101, 102}; int num_fine = 6; +int buttons[] = {48, 49, 50, 51, + 44, 45, 46, 47, + 40, 41, 42, 43, + 36, 37, 38, 39, + 32, 33, 34, 35, + 28, 29, 30, 31, + 24, 25, 26, 27, + 12, 15}; +int button_numbers[] = {5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16, + 17, 18, 19, 20, + 21, 22, 23, 24, + 25, 26, 27, 28, + 29, 30, 31, 32, + 101, 102}; +int num_buttons = 34; static void show_help(const char *s) { @@ -151,30 +168,17 @@ static void handle_note_off(int note, int vel, lo_address osc_send_addr) static void handle_note(int note, int vel, lo_address osc_send_addr) { - printf("note %i, vel %i\n", note, vel); - switch ( note ) { - - case 26: - lo_send(osc_send_addr, "/starlet/selection/clear", ""); - break; - - case 32: - lo_send(osc_send_addr, "/starlet/selection/mhLL", ""); - break; - - case 33: - lo_send(osc_send_addr, "/starlet/selection/mhL", ""); - break; - - case 34: - lo_send(osc_send_addr, "/starlet/selection/mhR", ""); - break; - - case 35: - lo_send(osc_send_addr, "/starlet/selection/mhRR", ""); - break; int i; + for ( i=0; i