diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-08-25 01:07:15 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-08-25 01:07:15 +0000 |
commit | ce234f363e95c38fc92728e520bf5ba240a89aa7 (patch) | |
tree | 96ce8c4734bdd564ec1f2ad0c36bc32f0b108204 /libs/ardour/session_timefx.cc | |
parent | 7e95f29ce95edf01d6d451f96fae03f3d3451ff8 (diff) |
use shared_ptr<> for all region handling
git-svn-id: svn://localhost/ardour2/trunk@852 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_timefx.cc')
-rw-r--r-- | libs/ardour/session_timefx.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/libs/ardour/session_timefx.cc b/libs/ardour/session_timefx.cc index 45733c75ae..2b6b45dad0 100644 --- a/libs/ardour/session_timefx.cc +++ b/libs/ardour/session_timefx.cc @@ -28,6 +28,7 @@ #include <ardour/session.h> #include <ardour/audioregion.h> #include <ardour/sndfilesource.h> +#include <ardour/region_factory.h> #include "i18n.h" @@ -36,12 +37,12 @@ using namespace ARDOUR; using namespace PBD; using namespace soundtouch; -AudioRegion* +boost::shared_ptr<AudioRegion> Session::tempoize_region (TimeStretchRequest& tsr) { - AudioRegion::SourceList sources; - AudioRegion::SourceList::iterator it; - AudioRegion* r = 0; + SourceList sources; + SourceList::iterator it; + boost::shared_ptr<AudioRegion> r; SoundTouch st; string region_name; string ident = X_("-TIMEFX-"); @@ -160,10 +161,9 @@ Session::tempoize_region (TimeStretchRequest& tsr) region_name = tsr.region->name() + X_(".t"); - r = new AudioRegion (sources, 0, sources.front()->length(), region_name, - 0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile)); - - + r = (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (sources, 0, sources.front()->length(), region_name, + 0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile)))); + out: if (sources.size()) { @@ -172,7 +172,7 @@ Session::tempoize_region (TimeStretchRequest& tsr) for deletion. */ - if ((r == 0 || !tsr.running)) { + if ((!r || !tsr.running)) { for (it = sources.begin(); it != sources.end(); ++it) { (*it)->mark_for_remove (); delete *it; @@ -183,10 +183,7 @@ Session::tempoize_region (TimeStretchRequest& tsr) /* if the process was cancelled, delete the region */ if (!tsr.running) { - if (r) { - delete r; - r = 0; - } + r.reset (); } return r; |