projects
/
ardour.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0a975eb
)
Round to bar correctly in TempoMap::exact_beat_at_frame_locked().
author
nick_m
<mainsbridge@gmail.com>
Tue, 23 Aug 2016 17:23:04 +0000
(
03:23
+1000)
committer
nick_m
<mainsbridge@gmail.com>
Tue, 23 Aug 2016 17:23:04 +0000
(
03:23
+1000)
libs/ardour/tempo.cc
patch
|
blob
|
history
diff --git
a/libs/ardour/tempo.cc
b/libs/ardour/tempo.cc
index d8db6a561694cbf28d253f3c58e395b1610fbc52..35a19b13db1119fa1dc0fe1909e13800a8739333 100644
(file)
--- a/
libs/ardour/tempo.cc
+++ b/
libs/ardour/tempo.cc
@@
-3071,8
+3071,18
@@
TempoMap::exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t&
Timecode::BBT_Time bbt = bbt_at_beat_locked (metrics, beat);
bbt.beats = 1;
bbt.ticks = 0;
- beat = beat_at_bbt_locked (metrics, bbt);
+
+ const double prev_b = beat_at_bbt_locked (_metrics, bbt);
+ ++bbt.bars;
+ const double next_b = beat_at_bbt_locked (_metrics, bbt);
+
+ if ((beat - prev_b) > (next_b - prev_b) / 2.0) {
+ beat = next_b;
+ } else {
+ beat = prev_b;
+ }
}
+
return beat;
}