Fix a problem with the time display

Some changes made in commit e05c82758e
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.
This commit is contained in:
Michael Gregorius
2017-07-20 18:22:00 +02:00
parent 6f1b11f0ee
commit bcdb5ecb5a
2 changed files with 6 additions and 0 deletions

View File

@@ -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;

View File

@@ -197,6 +197,11 @@ MidiTime MidiTime::stepPosition( int step )
}
double MidiTime::ticksToMilliseconds(tick_t ticks, bpm_t beatsPerMinute)
{
return MidiTime::ticksToMilliseconds(static_cast<double>(ticks), beatsPerMinute);
}
double MidiTime::ticksToMilliseconds(double ticks, bpm_t beatsPerMinute)
{
// 60 * 1000 / 48 = 1250
return ( ticks * 1250 ) / beatsPerMinute;