shithub: orca

Download patch

ref: 7555f772947dfad2031fbac96dc566a1a6aaa891
parent: 92e5e0aa579d2701f98843a85419f915c8474c5c
author: cancel <cancel@cancel.fm>
date: Sun Dec 9 16:05:08 EST 2018

Add clamp to amount of buffered delta time

--- a/tui_main.c
+++ b/tui_main.c
@@ -734,6 +734,10 @@
   double secs_span = 60.0 / (double)a->bpm / 4.0;
   Oosc_dev* oosc_dev = a->oosc_dev;
   Midi_mode const* midi_mode = a->midi_mode;
+  // Clamp to 1 second of buffered play time, in case the process get frozen,
+  // we don't want to play back a ton of steps all at once.
+  if (a->accum_secs > 1.0)
+    a->accum_secs = 1.0;
   while (a->accum_secs > secs_span) {
     a->accum_secs -= secs_span;
     undo_history_push(&a->undo_hist, &a->field, a->tick_num);