Use a few shared_ptrs to make things slightly neater.
git-svn-id: svn://localhost/ardour2/branches/3.0@11156 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
365a8f7f14
commit
b9a9d8d047
|
@ -4491,7 +4491,7 @@ Editor::get_regions_at (RegionSelection& rs, framepos_t where, const TrackViewLi
|
|||
|
||||
if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
|
||||
|
||||
Playlist::RegionList* regions = pl->regions_at (
|
||||
boost::shared_ptr<Playlist::RegionList> regions = pl->regions_at (
|
||||
(framepos_t) floor ( (double) where * tr->speed()));
|
||||
|
||||
for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
|
||||
|
@ -4500,8 +4500,6 @@ Editor::get_regions_at (RegionSelection& rs, framepos_t where, const TrackViewLi
|
|||
rs.add (rv);
|
||||
}
|
||||
}
|
||||
|
||||
delete regions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4526,7 +4524,7 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
|
|||
|
||||
if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
|
||||
|
||||
Playlist::RegionList* regions = pl->regions_touched (
|
||||
boost::shared_ptr<Playlist::RegionList> regions = pl->regions_touched (
|
||||
(framepos_t) floor ( (double)where * tr->speed()), max_framepos);
|
||||
|
||||
for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
|
||||
|
@ -4537,8 +4535,6 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
|
|||
rs.push_back (rv);
|
||||
}
|
||||
}
|
||||
|
||||
delete regions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -568,7 +568,7 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item,
|
|||
boost::shared_ptr<AudioPlaylist> pl;
|
||||
if ((pl = boost::dynamic_pointer_cast<AudioPlaylist> (atv->track()->playlist())) != 0) {
|
||||
|
||||
Playlist::RegionList* rl = pl->regions_at (event_frame (event));
|
||||
boost::shared_ptr<Playlist::RegionList> rl = pl->regions_at (event_frame (event));
|
||||
if (!rl->empty()) {
|
||||
|
||||
if (atv->layer_display() == Overlaid) {
|
||||
|
@ -580,8 +580,6 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item,
|
|||
|
||||
RegionView* rv = atv->view()->find_view (rl->front());
|
||||
|
||||
delete rl;
|
||||
|
||||
/* proxy */
|
||||
return canvas_region_view_event (event, rv->get_canvas_group(), rv);
|
||||
|
||||
|
@ -627,15 +625,12 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item,
|
|||
|
||||
if (i != rl->end()) {
|
||||
RegionView* rv = atv->view()->find_view (*i);
|
||||
delete rl;
|
||||
|
||||
/* proxy */
|
||||
return canvas_region_view_event (event, rv->get_canvas_group(), rv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete rl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,11 +151,11 @@ public:
|
|||
|
||||
const RegionListProperty& region_list () const { return regions; }
|
||||
|
||||
RegionList* regions_at (framepos_t frame);
|
||||
boost::shared_ptr<RegionList> regions_at (framepos_t frame);
|
||||
uint32_t count_regions_at (framepos_t) const;
|
||||
uint32_t count_joined_regions () const;
|
||||
RegionList* regions_touched (framepos_t start, framepos_t end);
|
||||
RegionList* regions_to_read (framepos_t start, framepos_t end);
|
||||
boost::shared_ptr<RegionList> regions_touched (framepos_t start, framepos_t end);
|
||||
boost::shared_ptr<RegionList> regions_to_read (framepos_t start, framepos_t end);
|
||||
uint32_t region_use_count (boost::shared_ptr<Region>) const;
|
||||
boost::shared_ptr<Region> find_region (const PBD::ID&) const;
|
||||
boost::shared_ptr<Region> top_region_at (framepos_t frame);
|
||||
|
@ -340,7 +340,6 @@ public:
|
|||
bool add_region_internal (boost::shared_ptr<Region>, framepos_t position);
|
||||
|
||||
int remove_region_internal (boost::shared_ptr<Region>);
|
||||
RegionList *find_regions_at (framepos_t);
|
||||
void copy_regions (RegionList&) const;
|
||||
void partition_internal (framepos_t start, framepos_t end, bool cutting, RegionList& thawlist);
|
||||
|
||||
|
@ -382,6 +381,7 @@ public:
|
|||
private:
|
||||
|
||||
void setup_layering_indices (RegionList const &) const;
|
||||
boost::shared_ptr<RegionList> find_regions_at (framepos_t);
|
||||
};
|
||||
|
||||
} /* namespace ARDOUR */
|
||||
|
|
|
@ -289,10 +289,9 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
|
|||
|
||||
framepos_t const end = start + cnt - 1;
|
||||
|
||||
RegionList* rlist = regions_to_read (start, start+cnt);
|
||||
boost::shared_ptr<RegionList> rlist = regions_to_read (start, start+cnt);
|
||||
|
||||
if (rlist->empty()) {
|
||||
delete rlist;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
@ -353,7 +352,6 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
|
|||
}
|
||||
}
|
||||
|
||||
delete rlist;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -492,7 +490,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
|
|||
boost::shared_ptr<AudioRegion> top;
|
||||
boost::shared_ptr<AudioRegion> bottom;
|
||||
boost::shared_ptr<Crossfade> xfade;
|
||||
RegionList* touched_regions = 0;
|
||||
boost::shared_ptr<RegionList> touched_regions;
|
||||
|
||||
if (in_set_state || in_partition) {
|
||||
return;
|
||||
|
@ -543,8 +541,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
|
|||
|
||||
OverlapType c = top->coverage (bottom->position(), bottom->last_frame());
|
||||
|
||||
delete touched_regions;
|
||||
touched_regions = 0;
|
||||
touched_regions.reset ();
|
||||
|
||||
try {
|
||||
framecnt_t xfade_length;
|
||||
|
@ -657,8 +654,6 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
delete touched_regions;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1634,13 +1634,12 @@ Playlist::flush_notifications (bool from_undo)
|
|||
FINDING THINGS
|
||||
**********************************************************************/
|
||||
|
||||
Playlist::RegionList *
|
||||
Playlist::regions_at (framepos_t frame)
|
||||
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
return find_regions_at (frame);
|
||||
}
|
||||
boost::shared_ptr<Playlist::RegionList>
|
||||
Playlist::regions_at (framepos_t frame)
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
return find_regions_at (frame);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Playlist::count_regions_at (framepos_t frame) const
|
||||
|
@ -1662,7 +1661,7 @@ Playlist::flush_notifications (bool from_undo)
|
|||
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
RegionList *rlist = find_regions_at (frame);
|
||||
boost::shared_ptr<RegionList> rlist = find_regions_at (frame);
|
||||
boost::shared_ptr<Region> region;
|
||||
|
||||
if (rlist->size()) {
|
||||
|
@ -1671,7 +1670,6 @@ Playlist::flush_notifications (bool from_undo)
|
|||
region = rlist->back();
|
||||
}
|
||||
|
||||
delete rlist;
|
||||
return region;
|
||||
}
|
||||
|
||||
|
@ -1680,7 +1678,7 @@ Playlist::flush_notifications (bool from_undo)
|
|||
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
RegionList *rlist = find_regions_at (frame);
|
||||
boost::shared_ptr<RegionList> rlist = find_regions_at (frame);
|
||||
|
||||
for (RegionList::iterator i = rlist->begin(); i != rlist->end(); ) {
|
||||
|
||||
|
@ -1702,13 +1700,12 @@ Playlist::flush_notifications (bool from_undo)
|
|||
region = rlist->back();
|
||||
}
|
||||
|
||||
delete rlist;
|
||||
return region;
|
||||
}
|
||||
|
||||
Playlist::RegionList*
|
||||
Playlist::regions_to_read (framepos_t start, framepos_t end)
|
||||
{
|
||||
boost::shared_ptr<Playlist::RegionList>
|
||||
Playlist::regions_to_read (framepos_t start, framepos_t end)
|
||||
{
|
||||
/* Caller must hold lock */
|
||||
|
||||
RegionList covering;
|
||||
|
@ -1772,7 +1769,7 @@ Playlist::flush_notifications (bool from_undo)
|
|||
}
|
||||
}
|
||||
|
||||
RegionList* rlist = new RegionList;
|
||||
boost::shared_ptr<RegionList> rlist (new RegionList);
|
||||
|
||||
/* find all the regions that cover each position .... */
|
||||
|
||||
|
@ -1841,36 +1838,36 @@ Playlist::flush_notifications (bool from_undo)
|
|||
return rlist;
|
||||
}
|
||||
|
||||
Playlist::RegionList *
|
||||
Playlist::find_regions_at (framepos_t frame)
|
||||
{
|
||||
/* Caller must hold lock */
|
||||
boost::shared_ptr<Playlist::RegionList>
|
||||
Playlist::find_regions_at (framepos_t frame)
|
||||
{
|
||||
/* Caller must hold lock */
|
||||
|
||||
boost::shared_ptr<RegionList> rlist (new RegionList);
|
||||
|
||||
RegionList *rlist = new RegionList;
|
||||
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
if ((*i)->covers (frame)) {
|
||||
rlist->push_back (*i);
|
||||
}
|
||||
}
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
if ((*i)->covers (frame)) {
|
||||
rlist->push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
return rlist;
|
||||
}
|
||||
|
||||
boost::shared_ptr<Playlist::RegionList>
|
||||
Playlist::regions_touched (framepos_t start, framepos_t end)
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
boost::shared_ptr<RegionList> rlist (new RegionList);
|
||||
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
if ((*i)->coverage (start, end) != OverlapNone) {
|
||||
rlist->push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
return rlist;
|
||||
}
|
||||
|
||||
Playlist::RegionList *
|
||||
Playlist::regions_touched (framepos_t start, framepos_t end)
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
RegionList *rlist = new RegionList;
|
||||
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
if ((*i)->coverage (start, end) != OverlapNone) {
|
||||
rlist->push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
return rlist;
|
||||
}
|
||||
}
|
||||
|
||||
framepos_t
|
||||
Playlist::find_next_transient (framepos_t from, int dir)
|
||||
|
|
Loading…
Reference in New Issue