diff options
author | Robin Gareus <robin@gareus.org> | 2019-12-06 18:06:13 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-12-06 18:16:10 +0100 |
commit | 227de8c1b04b68c9e50b6de5adaac435f257f33c (patch) | |
tree | aad71ddd69728650e5f99889bea554b726b630a5 /libs/ardour/import.cc | |
parent | 6d99e1b1622dfc4e568dc6efc566a1192a3c123a (diff) |
Flatten nested try/catch clauses
This also consistently throws a failed_constructor() when instantiating
SoundFile fails, regardless of the actual exception
Diffstat (limited to 'libs/ardour/import.cc')
-rw-r--r-- | libs/ardour/import.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index ee6bd6db89..578be0956a 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -80,9 +80,9 @@ static boost::shared_ptr<ImportableSource> open_importable_source (const string& path, samplecnt_t samplerate, ARDOUR::SrcQuality quality) { /* 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() - */ + * 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)); @@ -92,16 +92,12 @@ open_importable_source (const string& path, samplecnt_t samplerate, ARDOUR::SrcQ } /* rewrap as a resampled source */ - return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality)); - } - - catch (...) { + } catch (...) { } + /* libsndfile failed, see if we can use CoreAudio to handle the IO */ #ifdef HAVE_COREAUDIO - - /* libsndfile failed, see if we can use CoreAudio to handle the IO */ - + try { CAImportableSource* src = new CAImportableSource(path); boost::shared_ptr<CAImportableSource> source (src); @@ -110,14 +106,11 @@ open_importable_source (const string& path, samplecnt_t samplerate, ARDOUR::SrcQ } /* rewrap as a resampled source */ - return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality)); - -#else - throw; // rethrow + } catch (...) { } #endif - } + throw failed_constructor (); } vector<string> |