13
0

Prevent overwriting of MidiRegion length and length_beats during session load.

- .
This commit is contained in:
nick_m 2016-09-28 23:30:47 +10:00
parent fa350c7aca
commit cd9c2cedfb

View File

@ -206,8 +206,15 @@ MidiRegion::post_set (const PropertyChange& pc)
Region::post_set (pc);
if (pc.contains (Properties::length) && !pc.contains (Properties::length_beats)) {
/* we're called by Stateful::set_values() which sends a change
only if the value is different from _current.
session load means we can clobber length_beats here in error (not all properties differ from current),
so disallow (this has been set from XML state anyway).
*/
if (!_session.loading()) {
/* update non-musically */
update_length_beats (0);
}
} else if (pc.contains (Properties::start) && !pc.contains (Properties::start_beats)) {
set_start_beats_from_start_frames ();
}
@ -307,6 +314,8 @@ MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute, con
update_length_beats (sub_num);
}
/* don't clobber _length and _length_beats if session loading.*/
if (!_session.loading()) {
if (position_lock_style() == AudioTime) {
_length_beats = Evoral::Beats (_session.tempo_map().quarter_note_at_frame (_position + _length) - _session.tempo_map().quarter_note_at_frame (_position));
} else {
@ -316,6 +325,7 @@ MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute, con
Region::set_length_internal (_session.tempo_map().frame_at_pulse (pulse() + (_length_beats.val().to_double() / 4.0)) - _position, sub_num);
}
}
}
framecnt_t
MidiRegion::read_at (Evoral::EventSink<framepos_t>& out,