shithub: pt2-clone

Download patch

ref: f2d56f6798a787634070d839dfa7abc52d1b42c1
parent: 0699e2c43053653db63616e42ae2080ffd2dc73c
author: Olav Sørensen <olav.sorensen@live.no>
date: Thu Aug 12 09:01:21 EDT 2021

Fixed: Tempo was off by a tiny fraction (BPM -> CIA period -> Hz calc.)

--- a/src/pt2_audio.c
+++ b/src/pt2_audio.c
@@ -845,7 +845,7 @@
 		return 0.0;
 
 	const uint32_t ciaPeriod = 1773447 / bpm; // yes, PT truncates here
-	return (double)CIA_PAL_CLK / ciaPeriod;
+	return (double)CIA_PAL_CLK / (ciaPeriod+1); // +1, CIA triggers on underflow
 }
 
 static void generateBpmTables(bool vblankTimingFlag)