Fix insert/remove time duplicate automation move -- #7712

Editor::insert_time(), Editor::remove_time() handle automation
directly because time may be inserted to Routes without playlists
and combined undo-operation with marker, and tempo-changes.

However when the preference "automation_follows_regions" is enabled,
the playlist already moves the automation of region under any region
(possibly overriding future automation).

This resulted in possibly lossy, duplicate automation moves.
This commit is contained in:
Robin Gareus
2018-12-21 17:15:38 +01:00
parent 19a2d384fc
commit df666326f7
3 changed files with 14 additions and 6 deletions

View File

@@ -421,6 +421,7 @@ private:
boost::shared_ptr<RegionList> find_regions_at (samplepos_t);
samplepos_t _end_space; //this is used when we are pasting a range with extra space at the end
bool _playlist_shift_active;
};
} /* namespace ARDOUR */

View File

@@ -1127,14 +1127,18 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, samplecnt_
}
void
DiskReader::playlist_ranges_moved (list< Evoral::RangeMove<samplepos_t> > const & movements_samples, bool from_undo)
DiskReader::playlist_ranges_moved (list< Evoral::RangeMove<samplepos_t> > const & movements_samples, bool from_undo_or_shift)
{
/* If we're coming from an undo, it will have handled
automation undo (it must, since automation-follows-regions
can lose automation data). Hence we can do nothing here.
*/
* automation undo (it must, since automation-follows-regions
* can lose automation data). Hence we can do nothing here.
*
* Likewise when shifting regions (insert/remove time)
* automation is taken care of separately (busses with
* automation have no disk-reader).
*/
if (from_undo) {
if (from_undo_or_shift) {
return;
}

View File

@@ -25,6 +25,7 @@
#include "pbd/types_convert.h"
#include "pbd/stateful_diff_command.h"
#include "pbd/strsplit.h"
#include "pbd/unwind.h"
#include "pbd/xml++.h"
#include "ardour/debug.h"
@@ -322,6 +323,7 @@ Playlist::init (bool hide)
_capture_insertion_underway = false;
_combine_ops = 0;
_end_space = 0;
_playlist_shift_active = false;
_session.history().BeginUndoRedo.connect_same_thread (*this, boost::bind (&Playlist::begin_undo, this));
_session.history().EndUndoRedo.connect_same_thread (*this, boost::bind (&Playlist::end_undo, this));
@@ -633,7 +635,7 @@ Playlist::flush_notifications (bool from_undo)
/* We don't need to check crossfades for these as pending_bounds has
already covered it.
*/
RangesMoved (pending_range_moves, from_undo);
RangesMoved (pending_range_moves, from_undo || _playlist_shift_active);
}
if (!pending_region_extensions.empty ()) {
@@ -1396,6 +1398,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
void
Playlist::shift (samplepos_t at, sampleoffset_t distance, bool move_intersected, bool ignore_music_glue)
{
PBD::Unwinder<bool> uw (_playlist_shift_active, true);
RegionWriteLock rlock (this);
RegionList copy (regions.rlist());
RegionList fixup;