diff options
author | nick_m <mainsbridge@gmail.com> | 2016-06-25 00:34:59 +1000 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-07-10 02:18:37 +1000 |
commit | 3b4a406ba12e0d7f94c0b75fe96a52da0ad01a71 (patch) | |
tree | 5c40cf21f9b55a7cb4179d628ccc14688ac77e4c /libs/ardour/midi_region.cc | |
parent | 4bdbe77414b956e27f2c1631e67189c70409a3d1 (diff) |
Only update midi regions having a playlist after tempo map change, fix 0 length regions from drawing tool.
Diffstat (limited to 'libs/ardour/midi_region.cc')
-rw-r--r-- | libs/ardour/midi_region.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index bd0319f2bd..e64a343e68 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -197,6 +197,12 @@ MidiRegion::set_length_internal (framecnt_t len, const int32_t& sub_num) void MidiRegion::update_after_tempo_map_change (bool /* send */) { + boost::shared_ptr<Playlist> pl (playlist()); + + if (!pl || position_lock_style() != MusicTime) { + return; + } + const framepos_t old_pos = _position; const framepos_t old_length = _length; const framepos_t old_start = _start; @@ -234,6 +240,11 @@ MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute, con /* set _start to new position in tempo map */ _start = _position - _session.tempo_map().frame_at_beat (beat() - _start_beats.val().to_double()); + /* in construction from src */ + if (_length_beats == Evoral::Beats()) { + update_length_beats (sub_num); + } + /* leave _length_beats alone, and change _length to reflect the state of things at the new position (tempo map may dictate a different number of frames). */ @@ -479,7 +490,7 @@ MidiRegion::set_start_internal (framecnt_t s, const int32_t& sub_num) if (position_lock_style() == AudioTime) { set_start_beats_from_start_frames (); - } + } } void |