shithub: dumb

Download patch

ref: 5698ac532ffe1e01f7e23a476a6ea52341276b26
parent: 01f8ce4b56e460057d6cca3bfc2d58e3600300aa
author: Chris Moeller <kode54@gmail.com>
date: Mon Jul 22 15:28:15 EDT 2013

Fixed envelope loop timing

--- a/dumb/src/it/itrender.c
+++ b/dumb/src/it/itrender.c
@@ -3854,7 +3854,7 @@
 	recalculate_it_envelope_node(pe, envelope);
 
 	if ((envelope->flags & IT_ENVELOPE_SUSTAIN_LOOP) && !(playing->flags & IT_PLAYING_SUSTAINOFF)) {
-		if (pe->tick >= envelope->node_t[envelope->sus_loop_end]) {
+		if (pe->tick > envelope->node_t[envelope->sus_loop_end]) {
 			pe->next_node = envelope->sus_loop_start;
 			ASSERT(pe->next_node < envelope->n_nodes);
 			pe->tick = envelope->node_t[envelope->sus_loop_start];
@@ -3861,7 +3861,7 @@
 			return 0;
 		}
 	} else if (envelope->flags & IT_ENVELOPE_LOOP_ON) {
-		if (pe->tick >= envelope->node_t[envelope->loop_end]) {
+		if (pe->tick > envelope->node_t[envelope->loop_end]) {
 			pe->next_node = envelope->loop_start;
 			ASSERT(pe->next_node < envelope->n_nodes);
 			pe->tick = envelope->node_t[envelope->loop_start];
@@ -3868,7 +3868,7 @@
 			return 0;
 		}
 	}
-	else if (pe->tick >= envelope->node_t[envelope->n_nodes - 1])
+	else if (pe->tick > envelope->node_t[envelope->n_nodes - 1])
 		return 1;
 
 	return 0;