diff options
author | Taybin Rutkin <taybin@taybin.com> | 2007-05-18 11:06:54 +0000 |
---|---|---|
committer | Taybin Rutkin <taybin@taybin.com> | 2007-05-18 11:06:54 +0000 |
commit | de9187f0edd3937e4f78262854a079a2fdba6643 (patch) | |
tree | 59066f95ec520768e139c4288139d7ac3db140b4 /libs/ardour/source_factory.cc | |
parent | 91b67c1d98e6936c580a5846cdde0521ce537752 (diff) |
fix for compiling with COREAUDIO=yes. Hopefully this fix will prevent future drifting.
git-svn-id: svn://localhost/ardour2/trunk@1880 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r-- | libs/ardour/source_factory.cc | 99 |
1 files changed, 18 insertions, 81 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 143d564809..148f737551 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -60,18 +60,20 @@ SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes, return ret; } -#ifdef HAVE_COREAUDIO boost::shared_ptr<Source> SourceFactory::create (Session& s, const XMLNode& node) { + /* this is allowed to throw */ + DataType type = DataType::AUDIO; const XMLProperty* prop = node.property("type"); if (prop) { type = DataType(prop->value()); } - + if (type == DataType::AUDIO) { - + +#ifdef HAVE_COREAUDIO try { boost::shared_ptr<Source> ret (new CoreAudioSource (s, node)); if (setup_peakfile (ret)) { @@ -92,32 +94,7 @@ SourceFactory::create (Session& s, const XMLNode& node) SourceCreated (ret); return ret; } - - } else if (type == DataType::MIDI) { - - boost::shared_ptr<Source> ret (new SMFSource (node)); - SourceCreated (ret); - return ret; - } - - return boost::shared_ptr<Source>(); -} - #else - -boost::shared_ptr<Source> -SourceFactory::create (Session& s, const XMLNode& node) -{ - /* this is allowed to throw */ - - DataType type = DataType::AUDIO; - const XMLProperty* prop = node.property("type"); - if (prop) { - type = DataType(prop->value()); - } - - if (type == DataType::AUDIO) { - boost::shared_ptr<Source> ret (new SndFileSource (s, node)); if (setup_peakfile (ret)) { @@ -126,6 +103,7 @@ SourceFactory::create (Session& s, const XMLNode& node) SourceCreated (ret); return ret; +#endif } else if (type == DataType::MIDI) { @@ -139,42 +117,24 @@ SourceFactory::create (Session& s, const XMLNode& node) return boost::shared_ptr<Source> (); } -#endif // HAVE_COREAUDIO - -#ifdef HAVE_COREAUDIO boost::shared_ptr<Source> SourceFactory::createReadable (DataType type, Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce) { if (type == DataType::AUDIO) { - if (!(flags & Destructive)) { - - try { - boost::shared_ptr<Source> ret (new CoreAudioSource (s, path, chn, flags)); - if (setup_peakfile (ret)) { - return boost::shared_ptr<Source>(); - } - if (announce) { - SourceCreated (ret); - } - return ret; + +#ifdef HAVE_COREAUDIO + try { + boost::shared_ptr<Source> ret (new CoreAudioSource (s, path, chn, flags)); + if (setup_peakfile (ret)) { + return boost::shared_ptr<Source>(); } - - catch (failed_constructor& err) { - boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags)); - if (setup_peakfile (ret)) { - return boost::shared_ptr<Source>(); - } - if (announce) { - SourceCreated (ret); - } - return ret; + if (announce) { + SourceCreated (ret); } + return ret; + } - } else { - - - /* this is allowed to throw */ - + catch (failed_constructor& err) { boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags)); if (setup_peakfile (ret)) { return boost::shared_ptr<Source>(); @@ -184,28 +144,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, } return ret; } - - return boost::shared_ptr<Source>(); - } else if (type == DataType::MIDI) { - - boost::shared_ptr<Source> ret (new SMFSource (s, node)); - if (announce) { - SourceCreated (ret); - } - return ret; - - } - - return boost::shared_ptr<Source>(); -} - #else - -boost::shared_ptr<Source> -SourceFactory::createReadable (DataType type, Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce) -{ - if (type == DataType::AUDIO) { - boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags)); if (setup_peakfile (ret)) { @@ -217,7 +156,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, } return ret; - +#endif } else if (type == DataType::MIDI) { @@ -234,8 +173,6 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, return boost::shared_ptr<Source>(); } -#endif // HAVE_COREAUDIO - boost::shared_ptr<Source> SourceFactory::createWritable (DataType type, Session& s, std::string path, bool destructive, nframes_t rate, bool announce) { |