summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-22 01:22:33 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-22 01:22:33 +0000
commit092e598389668135b9ff1ae493213b17aa2070d7 (patch)
tree8491879a44bb2db8db80cfd6894796c2a894c575
parent8b0e35cba44643cc8e5deb27e6f138b3425d0559 (diff)
When a region movement is undone, prevent the resulting movement from triggering the automation-follows-regions code. Fixes #3348.
git-svn-id: svn://localhost/ardour2/branches/3.0@7464 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/audioplaylist.h2
-rw-r--r--libs/ardour/ardour/diskstream.h2
-rw-r--r--libs/ardour/ardour/playlist.h8
-rw-r--r--libs/ardour/audio_playlist.cc4
-rw-r--r--libs/ardour/diskstream.cc16
-rw-r--r--libs/ardour/playlist.cc20
6 files changed, 33 insertions, 19 deletions
diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h
index b53f3c1f73..aee5fb3f64 100644
--- a/libs/ardour/ardour/audioplaylist.h
+++ b/libs/ardour/ardour/audioplaylist.h
@@ -63,7 +63,7 @@ class AudioPlaylist : public ARDOUR::Playlist
/* playlist "callbacks" */
void notify_crossfade_added (boost::shared_ptr<Crossfade>);
- void flush_notifications ();
+ void flush_notifications (bool);
void finalize_split_region (boost::shared_ptr<Region> orig, boost::shared_ptr<Region> left, boost::shared_ptr<Region> right);
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index d0d2bcbc36..716cc13063 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -208,7 +208,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
virtual void playlist_changed (const PBD::PropertyChange&);
virtual void playlist_deleted (boost::weak_ptr<Playlist>);
- virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &);
+ virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool);
virtual void transport_stopped_wallclock (struct tm&, time_t, bool abort) = 0;
virtual void transport_looped (nframes_t transport_frame) = 0;
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index 7afc074b4d..100a0f7713 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -182,12 +182,12 @@ class Playlist : public SessionObject
PBD::Signal0<void> NameChanged;
PBD::Signal0<void> LengthChanged;
PBD::Signal0<void> LayeringChanged;
- PBD::Signal1<void,std::list< Evoral::RangeMove<framepos_t> > const &> RangesMoved;
+ PBD::Signal2<void,std::list< Evoral::RangeMove<framepos_t> > const &, bool> RangesMoved;
static std::string bump_name (std::string old_name, Session&);
void freeze ();
- void thaw ();
+ void thaw (bool from_undo = false);
void raise_region (boost::shared_ptr<Region>);
void lower_region (boost::shared_ptr<Region>);
@@ -289,8 +289,8 @@ class Playlist : public SessionObject
}
void delay_notifications ();
- void release_notifications ();
- virtual void flush_notifications ();
+ void release_notifications (bool from_undo = false);
+ virtual void flush_notifications (bool from_undo = false);
void clear_pending ();
void _set_sort_id ();
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index cb65164a9b..30e52fa316 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -241,9 +241,9 @@ AudioPlaylist::remove_dependents (boost::shared_ptr<Region> region)
void
-AudioPlaylist::flush_notifications ()
+AudioPlaylist::flush_notifications (bool from_undo)
{
- Playlist::flush_notifications();
+ Playlist::flush_notifications (from_undo);
if (in_flush) {
return;
diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc
index 5dd9a3b306..064049049b 100644
--- a/libs/ardour/diskstream.cc
+++ b/libs/ardour/diskstream.cc
@@ -363,7 +363,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
_playlist->ContentsChanged.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_modified, this));
_playlist->DropReferences.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr<Playlist>(_playlist)));
- _playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_ranges_moved, this, _1));
+ _playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_ranges_moved, this, _1, _2));
}
/* don't do this if we've already asked for it *or* if we are setting up
@@ -436,8 +436,17 @@ Diskstream::set_name (const string& str)
}
void
-Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const & movements_frames)
+Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const & movements_frames, bool from_undo)
{
+ /* 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.
+ */
+
+ if (from_undo) {
+ return;
+ }
+
if (!_track || Config->get_automation_follows_regions () == false) {
return;
}
@@ -483,7 +492,10 @@ Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evora
set<Evoral::Parameter> const a = processor->what_can_be_automated ();
+ cout << "move processor auto for " << processor->name() << "\n";
+
for (set<Evoral::Parameter>::iterator i = a.begin (); i != a.end (); ++i) {
+ cout << "moving " << *i << "\n";
boost::shared_ptr<AutomationList> al = processor->automation_control(*i)->alist();
XMLNode & before = al->get_state ();
al->move_ranges (movements);
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 5257491815..4c9b8f4bf2 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -446,7 +446,7 @@ Playlist::begin_undo ()
void
Playlist::end_undo ()
{
- thaw ();
+ thaw (true);
in_update = false;
}
@@ -457,11 +457,12 @@ Playlist::freeze ()
g_atomic_int_inc (&ignore_state_changes);
}
+/** @param from_undo true if this thaw is triggered by the end of an undo on this playlist */
void
-Playlist::thaw ()
+Playlist::thaw (bool from_undo)
{
g_atomic_int_dec_and_test (&ignore_state_changes);
- release_notifications ();
+ release_notifications (from_undo);
}
@@ -472,11 +473,12 @@ Playlist::delay_notifications ()
freeze_length = _get_extent().second;
}
+/** @param from_undo true if this release is triggered by the end of an undo on this playlist */
void
-Playlist::release_notifications ()
+Playlist::release_notifications (bool from_undo)
{
if (g_atomic_int_dec_and_test (&block_notifications)) {
- flush_notifications ();
+ flush_notifications (from_undo);
}
}
@@ -535,7 +537,7 @@ Playlist::notify_region_moved (boost::shared_ptr<Region> r)
list< Evoral::RangeMove<framepos_t> > m;
m.push_back (move);
- RangesMoved (m);
+ RangesMoved (m, false);
}
}
@@ -574,8 +576,9 @@ Playlist::notify_length_changed ()
}
}
+/** @param from_undo true if this flush is triggered by the end of an undo on this playlist */
void
-Playlist::flush_notifications ()
+Playlist::flush_notifications (bool from_undo)
{
set<boost::shared_ptr<Region> > dependent_checks_needed;
set<boost::shared_ptr<Region> >::iterator s;
@@ -661,8 +664,7 @@ Playlist::flush_notifications ()
}
if (!pending_range_moves.empty ()) {
- // cerr << _name << " sends RangesMoved\n";
- RangesMoved (pending_range_moves);
+ RangesMoved (pending_range_moves, from_undo);
}
clear_pending ();