diff options
author | Sampo Savolainen <v2@iki.fi> | 2006-03-14 21:35:00 +0000 |
---|---|---|
committer | Sampo Savolainen <v2@iki.fi> | 2006-03-14 21:35:00 +0000 |
commit | ec461de3a8fce8de51da56aa4f5f69224abc3dce (patch) | |
tree | bb9baa62c95c9bf987d1dd02e701dcb8f929f946 /libs/ardour/audio_playlist.cc | |
parent | 8d3fdc3c5b87f6d1444830d82f28d18a2201afea (diff) |
Crossfade copy-constructor + copy crossfades when creating a copy of a
playlist.
git-svn-id: svn://localhost/trunk/ardour2@393 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_playlist.cc')
-rw-r--r-- | libs/ardour/audio_playlist.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index f6c6440ab0..72316e30e3 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -72,6 +72,47 @@ AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, string name, bool hidd { save_state (_("initial state")); + list<Region*>::const_iterator in_o = other.regions.begin(); + list<Region*>::iterator in_n = regions.begin(); + + while (in_o != other.regions.end()) { + AudioRegion *ar = dynamic_cast<AudioRegion *>( (*in_o) ); + + // We look only for crossfades which begin with the current region, so we don't get doubles + for (list<Crossfade *>::const_iterator xfades = other._crossfades.begin(); xfades != other._crossfades.end(); ++xfades) { + if ( &(*xfades)->in() == ar) { + // We found one! Now copy it! + + list<Region*>::const_iterator out_o = other.regions.begin(); + list<Region*>::const_iterator out_n = regions.begin(); + + while (out_o != other.regions.end()) { + + AudioRegion *ar2 = dynamic_cast<AudioRegion *>( (*out_o) ); + + if ( &(*xfades)->out() == ar2) { + AudioRegion *in = dynamic_cast<AudioRegion*>( (*in_n) ); + AudioRegion *out = dynamic_cast<AudioRegion*>( (*out_n) ); + Crossfade *new_fade = new Crossfade( *(*xfades), in, out); + add_crossfade(*new_fade); + cerr << "Here we go!" << endl; + break; + } + + out_o++; + out_n++; + } +// cerr << "HUH!? second region in the crossfade not found!" << endl; + } + } + + + + + in_o++; + in_n++; + } + if (!hidden) { PlaylistCreated (this); /* EMIT SIGNAL */ } |