commit 3fea9dd32dab91503bd948a3ac2ef0111533edb7
parent 178bdf8be18b8056ba13e0b281246cfbaca666ca
Author: Olav Sørensen <olav.sorensen@live.no>
Date: Sun, 29 Dec 2024 22:48:18 +0100
Code cleanup
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/ft2_header.h b/src/ft2_header.h
@@ -22,7 +22,8 @@
#define VBLANK_HZ 60
// 70Hz (FT2 vblank) delta -> 60Hz vblank delta (rounded)
-#define SCALE_VBLANK_DELTA(x) (int32_t)(((x) * ((double)VBLANK_HZ / FT2_VBLANK_HZ)) + 0.5)
+#define SCALE_VBLANK_DELTA(x) (int32_t)(((x) * (FT2_VBLANK_HZ / (double)VBLANK_HZ)) + 0.5)
+#define SCALE_VBLANK_DELTA_REV(x) (int32_t)(((x) * (VBLANK_HZ / (double)FT2_VBLANK_HZ)) + 0.5)
/* Amount of extra bytes to allocate for every instrument sample,
** this is used for a hack for resampling interpolation to be
diff --git a/src/ft2_nibbles.c b/src/ft2_nibbles.c
@@ -848,9 +848,9 @@ void nibblesPlay(void)
assert(config.NI_Speed < 4);
NI_CurSpeed = NI_Speeds[config.NI_Speed];
- // adjust for 70Hz -> 60Hz frames (this is not exact, but we don't want fractional numbers aka. frame skipping)
- NI_CurSpeed60Hz = (uint8_t)SCALE_VBLANK_DELTA(NI_CurSpeed);
- NI_CurTick60Hz = (uint8_t)SCALE_VBLANK_DELTA(NI_Speeds[2]);
+ // adjust for 70Hz -> 60Hz countdown frames (this is not exact, but we don't want fractional numbers aka. frame skipping)
+ NI_CurSpeed60Hz = (uint8_t)SCALE_VBLANK_DELTA_REV(NI_CurSpeed);
+ NI_CurTick60Hz = (uint8_t)SCALE_VBLANK_DELTA_REV(NI_Speeds[2]);
editor.NI_Play = true;
NI_P1Score = 0;