From 99aa8c6338e47b41143f799fdcb35d1699548076 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 16 May 2011 20:16:57 +0000 Subject: rename join regions op as combine regions; save and restore nested playlists, sources, regions; add undo/redo for combine; fixup peakfile use/discovery git-svn-id: svn://localhost/ardour2/branches/3.0@9528 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/source_factory.cc | 80 +++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 30 deletions(-) (limited to 'libs/ardour/source_factory.cc') diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 4d3f02b1dc..57f0fdc1ec 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -147,44 +147,66 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) if (type == DataType::AUDIO) { - try { - Source* src = new SndFileSource (s, node); -#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS - // boost_debug_shared_ptr_mark_interesting (src, "Source"); -#endif - boost::shared_ptr ret (src); - if (setup_peakfile (ret, defer_peaks)) { - return boost::shared_ptr(); - } - ret->check_for_analysis_data_on_disk (); - SourceCreated (ret); - return ret; - } + /* it could be nested */ - catch (failed_constructor& err) { + if (node.property ("playlist") != 0) { -#ifdef USE_COREAUDIO_FOR_FILES + try { + boost::shared_ptr ap (new AudioPlaylistSource (s, node)); + + if (setup_peakfile (ap, true)) { + return boost::shared_ptr(); + } - /* this is allowed to throw */ + ap->check_for_analysis_data_on_disk (); + SourceCreated (ap); + return ap; - Source *src = new CoreAudioSource (s, node); + } catch (failed_constructor&) { + /* oh well, so much for that then ... */ + } + + } else { + + + try { + Source* src = new SndFileSource (s, node); #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS - // boost_debug_shared_ptr_mark_interesting (src, "Source"); + // boost_debug_shared_ptr_mark_interesting (src, "Source"); #endif - boost::shared_ptr ret (src); - - if (setup_peakfile (ret, defer_peaks)) { - return boost::shared_ptr(); + boost::shared_ptr ret (src); + if (setup_peakfile (ret, defer_peaks)) { + return boost::shared_ptr(); + } + ret->check_for_analysis_data_on_disk (); + SourceCreated (ret); + return ret; } - ret->check_for_analysis_data_on_disk (); - SourceCreated (ret); - return ret; + catch (failed_constructor& err) { + +#ifdef USE_COREAUDIO_FOR_FILES + + /* this is allowed to throw */ + + Source *src = new CoreAudioSource (s, node); +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS + // boost_debug_shared_ptr_mark_interesting (src, "Source"); +#endif + boost::shared_ptr ret (src); + + if (setup_peakfile (ret, defer_peaks)) { + return boost::shared_ptr(); + } + + ret->check_for_analysis_data_on_disk (); + SourceCreated (ret); + return ret; #else - throw; // rethrow + throw; // rethrow #endif + } } - } else if (type == DataType::MIDI) { boost::shared_ptr src (new SMFSource (s, node)); src->load_model (true, true); @@ -348,9 +370,7 @@ SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr< } ret->check_for_analysis_data_on_disk (); - - /* we never announce these sources */ - + SourceCreated (ret); return ret; } } -- cgit v1.2.3