Add Playlist::duplicate_range/s utility methods
This commit is contained in:
parent
420206705d
commit
e6a33b818f
@ -142,6 +142,8 @@ public:
|
||||
void duplicate (boost::shared_ptr<Region>, framepos_t position, float times);
|
||||
void duplicate (boost::shared_ptr<Region>, framepos_t position, framecnt_t gap, float times);
|
||||
void duplicate_until (boost::shared_ptr<Region>, framepos_t position, framecnt_t gap, framepos_t end);
|
||||
void duplicate_range (AudioRange&, float times);
|
||||
void duplicate_ranges (std::list<AudioRange>&, float times);
|
||||
void nudge_after (framepos_t start, framecnt_t distance, bool forwards);
|
||||
boost::shared_ptr<Region> combine (const RegionList&);
|
||||
void uncombine (boost::shared_ptr<Region>);
|
||||
|
@ -1316,6 +1316,39 @@ Playlist::duplicate_until (boost::shared_ptr<Region> region, framepos_t position
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::duplicate_range (AudioRange& range, float times)
|
||||
{
|
||||
boost::shared_ptr<Playlist> pl = copy (range.start, range.length(), true);
|
||||
framecnt_t offset = range.end - range.start;
|
||||
paste (pl, range.start + offset, times);
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float /* times */)
|
||||
{
|
||||
if (ranges.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
framepos_t min_pos = max_framepos;
|
||||
framepos_t max_pos = 0;
|
||||
|
||||
for (std::list<AudioRange>::const_iterator i = ranges.begin();
|
||||
i != ranges.end();
|
||||
++i) {
|
||||
min_pos = min (min_pos, (*i).start);
|
||||
max_pos = max (max_pos, (*i).end);
|
||||
}
|
||||
|
||||
framecnt_t offset = max_pos - min_pos;
|
||||
|
||||
for (list<AudioRange>::iterator i = ranges.begin(); i != ranges.end(); ++i) {
|
||||
boost::shared_ptr<Playlist> pl = copy ((*i).start, (*i).length(), true);
|
||||
paste (pl, (*i).start + offset, 1.0f); // times ??
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::shift (framepos_t at, frameoffset_t distance, bool move_intersected, bool ignore_music_glue)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user