From a2a4f183786296682105517abd6eaefd61db1e4f Mon Sep 17 00:00:00 2001 From: Javier Nonis Date: Thu, 8 Aug 2024 20:32:38 -0300 Subject: [PATCH] Fix for Midi Clock Sync --- src/minidexed.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/minidexed.cpp b/src/minidexed.cpp index d22326e..eee7862 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -807,17 +807,17 @@ void CMiniDexed::handleClock (void) { // Set milis auto now = std::chrono::high_resolution_clock::now(); - m_mClockTime = std::chrono::duration_cast(now.time_since_epoch()).count(); + m_mClockTime = std::chrono::duration_cast(now.time_since_epoch()).count(); } m_nClockCounter++; - if (m_nClockCounter > 23) { + if (m_nClockCounter > 24) { m_nClockCounter = 0; // Calculate BPM auto now = std::chrono::high_resolution_clock::now(); - unsigned timeDelta = std::chrono::duration_cast(now.time_since_epoch()).count() - m_mClockTime; - unsigned newTempo = roundf(60000 / timeDelta); + unsigned long timeDelta = std::chrono::duration_cast(now.time_since_epoch()).count() - m_mClockTime; + unsigned newTempo = roundf(60000000 / timeDelta); if (m_nTempo != newTempo) { this->setTempo(newTempo);