summaryrefslogtreecommitdiff
path: root/libs/ardour/tempo.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-11-22 21:49:42 -0500
committerDavid Robillard <d@drobilla.net>2014-11-22 21:49:42 -0500
commit57c1b6e261076cae9b61e74aa0aff47a9f296c0f (patch)
tree0ed8e37d0fe4bdc7c49437062d16045d1d9b3881 /libs/ardour/tempo.cc
parent231e0009b40464ed0c74efcb4585c6ace1336b59 (diff)
Fix quantization and other time-related ops.
Diffstat (limited to 'libs/ardour/tempo.cc')
-rw-r--r--libs/ardour/tempo.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 1767c8100d..486cbb0643 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -1885,7 +1885,7 @@ TempoMap::framepos_plus_beats (framepos_t pos, Evoral::MusicalTime beats) const
string_compose ("frame %1 plus %2 beats, start with tempo = %3 @ %4\n",
pos, beats, *((const Tempo*)tempo), tempo->frame()));
- while (beats) {
+ while (!!beats) {
/* Distance to the end of this section in frames */
framecnt_t distance_frames = (next_tempo == metrics.end() ? max_framepos : ((*next_tempo)->frame() - pos));
@@ -1994,7 +1994,7 @@ TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const
prev_tempo -> the first metric before "pos", possibly metrics.rend()
*/
- while (beats) {
+ while (!!beats) {
/* Distance to the start of this section in frames */
framecnt_t distance_frames = (pos - tempo->frame());
@@ -2011,7 +2011,7 @@ TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const
/* Update */
beats -= sub;
- pos -= sub * tempo->frames_per_beat (_frame_rate);
+ pos -= sub.to_double() * tempo->frames_per_beat (_frame_rate);
DEBUG_TRACE (DEBUG::TempoMath, string_compose ("\tnow at %1, %2 beats left, prev at end ? %3\n", pos, beats,
(prev_tempo == metrics.rend())));
@@ -2036,7 +2036,7 @@ TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const
}
}
} else {
- pos -= llrint (beats * tempo->frames_per_beat (_frame_rate));
+ pos -= llrint (beats.to_double() * tempo->frames_per_beat (_frame_rate));
beats = Evoral::MusicalTime();
}
}