diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-11-19 23:58:02 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-11-19 23:58:02 +0000 |
commit | c2b9f932c434e38e91db0ac2e17d08e207375176 (patch) | |
tree | 0601a910daa0d541f0883ecde6d978c845f9953b /libs/ardour | |
parent | afb0c4246ea06a57d041739b26e9ae445941174e (diff) |
trim at edit point added, keybindings altered (in progress); more subtle improvements to splice mode
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2701 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/audioregion.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/region.h | 4 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 22 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 3 |
4 files changed, 19 insertions, 14 deletions
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index ff32199771..934b396a8e 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -167,9 +167,9 @@ class AudioRegion : public Region nframes_t skip_frames = 0) const; bool verify_start (nframes_t position); - bool verify_length (nframes_t position); + bool verify_length (nframes_t& length); bool verify_start_mutable (nframes_t& start); - bool verify_start_and_length (nframes_t start, nframes_t length); + bool verify_start_and_length (nframes_t start, nframes_t& length); void recompute_at_start (); void recompute_at_end (); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index ca8c5855a9..8acbc8b39b 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -209,9 +209,9 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro void first_edit (); virtual bool verify_start (nframes_t) = 0; - virtual bool verify_start_and_length (nframes_t, nframes_t) = 0; + virtual bool verify_start_and_length (nframes_t, nframes_t&) = 0; virtual bool verify_start_mutable (nframes_t&_start) = 0; - virtual bool verify_length (nframes_t) = 0; + virtual bool verify_length (nframes_t&) = 0; virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0; diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index a72e8070c3..86844deed1 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -330,7 +330,7 @@ AudioRegion::listen_to_my_curves () } bool -AudioRegion::verify_length (nframes_t len) +AudioRegion::verify_length (nframes_t& len) { boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(source()); @@ -338,16 +338,19 @@ AudioRegion::verify_length (nframes_t len) return true; } + nframes_t maxlen = 0; + for (uint32_t n=0; n < sources.size(); ++n) { - if (_start > sources[n]->length() - len) { - return false; - } + maxlen = max (maxlen, sources[n]->length() - _start); } + + len = min (len, maxlen); + return true; } bool -AudioRegion::verify_start_and_length (nframes_t new_start, nframes_t new_length) +AudioRegion::verify_start_and_length (nframes_t new_start, nframes_t& new_length) { boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(source()); @@ -355,11 +358,14 @@ AudioRegion::verify_start_and_length (nframes_t new_start, nframes_t new_length) return true; } + nframes_t maxlen = 0; + for (uint32_t n=0; n < sources.size(); ++n) { - if (new_length > sources[n]->length() - new_start) { - return false; - } + maxlen = max (maxlen, sources[n]->length() - new_start); } + + new_length = min (new_length, maxlen); + return true; } bool diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index afcbdc93be..37c7a4e5c8 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1155,11 +1155,10 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr<Region> if (what_changed & ARDOUR::LengthChanged) { delta += (nframes64_t) region->length() - (nframes64_t) region->last_length(); - } if (delta) { - possibly_splice (region->last_position(), delta, region); + possibly_splice (region->last_position() + region->last_length(), delta, region); } if (holding_state ()) { |