13
0

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
This commit is contained in:
Sampo Savolainen 2006-03-31 21:34:22 +00:00
parent 6f1208036f
commit 7755c2dbfe
3 changed files with 40 additions and 16 deletions

View File

@ -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)->_out == orig) {
(*x)->_out = right;
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) {
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;
}
}

View File

@ -165,11 +165,8 @@ Crossfade::Crossfade (const Crossfade &orig, ARDOUR::AudioRegion *newin, ARDOUR:
: _fade_in(orig._fade_in),
_fade_out(orig._fade_out)
{
// Signals?
_active = orig._active;
_in_update = orig._in_update;
overlap_type = orig.overlap_type;
_length = orig._length;
_position = orig._position;
_anchor_point = orig._anchor_point;
@ -180,9 +177,20 @@ Crossfade::Crossfade (const Crossfade &orig, ARDOUR::AudioRegion *newin, ARDOUR:
_in = newin;
_out = newout;
// copied from Crossfade::initialize()
_in_update = false;
_out->suspend_fade_out ();
_in->suspend_fade_in ();
overlap_type = _in->coverage (_out->position(), _out->last_frame());
// Let's make sure the fade isn't too long
set_length(_length);
}
Crossfade::~Crossfade ()
{
for (StateMap::iterator i = states.begin(); i != states.end(); ++i) {

View File

@ -982,10 +982,6 @@ Playlist::split_region (Region& region, jack_nframes_t playlist_position)
return;
}
if (remove_region_internal (&region, true)) {
return;
}
Region *left;
Region *right;
jack_nframes_t before;
@ -996,7 +992,6 @@ Playlist::split_region (Region& region, jack_nframes_t playlist_position)
before = playlist_position - region.position();
after = region.length() - before;
in_set_state = true;
_session.region_name (before_name, region.name(), false);
left = createRegion (region, 0, before, before_name, region.layer(), Region::Flag (region.flags()|Region::LeftOfSplit));
@ -1009,8 +1004,10 @@ Playlist::split_region (Region& region, jack_nframes_t playlist_position)
finalize_split_region (&region, left, right);
in_set_state = false;
if (remove_region_internal (&region, true)) {
return;
}
maybe_save_state (_("split"));
}