diff options
author | Sampo Savolainen <v2@iki.fi> | 2006-03-31 21:34:22 +0000 |
---|---|---|
committer | Sampo Savolainen <v2@iki.fi> | 2006-03-31 21:34:22 +0000 |
commit | 7755c2dbfefd40697ce390e2c2f254e2122a2a39 (patch) | |
tree | 60fea9f94cc2200ce07da4db962ba5c7ea5510d1 /libs/ardour/audio_playlist.cc | |
parent | 6f1208036fe7eb9278b2708843c6bce817bbdf8d (diff) |
Splitting a regon now retains crossfades, even if the split happens
within a crossfade.
git-svn-id: svn://localhost/trunk/ardour2@435 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_playlist.cc')
-rw-r--r-- | libs/ardour/audio_playlist.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 6f4217c3ec..53aa173ffd 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -351,17 +351,36 @@ AudioPlaylist::finalize_split_region (Region *o, Region *l, Region *r) AudioRegion *left = dynamic_cast<AudioRegion*>(l); AudioRegion *right = dynamic_cast<AudioRegion*>(r); - for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end(); ++x) { + for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end();) { Crossfades::iterator tmp; + tmp = x; + ++tmp; + Crossfade *fade = 0; + if ((*x)->_in == orig) { - (*x)->_in = left; + if (! (*x)->covers(right->position())) { + fade = new Crossfade( *(*x), left, (*x)->_out); + } else { + // Overlap, the crossfade is copied on the left side of the right region instead + fade = new Crossfade( *(*x), right, (*x)->_out); + } } - + if ((*x)->_out == orig) { - (*x)->_out = right; + if (! (*x)->covers(right->position())) { + fade = new Crossfade( *(*x), (*x)->_in, right); + } else { + // Overlap, the crossfade is copied on the right side of the left region instead + fade = new Crossfade( *(*x), (*x)->_in, left); + } } + if (fade) { + _crossfades.remove( (*x) ); + add_crossfade (*fade); + } + x = tmp; } } |