diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-05-13 19:55:39 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-05-13 19:55:39 +0000 |
commit | 41b23ca647c100a3e2cd1641aff52f77216db803 (patch) | |
tree | eb93e387b7cfe9b62f3b6c29478f8544fb749a21 /libs/ardour/source_factory.cc | |
parent | d0bb7df866faa48bb4aac7f947a72501e3dd61c3 (diff) |
initial volley of work for AudioPlaylistSource, the basic prototype for sources-that-are-nested
git-svn-id: svn://localhost/ardour2/branches/3.0@9507 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r-- | libs/ardour/source_factory.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 5ac1e54226..891e431549 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -28,6 +28,8 @@ #include "pbd/pthread_utils.h" #include "pbd/stacktrace.h" +#include "ardour/audioplaylist.h" +#include "ardour/audio_playlist_source.h" #include "ardour/source_factory.h" #include "ardour/sndfilesource.h" #include "ardour/silentfilesource.h" @@ -322,3 +324,42 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat return boost::shared_ptr<Source> (); } +boost::shared_ptr<Source> +SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<Playlist> p, const std::string& name, + uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, Source::Flag flags, + bool announce, bool defer_peaks) +{ + if (type == DataType::AUDIO) { + try { + + boost::shared_ptr<AudioPlaylist> ap = boost::dynamic_pointer_cast<AudioPlaylist>(p); + + if (ap) { + Source* src = new AudioPlaylistSource (s, name, ap, chn, start, len, copy, flags); + boost::shared_ptr<Source> ret (src); + + if (setup_peakfile (ret, defer_peaks)) { + return boost::shared_ptr<Source>(); + } + + ret->check_for_analysis_data_on_disk (); + + if (announce) { + SourceCreated (ret); + } + + return ret; + } + } + + catch (failed_constructor& err) { + /* relax - return at function scope */ + } + + } else if (type == DataType::MIDI) { + + } + + return boost::shared_ptr<Source>(); +} + |