Skip to content

Commit

Permalink
Fix a problem with the time display
Browse files Browse the repository at this point in the history
Some changes made in commit e05c827
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.
  • Loading branch information
michaelgregorius committed Jul 20, 2017
1 parent 6f1b11f commit bcdb5ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/MidiTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class EXPORT MidiTime
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;
Expand Down
5 changes: 5 additions & 0 deletions src/core/midi/MidiTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bcdb5ec

Please sign in to comment.