From 0161588b5abc1fb6842bec9a2d2b2ee2a337d715 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Wed, 2 Jul 2025 21:57:49 -0500 Subject: [PATCH] aica/tima: slow TIMA interrupt from once every 1 counts to once every 3 counts --- src/interpreter.cpp | 6 +++--- src/main.cpp | 2 +- src/sound.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/interpreter.cpp b/src/interpreter.cpp index 89ef1cd..841d5de 100644 --- a/src/interpreter.cpp +++ b/src/interpreter.cpp @@ -368,12 +368,12 @@ const int sample_data_length = (sizeof (sample_data)); void deferred_load(int buf) { - state.deferred_load_tick = 44100 / 2; + const float aica_clock_multiplier = 44.1 / 3; + + state.deferred_load_tick = aica_clock_multiplier * 1000 / 2; stop_sound(); - const float aica_clock_multiplier = 44.1; - state.sample_data_ix = xm_init(&interpreter::state.xm, buf, sample_data, diff --git a/src/main.cpp b/src/main.cpp index 8f9cff8..582c1e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,7 +44,7 @@ void vbr600() wait(); aica_sound.common.mcire = (1 << 6); // interrupt timer A wait(); aica_sound.common.tactl_tima = aica::tactl_tima::TACTL(0) // increment once every sample - | aica::tactl_tima::TIMA(0xffff) // interrupt after 1 counts + | aica::tactl_tima::TIMA(0xfffd) // interrupt after 3 counts ; //scene::logo::sound::interrupt(); diff --git a/src/sound.cpp b/src/sound.cpp index d909520..200289a 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -131,7 +131,7 @@ void init() wait(); aica_sound.common.tactl_tima = aica::tactl_tima::TACTL(0) // increment once every sample - | aica::tactl_tima::TIMA(0xffff) // interrupt after 1 counts + | aica::tactl_tima::TIMA(0xfffd) // interrupt after 3 counts ; wait(); aica_sound.common.mcieb = (1 << 6); // interrupt timer A