From bcdb5ecb5af503839070a77edb23e1731c74856e Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Thu, 20 Jul 2017 18:22:00 +0200 Subject: [PATCH] Fix a problem with the time display Some changes made in commit e05c82758e315dda20f4ae0c72a6fe3e772965da have broken the update of the time display. This commit fixes the problem by introducing a second version of MidiTime::ticksToMilliseconds which takes a double as an argument for the ticks. This new method is then used by the call to ticksToMilliseconds in Song::processNextBuffer which fixes the problem. --- include/MidiTime.h | 1 + src/core/midi/MidiTime.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/MidiTime.h b/include/MidiTime.h index 203e7d5bf..37fcf6258 100644 --- a/include/MidiTime.h +++ b/include/MidiTime.h @@ -99,6 +99,7 @@ public: static void setTicksPerTact( tick_t tpt ); static MidiTime stepPosition( int step ); static double ticksToMilliseconds(tick_t ticks, bpm_t beatsPerMinute); + static double ticksToMilliseconds(double ticks, bpm_t beatsPerMinute); private: tick_t m_ticks; diff --git a/src/core/midi/MidiTime.cpp b/src/core/midi/MidiTime.cpp index 999dcfaf9..b4607aee9 100644 --- a/src/core/midi/MidiTime.cpp +++ b/src/core/midi/MidiTime.cpp @@ -197,6 +197,11 @@ MidiTime MidiTime::stepPosition( int step ) } double MidiTime::ticksToMilliseconds(tick_t ticks, bpm_t beatsPerMinute) +{ + return MidiTime::ticksToMilliseconds(static_cast(ticks), beatsPerMinute); +} + +double MidiTime::ticksToMilliseconds(double ticks, bpm_t beatsPerMinute) { // 60 * 1000 / 48 = 1250 return ( ticks * 1250 ) / beatsPerMinute;