diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-13 19:22:34 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-13 19:22:34 +0000 |
commit | f85161c5d0ac5649bf33cf7d165213295a2a9d16 (patch) | |
tree | 948c4b7f1ce631dfd23999ea56fc29ec9e209780 /libs/ardour/import.cc | |
parent | e10f59f96c429a88419a7caddfeaff75a8b19df4 (diff) |
"Ardour" -> PROGRAM_NAME change for libardour and setup for gtk2_ardour
git-svn-id: svn://localhost/ardour2/branches/3.0@6757 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/import.cc')
-rw-r--r-- | libs/ardour/import.cc | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index d621afe297..035772305a 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -63,10 +63,8 @@ #include "ardour/tempo.h" #ifdef HAVE_COREAUDIO -#ifdef USE_COREAUDIO_FOR_FILE_IO #include "ardour/caimportable.h" #endif -#endif #include "i18n.h" @@ -77,51 +75,45 @@ using namespace PBD; static boost::shared_ptr<ImportableSource> open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQuality quality) { -#ifdef HAVE_COREAUDIO -#ifdef USE_COREAUDIO_FOR_FILE_IO - - /* see if we can use CoreAudio to handle the IO */ - - try { - CAImportableSource* src = new CAImportableSource(path); - boost::shared_ptr<CAImportableSource> source (src); - + /* try libsndfile first, because it can get BWF info from .wav, which ExtAudioFile cannot. + We don't necessarily need that information in an ImportableSource, but it keeps the + logic the same as in SourceFactory::create() + */ + + try { + boost::shared_ptr<SndFileImportableSource> source(new SndFileImportableSource(path)); + if (source->samplerate() == samplerate) { return source; } - + /* rewrap as a resampled source */ - + return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality)); } catch (...) { - /* fall back to SndFile */ -#endif -#endif - - try { - boost::shared_ptr<SndFileImportableSource> source(new SndFileImportableSource(path)); - - if (source->samplerate() == samplerate) { - return source; - } - - /* rewrap as a resampled source */ +#ifdef HAVE_COREAUDIO - return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality)); + /* libsndfile failed, see if we can use CoreAudio to handle the IO */ + + CAImportableSource* src = new CAImportableSource(path); + boost::shared_ptr<CAImportableSource> source (src); + + if (source->samplerate() == samplerate) { + return source; } + + /* rewrap as a resampled source */ + + return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality)); - catch (...) { - throw; // rethrow - } +#else + throw; // rethrow +#endif -#ifdef HAVE_COREAUDIO -#ifdef USE_COREAUDIO_FOR_FILE_IO } -#endif -#endif } static std::string |