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();
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 ();
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
{
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;
}
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