summaryrefslogtreecommitdiff
path: root/libs/ardour/region.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-08-31 05:49:11 +1000
committernick_m <mainsbridge@gmail.com>2016-08-31 23:12:11 +1000
commit5113a492e0b7ad6d9f3d871e9c0003a5246e67f5 (patch)
treebbd40d55963cfd7b311112f16b70d79bee5b51a7 /libs/ardour/region.cc
parent16ae7d9a6d846fa692cbe1f70566d219e913f66e (diff)
Keep region beat and pulse separated, ensure pulse is updated when setting position.
Diffstat (limited to 'libs/ardour/region.cc')
-rw-r--r--libs/ardour/region.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 97c0cf65b0..05f79271d5 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -357,7 +357,7 @@ Region::Region (boost::shared_ptr<const Region> other, frameoffset_t offset, con
_start = other->_start + offset;
_beat = _session.tempo_map().exact_beat_at_frame (_position, sub_num);
- _pulse = _session.tempo_map().pulse_at_beat (_beat);
+ _pulse = _session.tempo_map().exact_qn_at_frame (_position, sub_num) / 4.0;
/* if the other region had a distinct sync point
set, then continue to use it as best we can.
@@ -555,7 +555,7 @@ Region::set_position_lock_style (PositionLockStyle ps)
if (_position_lock_style == MusicTime) {
_beat = _session.tempo_map().beat_at_frame (_position);
- _pulse = _session.tempo_map().pulse_at_beat (_beat);
+ _pulse = _session.tempo_map().pulse_at_frame (_position);
}
send_change (Properties::position_lock_style);
@@ -602,7 +602,7 @@ Region::set_position (framepos_t pos, int32_t sub_num)
} else {
double beat = _session.tempo_map().exact_beat_at_frame (pos, sub_num);
_beat = beat;
- _pulse = _session.tempo_map().pulse_at_beat (_beat);
+ _pulse = _session.tempo_map().exact_qn_at_frame (pos, sub_num) / 4.0;
set_position_internal (pos, false, sub_num);
}
@@ -675,7 +675,11 @@ Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute, const i
if (allow_bbt_recompute) {
recompute_position_from_lock_style (sub_num);
+ } else {
+ /* MusicTime dictates that we glue to ardour beats. the pulse may have changed.*/
+ _pulse = _session.tempo_map().exact_qn_at_frame (_position, sub_num) / 4.0;
}
+
/* check that the new _position wouldn't make the current
length impossible - if so, change the length.
@@ -692,7 +696,7 @@ void
Region::recompute_position_from_lock_style (const int32_t sub_num)
{
_beat = _session.tempo_map().exact_beat_at_frame (_position, sub_num);
- _pulse = _session.tempo_map().pulse_at_beat (_beat);
+ _pulse = _session.tempo_map().exact_qn_at_frame (_position, sub_num) / 4.0;
}
void