summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_region.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-06-14 03:21:52 +1000
committernick_m <mainsbridge@gmail.com>2016-07-10 02:18:36 +1000
commit2d5238d87581bc0ff9dcaaa8aad9e255b5d9c370 (patch)
tree0b6d271f2b8a6284004d28f613b5cc9afdda53ca /libs/ardour/midi_region.cc
parent0d050de94e3ae5a1a0dc36114df1995b042f3b80 (diff)
Make some musical operations on music-locked regions operate in beats.
- use exact beats to determine frame position. - see comments in tempo.cc for more. - this hasn't been done for split yet, but dragging and trimming are supported.
Diffstat (limited to 'libs/ardour/midi_region.cc')
-rw-r--r--libs/ardour/midi_region.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc
index 81bfc2aa23..26a8509aca 100644
--- a/libs/ardour/midi_region.cc
+++ b/libs/ardour/midi_region.cc
@@ -458,14 +458,17 @@ MidiRegion::fix_negative_start ()
}
void
-MidiRegion::set_start_internal (framecnt_t s)
+MidiRegion::set_start_internal (framecnt_t s, const int32_t& sub_num)
{
- Region::set_start_internal (s);
- set_start_beats_from_start_frames ();
+ Region::set_start_internal (s, sub_num);
+
+ if (position_lock_style() == AudioTime) {
+ set_start_beats_from_start_frames ();
+ }
}
void
-MidiRegion::trim_to_internal (framepos_t position, framecnt_t length)
+MidiRegion::trim_to_internal (framepos_t position, framecnt_t length, const int32_t& sub_num)
{
framepos_t new_start;
@@ -476,7 +479,7 @@ MidiRegion::trim_to_internal (framepos_t position, framecnt_t length)
PropertyChange what_changed;
/* beat has not been set by set_position_internal */
- const double beat_delta = _session.tempo_map().beat_at_frame (position) - beat();
+ const double beat_delta = _session.tempo_map().exact_beat_at_frame (position, sub_num) - beat();
/* Set position before length, otherwise for MIDI regions this bad thing happens:
* 1. we call set_length_internal; length in beats is computed using the region's current
@@ -504,7 +507,7 @@ MidiRegion::trim_to_internal (framepos_t position, framecnt_t length)
_start_beats = Evoral::Beats (new_start_beat);
what_changed.add (Properties::start_beats);
- set_start_internal (new_start);
+ set_start_internal (new_start, sub_num);
what_changed.add (Properties::start);
}