diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-08-29 00:23:45 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-08-29 00:23:45 +0000 |
commit | 6535cd1b1dbab7cc59a356c81d92dbc2cf25333b (patch) | |
tree | 90002ec1819c61db4b0981405d27535af3a79f70 /libs/ardour/session_timefx.cc | |
parent | c871ca6d9833ebda3bf286462b96146550b49cef (diff) |
used shared_ptr<Source>, somewhat successfully
git-svn-id: svn://localhost/ardour2/trunk@861 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_timefx.cc')
-rw-r--r-- | libs/ardour/session_timefx.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/ardour/session_timefx.cc b/libs/ardour/session_timefx.cc index 2b6b45dad0..dc00cf499c 100644 --- a/libs/ardour/session_timefx.cc +++ b/libs/ardour/session_timefx.cc @@ -29,6 +29,7 @@ #include <ardour/audioregion.h> #include <ardour/sndfilesource.h> #include <ardour/region_factory.h> +#include <ardour/source_factory.h> #include "i18n.h" @@ -81,10 +82,8 @@ Session::tempoize_region (TimeStretchRequest& tsr) } try { - sources.push_back (new SndFileSource (path, - Config->get_native_file_data_format(), - Config->get_native_file_header_format(), - frame_rate())); + sources.push_back (boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createWritable (path, false, frame_rate()))); + } catch (failed_constructor& err) { error << string_compose (_("tempoize: error creating new audio file %1 (%2)"), path, strerror (errno)) << endmsg; goto out; @@ -153,7 +152,7 @@ Session::tempoize_region (TimeStretchRequest& tsr) xnow = localtime (&now); for (it = sources.begin(); it != sources.end(); ++it) { - AudioFileSource* afs = dynamic_cast<AudioFileSource*>(*it); + boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(*it); if (afs) { afs->update_header (tsr.region->position(), *xnow, now); } @@ -175,9 +174,10 @@ Session::tempoize_region (TimeStretchRequest& tsr) if ((!r || !tsr.running)) { for (it = sources.begin(); it != sources.end(); ++it) { (*it)->mark_for_remove (); - delete *it; } } + + sources.clear (); } /* if the process was cancelled, delete the region */ |