summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-05-16 20:16:57 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-05-16 20:16:57 +0000
commit99aa8c6338e47b41143f799fdcb35d1699548076 (patch)
treea61140fd331b49a408894f00dcb8976cbb6543b8 /libs/ardour/source_factory.cc
parent4b848856ebc2856bf7ab10a000cc88bdd3bc4a4a (diff)
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
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc80
1 files changed, 50 insertions, 30 deletions
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<Source> ret (src);
- if (setup_peakfile (ret, defer_peaks)) {
- return boost::shared_ptr<Source>();
- }
- 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<AudioPlaylistSource> ap (new AudioPlaylistSource (s, node));
+
+ if (setup_peakfile (ap, true)) {
+ return boost::shared_ptr<Source>();
+ }
- /* 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<Source> ret (src);
-
- if (setup_peakfile (ret, defer_peaks)) {
- return boost::shared_ptr<Source>();
+ boost::shared_ptr<Source> ret (src);
+ if (setup_peakfile (ret, defer_peaks)) {
+ return boost::shared_ptr<Source>();
+ }
+ 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<Source> ret (src);
+
+ if (setup_peakfile (ret, defer_peaks)) {
+ return boost::shared_ptr<Source>();
+ }
+
+ 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<SMFSource> 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;
}
}