13
0

MidiRegion _start/_length beats are frame based only when lock style is Audiotime

This commit is contained in:
nick_m 2016-10-30 23:42:06 +11:00
parent 0e867b544b
commit ac23496b40
2 changed files with 9 additions and 14 deletions

View File

@ -362,7 +362,7 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
TempoMap& map(_session->tempo_map());
begin_reversible_command (_("add tempo mark"));
const double pulse = map.pulse_at_frame (frame);
const double pulse = map.exact_qn_at_frame (frame, get_grid_music_divisions (0)) / 4.0;
if (pulse > 0.0) {
XMLNode &before = map.get_state();

View File

@ -213,8 +213,10 @@ MidiRegion::post_set (const PropertyChange& pc)
so disallow (this has been set from XML state anyway).
*/
if (!_session.loading()) {
/* update non-musically */
update_length_beats (0);
/* ensure this only updates non-musical regions */
if (position_lock_style() == AudioTime) {
update_length_beats (0);
}
}
} else if (pc.contains (Properties::start) && !pc.contains (Properties::start_beats)) {
set_start_beats_from_start_frames ();
@ -224,7 +226,9 @@ MidiRegion::post_set (const PropertyChange& pc)
void
MidiRegion::set_start_beats_from_start_frames ()
{
_start_beats = (pulse() * 4.0) - _session.tempo_map().quarter_note_at_frame (_position - _start);
if (position_lock_style() == AudioTime) {
_start_beats = (pulse() * 4.0) - _session.tempo_map().quarter_note_at_frame (_position - _start);
}
}
void
@ -451,13 +455,6 @@ MidiRegion::set_state (const XMLNode& node, int version)
{
int ret = Region::set_state (node, version);
if (ret == 0) {
/* set length beats to the frame (non-musical) */
if (position_lock_style() == AudioTime) {
update_length_beats (0);
}
}
return ret;
}
@ -605,9 +602,7 @@ void
MidiRegion::set_start_internal (framecnt_t s, const int32_t sub_num)
{
Region::set_start_internal (s, sub_num);
if (position_lock_style() == AudioTime) {
set_start_beats_from_start_frames ();
}
set_start_beats_from_start_frames ();
}
void