diff options
author | nick_m <mainsbridge@gmail.com> | 2017-01-27 00:41:17 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2017-02-04 22:57:36 +1100 |
commit | 59daffea1d78cb55b35fe19c135cc4ab472bd01d (patch) | |
tree | 45e514f2e4f5a1935e360fd4fa3e2475ec217006 /gtk2_ardour/midi_time_axis.cc | |
parent | a21a414615505269bf770ad2358482e698e841af (diff) |
rework snap
snap now fills in a struct (MusicFrame) which contins a snapped frame
along with a music divisor.
this gives useful information wrt magnetic snap which may or may not
have rounded to an exact musical position.
region position may now be set musically (using quarter notes for now).
this patch fixes several problems in the current code:
- dragging a list of music-locked regions now maintains correct
musical offsets within the list.
- splitting regions using magnetic snap works correctly (#7192)
- cut drag should now work correctly with magnetic snap.
- musical length of split midi regions is no longer frame based.
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 6bbc813eb2..00764d0b78 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -1646,9 +1646,11 @@ MidiTimeAxisView::automation_child_menu_item (Evoral::Parameter param) } boost::shared_ptr<MidiRegion> -MidiTimeAxisView::add_region (framepos_t pos, framecnt_t length, bool commit, const int32_t sub_num) +MidiTimeAxisView::add_region (framepos_t f, framecnt_t length, bool commit) { Editor* real_editor = dynamic_cast<Editor*> (&_editor); + MusicFrame pos (f, 0); + if (commit) { real_editor->begin_reversible_command (Operations::create_region); } @@ -1665,8 +1667,8 @@ MidiTimeAxisView::add_region (framepos_t pos, framecnt_t length, bool commit, co boost::shared_ptr<Region> region = (RegionFactory::create (src, plist)); /* sets beat position */ - region->set_position (pos, sub_num); - playlist()->add_region (region, pos, 1.0, false, sub_num); + region->set_position (pos.frame, pos.division); + playlist()->add_region (region, pos.frame, 1.0, false, pos.division); _session->add_command (new StatefulDiffCommand (playlist())); if (commit) { |