diff options
author | Ben Loftis <ben@glw.com> | 2011-05-17 15:20:18 +0000 |
---|---|---|
committer | Ben Loftis <ben@glw.com> | 2011-05-17 15:20:18 +0000 |
commit | aa6adacc7505005305d922847ef0e33378314ecd (patch) | |
tree | c7defb25347c3d7ac46f3e257cd40897a2f4088c /libs/ardour/audio_playlist.cc | |
parent | 819faa3b0b3997e29b473faab6d7ef14ddbdc324 (diff) |
fix thinko in playlist constructor for cut and copy
git-svn-id: svn://localhost/ardour2/branches/3.0@9541 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, 20 insertions, 21 deletions
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 4e15aa70c2..07a6d099ea 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -205,31 +205,30 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, fram break; } - case OverlapStart: - { - if (region->fade_in()->back()->when > 0) { - fade_in = region->fade_in()->back()->when; - } - if (start > region->last_frame() - region->fade_out()->back()->when) { - fade_out = region->last_frame() - start; - } + case OverlapStart: { + position = region->position() - start; + len = end - region->position(); + + if (end > region->position() + region->fade_in().back()->when) + fade_in_len = region->fade_in().back()->when; //end is after fade-in, preserve the fade-in + if (end > region->last_frame() - region->fade_out().back()->when) + fade_out_len = region->fade_out().back()->when - ( region->last_frame() - end ); //end is inside the fadeout, preserve the fades endpoint break; } - - case OverlapEnd: - { - framecnt_t const offset = start - region->position(); - if (region->fade_in()->back()->when > offset) { - fade_in = region->fade_in()->back()->when - offset; - } - if (start > region->last_frame() - region->fade_out()->back()->when) { - fade_out = region->last_frame() - start; - } else { - fade_out = region->fade_out()->back()->when; - } + + case OverlapEnd: { + position = 0; + offset = start - region->position(); + len = region->length() - offset; + + if (start < region->last_frame() - region->fade_out().back()->when) //start is before fade-out, preserve the fadeout + fade_out_len = region->fade_out().back()->when; + + if (start < region->position() + region->fade_in().back()->when) + fade_in_len = region->fade_in().back()->when - (start - region->position()); //end is inside the fade-in, preserve the fade-in endpoint break; } - + case OverlapExternal: fade_in = region->fade_in()->back()->when; fade_out = region->fade_out()->back()->when; |