- if (_session.tempo_map().frame_at_beat (_beat) != _position) {
- std::cout << name ()
- << " Region::set_position MusicTime position error!!! FRAME AT BEAT : " <<_session.tempo_map().frame_at_beat (_beat)
- << " position : " << _position << " beat : " << _beat << " has playlist : " << (playlist() == 0) << std::endl;
+void
+Region::set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num)
+{
+ /* We emit a change of Properties::position even if the position hasn't changed
+ (see Region::set_position), so we must always set this up so that
+ e.g. Playlist::notify_region_moved doesn't use an out-of-date last_position.
+ */
+ _last_position = _position;
+
+ if (_position != pos) {
+ _position = pos;
+
+ 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.*/
+ _quarter_note = _session.tempo_map().quarter_note_at_beat (_beat);
+ }
+
+ /* check that the new _position wouldn't make the current
+ length impossible - if so, change the length.
+
+ XXX is this the right thing to do?
+ */
+ if (max_samplepos - _length < _position) {
+ _last_length = _length;
+ _length = max_samplepos - _position;