shithub: orca

Download patch

ref: 92e5e0aa579d2701f98843a85419f915c8474c5c
parent: caa7de59ba7bf67e6e4f7a34703cc676a2943ab2
author: cancel <cancel@cancel.fm>
date: Sun Dec 9 15:54:42 EST 2018

Add better play/pause timing control

--- a/tui_main.c
+++ b/tui_main.c
@@ -940,12 +940,12 @@
     if (a->is_playing) {
       app_stop_all_sustained_notes(a);
       a->is_playing = false;
-      // nodelay(stdscr, FALSE);
+      a->accum_secs = 0.0;
     } else {
       a->is_playing = true;
-      // nodelay(stdscr, TRUE);
+      // dumb'n'dirty, get us close to the next step time, but not quite
+      a->accum_secs = 60.0 / (double)a->bpm / 4.0 - 0.02;
     }
-    a->accum_secs = 0.0;
     a->is_draw_dirty = true;
     break;
   case App_input_cmd_toggle_show_event_list:
@@ -1256,6 +1256,9 @@
       break;
     case ' ':
       app_input_cmd(&app_state, App_input_cmd_toggle_play_pause);
+      // flush lap time -- quick hack to prevent time before hitting spacebar
+      // to play being applied as actual playback time
+      stm_laptime(&last_time);
       break;
     default:
       if (key >= '!' && key <= '~') {