summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-02-05 22:57:38 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-02-05 22:57:38 +0000
commit672a31a552ae0bd67d40a0c078306d3a63a44746 (patch)
tree25260fcee20b92a67a1eed34f7d00f55d6b4c56c /libs/ardour/source_factory.cc
parent87ee8fd71fccd28632d7201a6778803015110d6a (diff)
use SilentFileSource when sources cannot be found
git-svn-id: svn://localhost/ardour2/trunk@1424 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc31
1 files changed, 25 insertions, 6 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index 2cbd7624be..7b2103cdc6 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -22,6 +22,7 @@
#include <ardour/source_factory.h>
#include <ardour/sndfilesource.h>
+#include <ardour/silentfilesource.h>
#include <ardour/destructive_filesource.h>
#include <ardour/configuration.h>
@@ -51,6 +52,17 @@ SourceFactory::setup_peakfile (boost::shared_ptr<Source> s)
return 0;
}
+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));
+ if (setup_peakfile (ret)) {
+ return boost::shared_ptr<Source>();
+ }
+ SourceCreated (ret);
+ return ret;
+}
+
#ifdef HAVE_COREAUDIO
boost::shared_ptr<Source>
SourceFactory::create (Session& s, const XMLNode& node)
@@ -63,9 +75,12 @@ SourceFactory::create (Session& s, const XMLNode& node)
SourceCreated (ret);
return ret;
}
-
-
- catch (failed_constructor& err) {
+
+
+ catch (failed_constructor& err) {
+
+ /* this is allowed to throw */
+
boost::shared_ptr<Source> ret (new SndFileSource (s, node));
if (setup_peakfile (ret)) {
return boost::shared_ptr<Source>();
@@ -82,14 +97,15 @@ SourceFactory::create (Session& s, const XMLNode& node)
boost::shared_ptr<Source>
SourceFactory::create (Session& s, const XMLNode& node)
{
- boost::shared_ptr<Source> ret (new SndFileSource (s, node));
+ /* this is allowed to throw */
+ boost::shared_ptr<Source> ret (new SndFileSource (s, node));
+
if (setup_peakfile (ret)) {
return boost::shared_ptr<Source>();
}
-
+
SourceCreated (ret);
-
return ret;
}
@@ -113,6 +129,9 @@ SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource
}
catch (failed_constructor& err) {
+
+ /* this is allowed to throw */
+
boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags));
if (setup_peakfile (ret)) {
return boost::shared_ptr<Source>();