mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-03 12:19:33 +01:00
insert time operation
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3203 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
9d415be53e
commit
bc3b41703e
16 changed files with 238 additions and 9 deletions
|
|
@ -89,6 +89,8 @@ class Playlist : public PBD::StatefulDestructible, public boost::enable_shared_f
|
|||
void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
|
||||
void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, nframes_t pos);
|
||||
void split_region (boost::shared_ptr<Region>, nframes_t position);
|
||||
void split (nframes64_t at);
|
||||
void shift (nframes64_t at, nframes64_t distance, bool move_intersected, bool ignore_music_glue);
|
||||
void partition (nframes_t start, nframes_t end, bool just_top_level);
|
||||
void duplicate (boost::shared_ptr<Region>, nframes_t position, float times);
|
||||
void nudge_after (nframes_t start, nframes_t distance, bool forwards);
|
||||
|
|
@ -276,6 +278,8 @@ class Playlist : public PBD::StatefulDestructible, public boost::enable_shared_f
|
|||
void unset_freeze_child (Playlist*);
|
||||
|
||||
void timestamp_layer_op (boost::shared_ptr<Region>);
|
||||
|
||||
void _split_region (boost::shared_ptr<Region>, nframes_t position);
|
||||
};
|
||||
|
||||
} /* namespace ARDOUR */
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ class Region : public PBD::StatefulDestructible, public Readable, public boost::
|
|||
|
||||
PositionLockStyle positional_lock_style() const { return _positional_lock_style; }
|
||||
void set_position_lock_style (PositionLockStyle ps);
|
||||
void recompute_position_from_lock_style ();
|
||||
|
||||
virtual bool should_save_state () const { return !(_flags & DoNotSaveState); };
|
||||
|
||||
|
|
|
|||
|
|
@ -1013,11 +1013,68 @@ Playlist::duplicate (boost::shared_ptr<Region> region, nframes_t position, float
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::shift (nframes64_t at, nframes64_t distance, bool move_intersected, bool ignore_music_glue)
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
RegionList copy (regions);
|
||||
RegionList fixup;
|
||||
|
||||
for (RegionList::iterator r = copy.begin(); r != copy.end(); ++r) {
|
||||
|
||||
if ((*r)->last_frame() < at) {
|
||||
/* too early */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (at > (*r)->first_frame() && at < (*r)->last_frame()) {
|
||||
/* intersected region */
|
||||
if (!move_intersected) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* do not move regions glued to music time - that
|
||||
has to be done separately.
|
||||
*/
|
||||
|
||||
if (!ignore_music_glue && (*r)->positional_lock_style() != Region::AudioTime) {
|
||||
fixup.push_back (*r);
|
||||
continue;
|
||||
}
|
||||
|
||||
(*r)->set_position ((*r)->position() + distance, this);
|
||||
}
|
||||
|
||||
for (RegionList::iterator r = fixup.begin(); r != fixup.end(); ++r) {
|
||||
(*r)->recompute_position_from_lock_style ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::split (nframes64_t at)
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
RegionList copy (regions);
|
||||
|
||||
/* use a copy since this operation can modify the region list
|
||||
*/
|
||||
|
||||
for (RegionList::iterator r = copy.begin(); r != copy.end(); ++r) {
|
||||
_split_region (*r, at);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::split_region (boost::shared_ptr<Region> region, nframes_t playlist_position)
|
||||
{
|
||||
RegionLock rl (this);
|
||||
_split_region (region, playlist_position);
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::_split_region (boost::shared_ptr<Region> region, nframes_t playlist_position)
|
||||
{
|
||||
if (!region->covers (playlist_position)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,11 +352,8 @@ Region::set_position_internal (nframes_t pos, bool allow_bbt_recompute)
|
|||
_length = max_frames - _position;
|
||||
}
|
||||
|
||||
if (allow_bbt_recompute && _positional_lock_style == MusicTime) {
|
||||
boost::shared_ptr<Playlist> pl (playlist());
|
||||
if (pl) {
|
||||
pl->session().tempo_map().bbt_time (_position, _bbt_time);
|
||||
}
|
||||
if (allow_bbt_recompute) {
|
||||
recompute_position_from_lock_style ();
|
||||
}
|
||||
|
||||
invalidate_transients ();
|
||||
|
|
@ -394,6 +391,17 @@ Region::set_position_on_top (nframes_t pos, void *src)
|
|||
send_change (PositionChanged);
|
||||
}
|
||||
|
||||
void
|
||||
Region::recompute_position_from_lock_style ()
|
||||
{
|
||||
if (_positional_lock_style == MusicTime) {
|
||||
boost::shared_ptr<Playlist> pl (playlist());
|
||||
if (pl) {
|
||||
pl->session().tempo_map().bbt_time (_position, _bbt_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Region::nudge_position (nframes64_t n, void *src)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue