shithub: orca

Download patch

ref: 8806da103f79d2f5e37a2297df19f59e995ac9a4
parent: 307928cf2e734cf11befa1c1d922930ae40f524b
author: cancel <cancel@cancel.fm>
date: Fri Dec 7 09:09:39 EST 2018

Add start of using midi events in tui

--- a/sim.c
+++ b/sim.c
@@ -425,7 +425,7 @@
 
 BEGIN_SOLO_PHASE_0(midi)
   BEGIN_ACTIVE_PORTS
-    for (Usz i = 1; 1 < 6; ++i) {
+    for (Usz i = 1; i < 6; ++i) {
       PORT(0, (Isz)i, IN);
     }
   END_PORTS
@@ -1056,5 +1056,6 @@
   bank_cursor_reset(&phase1_extras.cursor);
   phase1_extras.vars_slots = &vars_slots[0];
   phase1_extras.piano_bits = piano_bits;
+  phase1_extras.oevent_list = oevent_list;
   sim_phase_1(gbuf, mbuf, height, width, tick_number, &phase1_extras);
 }
--- a/tui_main.c
+++ b/tui_main.c
@@ -358,6 +358,16 @@
     tc->x = width - 1;
 }
 
+void tdraw_oevent_list(WINDOW* win, int win_h, int win_w, int pos_y, int pos_x,
+                       Oevent_list const* oevent_list) {
+  (void)win;
+  (void)win_h;
+  (void)win_w;
+  (void)pos_y;
+  (void)pos_x;
+  (void)oevent_list;
+}
+
 void tui_resize_grid(Field* field, Markmap_reusable* markmap, Usz new_height,
                      Usz new_width, Usz tick_num, Field* scratch_field,
                      Undo_history* undo_hist, Tui_cursor* tui_cursor,
@@ -569,6 +579,7 @@
   Usz ruler_spacing_x = 8;
   bool is_playing = false;
   bool needs_remarking = true;
+  bool draw_event_list = false;
   for (;;) {
     int term_height = getmaxy(stdscr);
     int term_width = getmaxx(stdscr);
@@ -632,6 +643,9 @@
                 field.height, field.width, ruler_spacing_y, ruler_spacing_x,
                 tick_num, &tui_cursor, input_mode);
     }
+    if (draw_event_list) {
+      tdraw_oevent_list(cont_win, content_h, content_w, 0, 0, &oevent_list);
+    }
     wrefresh(cont_win);
 
     int key;
@@ -731,6 +745,9 @@
       ++tick_num;
       piano_bits = ORCA_PIANO_BITS_NONE;
       needs_remarking = true;
+      break;
+    case AND_CTRL('e'):
+      draw_event_list = !draw_event_list;
       break;
     case ' ':
       if (is_playing) {