summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-12 13:51:33 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-12 13:51:33 +0000
commit08f55722b492ec4401a5162236a57009612f526c (patch)
tree4494ece86cd808567524a06878cc39edc0232361
parent637b0423acf1672ee5acdbb3d5469b995e213660 (diff)
keep sndfile/ExtAudioFile preference logic the same in ImportableSource as elsewhere
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6751 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/import.cc45
1 files changed, 21 insertions, 24 deletions
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index b53fafa5f9..496c43fca2 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -58,51 +58,48 @@
using namespace ARDOUR;
using namespace PBD;
-
static boost::shared_ptr<ImportableSource>
open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQuality quality)
{
-#ifdef HAVE_COREAUDIO
-
- /* see if we can use CoreAudio to handle the IO */
+ /* 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 {
- CAImportableSource* src = new CAImportableSource(path);
- boost::shared_ptr<CAImportableSource> source (src);
+ 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
+#ifdef HAVE_COREAUDIO
- 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));
- }
+ /* libsndfile failed, see if we can use CoreAudio to handle the IO */
+
+ CAImportableSource* src = new CAImportableSource(path);
+ boost::shared_ptr<CAImportableSource> source (src);
- catch (...) {
- throw; // rethrow
+ if (source->samplerate() == samplerate) {
+ return source;
}
-#ifdef HAVE_COREAUDIO
- }
+ /* rewrap as a resampled source */
+
+ return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality));
+
+#else
+ throw; // rethrow
#endif
+
+ }
}
static std::string