shithub: orca

Download patch

ref: 9ba5f22caf52b2dfce8deeab4271f2923a0287c2
parent: 96fd8182ad24e3eb429c971664cf39e7f5f2e1f2
author: cancel <cancel@cancel.fm>
date: Fri Dec 7 17:21:54 EST 2018

Add more timing stuff

--- a/tui_main.c
+++ b/tui_main.c
@@ -514,7 +514,7 @@
 
 double app_secs_to_deadline(App_state const* a) {
   if (a->is_playing) {
-    double secs_span = 60.0 / (double)a->bpm;
+    double secs_span = 60.0 / (double)a->bpm / 4.0;
     double rem = secs_span - a->accum_secs;
     if (rem < 0.0)
       rem = 0.0;
@@ -531,7 +531,7 @@
 }
 
 void app_do_stuff(App_state* a) {
-  double secs_span = 60.0 / (double)a->bpm;
+  double secs_span = 60.0 / (double)a->bpm / 4.0;
   while (a->accum_secs > secs_span) {
     a->accum_secs -= secs_span;
     undo_history_push(&a->undo_hist, &a->field, a->tick_num);
@@ -872,16 +872,16 @@
       app_apply_delta_secs(&app_state, stm_sec(diff));
       double secs_to_d = app_secs_to_deadline(&app_state);
       // fprintf(stderr, "to deadline: %f\n", secs_to_d);
-      if (secs_to_d < ms_to_sec(1.0)) {
+      if (secs_to_d < ms_to_sec(0.5)) {
         wtimeout(stdscr, 0);
       } else if (secs_to_d < ms_to_sec(3.0)) {
         wtimeout(stdscr, 1);
       } else if (secs_to_d < ms_to_sec(10.0)) {
-        wtimeout(stdscr, 5);
+        wtimeout(stdscr, 1);
       } else if (secs_to_d < ms_to_sec(50.0)) {
         wtimeout(stdscr, 10);
       } else {
-        wtimeout(stdscr, 20);
+        wtimeout(stdscr, 10);
       }
       //struct timespec ts;
       //ts.tv_sec = 0;