summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-19 03:29:16 +0000
committerDavid Robillard <d@drobilla.net>2006-09-19 03:29:16 +0000
commit7bd41538d951c3e476655df741adfbebbb990bde (patch)
treef9988f959571c75535341ab1de463b7cfc5209e3 /libs/ardour/source_factory.cc
parentc7307c09b8584b15610f0b29a40f839d9183419a (diff)
Merged with trunk R920.
git-svn-id: svn://localhost/ardour2/branches/midi@921 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc81
1 files changed, 47 insertions, 34 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index 61a7659a5e..29cd5166ff 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -37,7 +37,7 @@ sigc::signal<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated;
#ifdef HAVE_COREAUDIO
boost::shared_ptr<Source>
-SourceFactory::create (const XMLNode& node)
+SourceFactory::create (Session& s, const XMLNode& node)
{
DataType type = DataType::AUDIO;
const XMLProperty* prop = node.property("type");
@@ -49,11 +49,18 @@ SourceFactory::create (const XMLNode& node)
if (node.property (X_("destructive")) != 0) {
- boost::shared_ptr<Source> ret (new DestructiveFileSource (node));
+ boost::shared_ptr<Source> ret (new DestructiveFileSource (s, node));
SourceCreated (ret);
return ret;
} else {
+
+ try {
+ boost::shared_ptr<Source> ret (new CoreAudioSource (s, node));
+ SourceCreated (ret);
+ return ret;
+
+ } catch (failed_constructor& err) {
try {
boost::shared_ptr<Source> ret (new CoreAudioSource (node));
@@ -83,7 +90,7 @@ SourceFactory::create (const XMLNode& node)
#else
boost::shared_ptr<Source>
-SourceFactory::create (const XMLNode& node)
+SourceFactory::create (Session& s, const XMLNode& node)
{
DataType type = DataType::AUDIO;
const XMLProperty* prop = node.property("type");
@@ -95,20 +102,20 @@ SourceFactory::create (const XMLNode& node)
if (node.property (X_("destructive")) != 0) {
- boost::shared_ptr<Source> ret (new DestructiveFileSource (node));
+ boost::shared_ptr<Source> ret (new DestructiveFileSource (s, node));
SourceCreated (ret);
return ret;
} else {
- boost::shared_ptr<Source> ret (new SndFileSource (node));
+ boost::shared_ptr<Source> ret (new SndFileSource (s, node));
SourceCreated (ret);
return ret;
}
} else if (type == DataType::MIDI) {
-
- boost::shared_ptr<Source> ret (new SMFSource (node));
+
+ boost::shared_ptr<Source> ret (new SMFSource (s, node));
SourceCreated (ret);
return ret;
@@ -121,35 +128,34 @@ SourceFactory::create (const XMLNode& node)
#ifdef HAVE_COREAUDIO
boost::shared_ptr<Source>
-SourceFactory::createReadable (string idstr, AudioFileSource::Flag flags, bool announce)
+SourceFactory::createReadable (DataType type, Session& s, string idstr, AudioFileSource::Flag flags, bool announce)
{
if (type == DataType::AUDIO) {
if (flags & Destructive) {
- boost::shared_ptr<Source> ret (new DestructiveFileSource (idstr, flags));
+ boost::shared_ptr<Source> ret (new DestructiveFileSource (s, idstr, flags));
if (announce) {
SourceCreated (ret);
}
return ret;
- }
-
- try {
- boost::shared_ptr<Source> ret (new CoreAudioSource (idstr, flags));
- if (announce) {
- SourceCreated (ret);
+
+ try {
+ boost::shared_ptr<Source> ret (new CoreAudioSource (s, idstr, flags));
+ if (announce) {
+ SourceCreated (ret);
+ }
+ return ret;
+
+ } catch (failed_constructor& err) {
+ boost::shared_ptr<Source> ret (new SndFileSource (s, idstr, flags));
+ if (announce) {
+ SourceCreated (ret);
+ }
+ return ret;
}
- return ret;
- }
- catch (failed_constructor& err) {
- boost::shared_ptr<Source> ret (new SndFileSource (idstr, flags));
- if (announce) {
- SourceCreated (ret);
- }
- return ret;
- }
} else if (type == DataType::MIDI) {
- boost::shared_ptr<Source> ret (new SMFSource (node));
+ boost::shared_ptr<Source> ret (new SMFSource (s, node));
SourceCreated (ret);
return ret;
@@ -161,10 +167,11 @@ SourceFactory::createReadable (string idstr, AudioFileSource::Flag flags, bool a
#else
boost::shared_ptr<Source>
-SourceFactory::createReadable (DataType type, string idstr, AudioFileSource::Flag flags, bool announce)
+SourceFactory::createReadable (DataType type, Session& s, string idstr, AudioFileSource::Flag flags, bool announce)
{
if (type == DataType::AUDIO) {
- boost::shared_ptr<Source> ret (new SndFileSource (idstr, flags));
+
+ boost::shared_ptr<Source> ret (new SndFileSource (s, idstr, flags));
if (announce) {
SourceCreated (ret);
}
@@ -172,8 +179,10 @@ SourceFactory::createReadable (DataType type, string idstr, AudioFileSource::Fla
} else if (type == DataType::MIDI) {
- boost::shared_ptr<Source> ret (new SMFSource (idstr, SMFSource::Flag(0))); // FIXME: flags?
- SourceCreated (ret);
+ boost::shared_ptr<Source> ret (new SMFSource (s, idstr, SMFSource::Flag(0))); // FIXME: flags?
+ if (announce) {
+ SourceCreated (ret);
+ }
return ret;
}
@@ -184,13 +193,14 @@ SourceFactory::createReadable (DataType type, string idstr, AudioFileSource::Fla
#endif // HAVE_COREAUDIO
boost::shared_ptr<Source>
-SourceFactory::createWritable (DataType type, std::string path, bool destructive, jack_nframes_t rate, bool announce)
+SourceFactory::createWritable (DataType type, Session& s, std::string path, bool destructive, jack_nframes_t rate, bool announce)
{
/* this might throw failed_constructor(), which is OK */
if (type == DataType::AUDIO) {
if (destructive) {
- boost::shared_ptr<Source> ret (new DestructiveFileSource (path,
+
+ boost::shared_ptr<Source> ret (new DestructiveFileSource (s, path,
Config->get_native_file_data_format(),
Config->get_native_file_header_format(),
rate));
@@ -200,7 +210,8 @@ SourceFactory::createWritable (DataType type, std::string path, bool destructive
return ret;
} else {
- boost::shared_ptr<Source> ret (new SndFileSource (path,
+
+ boost::shared_ptr<Source> ret (new SndFileSource (s, path,
Config->get_native_file_data_format(),
Config->get_native_file_header_format(),
rate));
@@ -208,13 +219,15 @@ SourceFactory::createWritable (DataType type, std::string path, bool destructive
SourceCreated (ret);
}
return ret;
+
}
+
} else if (type == DataType::MIDI) {
- boost::shared_ptr<Source> ret (new SMFSource (path));
+ boost::shared_ptr<Source> ret (new SMFSource (s, path));
SourceCreated (ret);
return ret;
-
+
}
return boost::shared_ptr<Source> ();