diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-05-25 22:44:30 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-05-25 22:44:30 +0000 |
commit | 884e147a9cdc130d41b59877738783c15c928d46 (patch) | |
tree | e637a3d5952ae124bd08063054c1e9d9b6f50ee3 /libs/ardour/audio_playlist.cc | |
parent | fa42d70b855007b4e6c3404ca8c98aed156b1b3d (diff) |
restore compound region fade, where possible, to constituent regions, after uncombine
git-svn-id: svn://localhost/ardour2/branches/3.0@9593 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_playlist.cc')
-rw-r--r-- | libs/ardour/audio_playlist.cc | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index f73bbf17e5..06eca9fb92 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -1109,7 +1109,7 @@ AudioPlaylist::pre_combine (vector<boost::shared_ptr<Region> >& originals, boost ar->set_fade_in_active (false); } - ar = boost::dynamic_pointer_cast<AudioRegion> (originals.front()); + ar = boost::dynamic_pointer_cast<AudioRegion> (originals.back()); if (ar) { /* copy the fade out of the last into the compound region */ @@ -1122,4 +1122,48 @@ AudioPlaylist::pre_combine (vector<boost::shared_ptr<Region> >& originals, boost void AudioPlaylist::pre_uncombine (vector<boost::shared_ptr<Region> >& originals, boost::shared_ptr<Region> compound_region) { + boost::shared_ptr<AudioRegion> ar; + boost::shared_ptr<AudioRegion> cr = boost::dynamic_pointer_cast<AudioRegion>(compound_region); + + if (!cr) { + return; + } + + /* no need to call clear_changes() on the originals because that is + * done within Playlist::uncombine () + */ + + if ((ar = boost::dynamic_pointer_cast<AudioRegion> (originals.front())) != 0) { + + /* copy the compound region's fade in back into the first + original region. + */ + + if (cr->fade_in()->back()->when <= ar->length()) { + /* don't do this if the fade is longer than the + * region + */ + ar->set_fade_in (cr->fade_in()); + } + + ar->set_fade_in_active (true); + _session.add_command (new StatefulDiffCommand (originals.front())); + } + + if ((ar = boost::dynamic_pointer_cast<AudioRegion> (originals.back())) != 0) { + + /* copy the compound region's fade out back into the last + original region. + */ + + if (cr->fade_out()->back()->when <= ar->length()) { + /* don't do this if the fade is longer than the + * region + */ + ar->set_fade_out (cr->fade_out()); + } + + ar->set_fade_out_active (true); + _session.add_command (new StatefulDiffCommand (originals.back())); + } } |