summaryrefslogtreecommitdiff
path: root/libs/ardour/region.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-10-31 00:01:02 +1100
committernick_m <mainsbridge@gmail.com>2016-11-11 03:37:08 +1100
commitdca96d8b5d6737ec811cf5a46548d39a7912bec8 (patch)
tree3569c1c42a405bc1b43fc22f30d90bba1dc1fe51 /libs/ardour/region.cc
parentac23496b40537d97469acdec89f787f056dc3bba (diff)
rename Region pulse to pos_beats. use new beat distance api where required.
- add more debugging output detecting regions whose beat and frame position do not align on a playlist. this is required as a check as we have never used frame rounding on constant tempi before 8884a5723dc
Diffstat (limited to 'libs/ardour/region.cc')
-rw-r--r--libs/ardour/region.cc30
1 files changed, 21 insertions, 9 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 7581e23671..10d123925a 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -177,7 +177,7 @@ Region::register_properties ()
, _position (Properties::position, 0) \
, _beat (Properties::beat, 0.0) \
, _sync_position (Properties::sync_position, (s)) \
- , _pulse (0.0) \
+ , _pos_beats (0.0) \
, _transient_user_start (0) \
, _transient_analysis_start (0) \
, _transient_analysis_end (0) \
@@ -208,7 +208,7 @@ Region::register_properties ()
, _position(Properties::position, other->_position) \
, _beat (Properties::beat, other->_beat) \
, _sync_position(Properties::sync_position, other->_sync_position) \
- , _pulse (other->_pulse) \
+ , _pos_beats (other->_pos_beats) \
, _user_transients (other->_user_transients) \
, _transient_user_start (other->_transient_user_start) \
, _transients (other->_transients) \
@@ -294,7 +294,7 @@ Region::Region (boost::shared_ptr<const Region> other)
_start = other->_start;
_beat = other->_beat;
- _pulse = other->_pulse;
+ _pos_beats = other->_pos_beats;
/* sync pos is relative to start of file. our start-in-file is now zero,
so set our sync position to whatever the the difference between
@@ -353,7 +353,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().exact_qn_at_frame (_position, sub_num) / 4.0;
+ _pos_beats = _session.tempo_map().exact_qn_at_frame (_position, sub_num);
/* if the other region had a distinct sync point
set, then continue to use it as best we can.
@@ -550,8 +550,8 @@ Region::set_position_lock_style (PositionLockStyle ps)
_position_lock_style = ps;
if (_position_lock_style == MusicTime) {
- _beat = _session.tempo_map().beat_at_frame (_position);
- _pulse = _session.tempo_map().pulse_at_frame (_position);
+ //_beat = _session.tempo_map().beat_at_frame (_position);
+ //_pos_beats = _session.tempo_map().quarter_note_at_frame (_position);
}
send_change (Properties::position_lock_style);
@@ -687,7 +687,7 @@ Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute, const i
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().pulse_at_beat (_beat);
+ _pos_beats = _session.tempo_map().quarter_note_at_beat (_beat);
}
/* check that the new _position wouldn't make the current
@@ -706,7 +706,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().exact_qn_at_frame (_position, sub_num) / 4.0;
+ _pos_beats = _session.tempo_map().exact_qn_at_frame (_position, sub_num);
}
void
@@ -1865,7 +1865,19 @@ void
Region::post_set (const PropertyChange& pc)
{
if (pc.contains (Properties::position)) {
- _pulse = _session.tempo_map().pulse_at_beat (_beat);
+ if (playlist() && _session.tempo_map().frame_at_beat (_beat) != _position && position_lock_style() == MusicTime) {
+ std::cout << name()
+ << " Region::post_set MusicTime position error!!! FRAME AT BEAT : " <<_session.tempo_map().frame_at_beat (_beat)
+ << " position : " << _position << " beat : " << _beat << std::endl;
+ //_position = _session.tempo_map().frame_at_beat (_beat);
+ }
+ if (playlist() && _session.tempo_map().frame_at_beat (_beat) != _position && position_lock_style() == AudioTime) {
+ std::cout << name()
+ << " Region::post_set AudioTime position error!!! FRAME AT BEAT : " <<_session.tempo_map().frame_at_beat (_beat)
+ << " position : " << _position << " beat : " << _beat << std::endl;
+ //_beat = _session.tempo_map().beat_at_frame (_position);
+ }
+ _pos_beats = _session.tempo_map().quarter_note_at_beat (_beat);
}
}