13
0

Add Playlist::duplicate_range/s utility methods

This commit is contained in:
Tim Mayberry 2016-01-27 23:04:33 +10:00
parent 420206705d
commit e6a33b818f
2 changed files with 35 additions and 0 deletions

View File

@ -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>);

View File

@ -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)
{