From 41b23ca647c100a3e2cd1641aff52f77216db803 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 13 May 2011 19:55:39 +0000 Subject: 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 --- libs/ardour/source_factory.cc | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'libs/ardour/source_factory.cc') 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 (); } +boost::shared_ptr +SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr 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 ap = boost::dynamic_pointer_cast(p); + + if (ap) { + Source* src = new AudioPlaylistSource (s, name, ap, chn, start, len, copy, flags); + boost::shared_ptr ret (src); + + if (setup_peakfile (ret, defer_peaks)) { + return boost::shared_ptr(); + } + + 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(); +} + -- cgit v1.2.3