From 80c3677c837cc9eb432df3d65a34aba543fa7258 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 2 Feb 2008 17:22:04 +0000 Subject: Merge with 2.0-ongoing R2988 git-svn-id: svn://localhost/ardour2/branches/3.0@2991 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/source_factory.cc | 108 +++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 48 deletions(-) (limited to 'libs/ardour/source_factory.cc') diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 02c35d2188..804d4a4d47 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -111,6 +111,7 @@ boost::shared_ptr SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes, float sr) { boost::shared_ptr ret (new SilentFileSource (s, node, nframes, sr)); + // no analysis data - the file is non-existent SourceCreated (ret); return ret; } @@ -118,61 +119,64 @@ SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes, boost::shared_ptr SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) { - DataType type = DataType::AUDIO; - const XMLProperty* prop = node.property("type"); + DataType type = DataType::AUDIO; + const XMLProperty* prop = node.property("type"); - if (prop) { - type = DataType(prop->value()); - } + if (prop) { + type = DataType(prop->value()); + } - if (type == DataType::AUDIO) { + if (type == DataType::AUDIO) { #ifdef HAVE_COREAUDIO - try { - boost::shared_ptr ret (new CoreAudioSource (s, node)); - - if (setup_peakfile (ret, defer_peaks)) { - return boost::shared_ptr(); - } - - SourceCreated (ret); - return ret; - } - - - catch (failed_constructor& err) { - - /* this is allowed to throw */ - - boost::shared_ptr ret (new SndFileSource (s, node)); - - if (setup_peakfile (ret, defer_peaks)) { - return boost::shared_ptr(); - } - - SourceCreated (ret); - return ret; - } + try { + boost::shared_ptr ret (new CoreAudioSource (s, node)); + + if (setup_peakfile (ret, defer_peaks)) { + return boost::shared_ptr(); + } + + ret->check_for_analysis_data_on_disk (); + SourceCreated (ret); + return ret; + } + + + catch (failed_constructor& err) { + + /* this is allowed to throw */ + + boost::shared_ptr ret (new SndFileSource (s, node)); + + if (setup_peakfile (ret, defer_peaks)) { + return boost::shared_ptr(); + } + + ret->check_for_analysis_data_on_disk (); + SourceCreated (ret); + return ret; + } #else - /* this is allowed to throw */ - - boost::shared_ptr ret (new SndFileSource (s, node)); - - if (setup_peakfile (ret, defer_peaks)) { - return boost::shared_ptr(); - } - - SourceCreated (ret); - return ret; + /* this is allowed to throw */ + + boost::shared_ptr ret (new SndFileSource (s, node)); + + if (setup_peakfile (ret, defer_peaks)) { + return boost::shared_ptr(); + } + + ret->check_for_analysis_data_on_disk (); + SourceCreated (ret); + return ret; #endif - - } else if (type == DataType::MIDI) { - boost::shared_ptr ret (new SMFSource (s, node)); - - SourceCreated (ret); - return ret; - } + + } else if (type == DataType::MIDI) { + boost::shared_ptr ret (new SMFSource (s, node)); + ret->check_for_analysis_data_on_disk (); + SourceCreated (ret); + return ret; + } return boost::shared_ptr(); } @@ -190,6 +194,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, return boost::shared_ptr(); } + ret->check_for_analysis_data_on_disk (); if (announce) { SourceCreated (ret); } @@ -201,6 +206,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); } + ret->check_for_analysis_data_on_disk (); if (announce) { SourceCreated (ret); } @@ -213,6 +219,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, return boost::shared_ptr(); } + ret->check_for_analysis_data_on_disk (); if (announce) { SourceCreated (ret); } @@ -225,6 +232,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, // FIXME: flags? boost::shared_ptr ret (new SMFSource (s, path, SMFSource::Flag(0))); + ret->check_for_analysis_data_on_disk (); if (announce) { SourceCreated (ret); } @@ -252,6 +260,8 @@ SourceFactory::createWritable (DataType type, Session& s, std::string path, bool if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); } + + // no analysis data - this is a new file if (announce) { SourceCreated (ret); @@ -261,6 +271,8 @@ SourceFactory::createWritable (DataType type, Session& s, std::string path, bool } else if (type == DataType::MIDI) { boost::shared_ptr ret (new SMFSource (s, path)); + + // no analysis data - this is a new file if (announce) { SourceCreated (ret); -- cgit v1.2.3