shithub: orca

Download patch

ref: 4e0c819f565a0d18fa926390a2cc5e704284ab43
parent: c3bca186defd79c9609290d26623c1d6972f21de
author: cancel <cancel@cancel.fm>
date: Sun Jan 6 19:09:24 EST 2019

Add sending /orca/bpm n over OSC

--- a/tui_main.c
+++ b/tui_main.c
@@ -869,6 +869,14 @@
   oosc_send_int32s(oosc_dev, osc_address, NULL, 0);
 }
 
+void send_num_message(Oosc_dev* oosc_dev, char const* osc_address, I32 num) {
+  if (!oosc_dev)
+    return;
+  I32 nums[1];
+  nums[0] = num;
+  oosc_send_int32s(oosc_dev, osc_address, nums, ORCA_ARRAY_COUNTOF(nums));
+}
+
 void apply_time_to_sustained_notes(Oosc_dev* oosc_dev,
                                    Midi_mode const* midi_mode,
                                    double time_elapsed,
@@ -1201,6 +1209,7 @@
   if ((Usz)new_bpm != a->bpm) {
     a->bpm = (Usz)new_bpm;
     a->is_draw_dirty = true;
+    send_num_message(a->oosc_dev, "/orca/bpm", (I32)new_bpm);
   }
 }
 
@@ -2036,6 +2045,9 @@
   int key = KEY_RESIZE;
   wtimeout(stdscr, 0);
   int cur_timeout = 0;
+
+  // Send initial BPM
+  send_num_message(ged_state.oosc_dev, "/orca/bpm", (I32)ged_state.bpm);
 
   for (;;) {
     switch (key) {