summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-02-02 17:22:04 +0000
committerDavid Robillard <d@drobilla.net>2008-02-02 17:22:04 +0000
commit80c3677c837cc9eb432df3d65a34aba543fa7258 (patch)
treeca23bb7e5bff6c35c151d73221002a9ce3abfe1a /libs/ardour/source_factory.cc
parent9f63ab9931e6478472853bdda58da47ea29ac125 (diff)
Merge with 2.0-ongoing R2988
git-svn-id: svn://localhost/ardour2/branches/3.0@2991 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc108
1 files changed, 60 insertions, 48 deletions
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<Source>
SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes, float sr)
{
boost::shared_ptr<Source> 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<Source>
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<Source> ret (new CoreAudioSource (s, node));
-
- if (setup_peakfile (ret, defer_peaks)) {
- return boost::shared_ptr<Source>();
- }
-
- SourceCreated (ret);
- return ret;
- }
-
-
- catch (failed_constructor& err) {
-
- /* this is allowed to throw */
-
- boost::shared_ptr<Source> ret (new SndFileSource (s, node));
-
- if (setup_peakfile (ret, defer_peaks)) {
- return boost::shared_ptr<Source>();
- }
-
- SourceCreated (ret);
- return ret;
- }
+ try {
+ boost::shared_ptr<Source> ret (new CoreAudioSource (s, node));
+
+ if (setup_peakfile (ret, defer_peaks)) {
+ return boost::shared_ptr<Source>();
+ }
+
+ ret->check_for_analysis_data_on_disk ();
+ SourceCreated (ret);
+ return ret;
+ }
+
+
+ catch (failed_constructor& err) {
+
+ /* this is allowed to throw */
+
+ boost::shared_ptr<Source> ret (new SndFileSource (s, node));
+
+ if (setup_peakfile (ret, defer_peaks)) {
+ return boost::shared_ptr<Source>();
+ }
+
+ ret->check_for_analysis_data_on_disk ();
+ SourceCreated (ret);
+ return ret;
+ }
#else
- /* this is allowed to throw */
-
- boost::shared_ptr<Source> ret (new SndFileSource (s, node));
-
- if (setup_peakfile (ret, defer_peaks)) {
- return boost::shared_ptr<Source>();
- }
-
- SourceCreated (ret);
- return ret;
+ /* this is allowed to throw */
+
+ boost::shared_ptr<Source> ret (new SndFileSource (s, node));
+
+ if (setup_peakfile (ret, defer_peaks)) {
+ return boost::shared_ptr<Source>();
+ }
+
+ ret->check_for_analysis_data_on_disk ();
+ SourceCreated (ret);
+ return ret;
#endif
-
- } else if (type == DataType::MIDI) {
- boost::shared_ptr<Source> ret (new SMFSource (s, node));
-
- SourceCreated (ret);
- return ret;
- }
+
+ } else if (type == DataType::MIDI) {
+ boost::shared_ptr<Source> ret (new SMFSource (s, node));
+ ret->check_for_analysis_data_on_disk ();
+ SourceCreated (ret);
+ return ret;
+ }
return boost::shared_ptr<Source>();
}
@@ -190,6 +194,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn,
return boost::shared_ptr<Source>();
}
+ 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<Source>();
}
+ 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<Source>();
}
+ 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<Source> 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<Source>();
}
+
+ // 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<Source> ret (new SMFSource (s, path));
+
+ // no analysis data - this is a new file
if (announce) {
SourceCreated (ret);