gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 5fa0bdfe3211f1016ce396b3be8fbf59404c74c5
parent fdd6adf472879d6bfb81b45dd3f38fc602338c27
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Wed, 24 Jul 2024 09:21:56 +0200

fix microcontroller timing

Diffstat:
Mdoc/changelog.txt | 2++
Msource/wLib/wHardware.cpp | 8++++++++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/doc/changelog.txt b/doc/changelog.txt @@ -10,6 +10,7 @@ Framework: Vavra: - [Fix] Font when renaming a patch was too large +- [Fix] Microcontroller timing Xenia: @@ -17,6 +18,7 @@ Xenia: multiple patches - [Fix] Font when renaming a patch was too large +- [Fix] Microcontroller timing 1.3.16 (2024.07.14) diff --git a/source/wLib/wHardware.cpp b/source/wLib/wHardware.cpp @@ -122,8 +122,16 @@ namespace wLib const auto esaiDelta = esaiFrameIndex - m_lastEsaiFrameIndex; + // if the UC consumed more cycles than it was allowed to, remove them from remaining cycles + m_remainingUcCyclesD += static_cast<double>(m_remainingUcCycles); + + // add cycles for the ESAI time that has passed m_remainingUcCyclesD += ucCyclesPerFrame * static_cast<double>(esaiDelta); + + // set new remaining cycle count m_remainingUcCycles = static_cast<int64_t>(m_remainingUcCyclesD); + + // and consume them m_remainingUcCyclesD -= static_cast<double>(m_remainingUcCycles); if(esaiDelta > g_syncHaltDspEsaiThreshold)