From da42014c4d0508725447b820446eff94be241a19 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 30 Mar 2015 10:48:31 +0200 Subject: fix crash #6161 - another throw w/o catch The real problem is: libardourvampplugins:* cannot be instantiated this remains to be fixed. --- libs/ardour/analyser.cc | 21 ++++++++++++++------- libs/ardour/audioregion.cc | 37 ++++++++++++++++++++++--------------- 2 files changed, 36 insertions(+), 22 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/analyser.cc b/libs/ardour/analyser.cc index bf98ecc20a..fa22bd757d 100644 --- a/libs/ardour/analyser.cc +++ b/libs/ardour/analyser.cc @@ -22,6 +22,10 @@ #include "ardour/session_event.h" #include "ardour/transient_detector.h" +#include "pbd/compose.h" +#include "pbd/error.h" +#include "i18n.h" + using namespace std; using namespace ARDOUR; using namespace PBD; @@ -102,13 +106,16 @@ Analyser::analyse_audio_file_source (boost::shared_ptr src) { AnalysisFeatureList results; - TransientDetector td (src->sample_rate()); - - if (td.run (src->get_transients_path(), src.get(), 0, results) == 0) { - src->set_been_analysed (true); - } else { + try { + TransientDetector td (src->sample_rate()); + if (td.run (src->get_transients_path(), src.get(), 0, results) == 0) { + src->set_been_analysed (true); + } else { + src->set_been_analysed (false); + } + } catch (...) { + error << string_compose(_("Transient Analysis failed for %1."), _("Audio File Source")) << endmsg;; src->set_been_analysed (false); + return; } - } - diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 1ea788880b..37bf3e1fed 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -1696,31 +1696,38 @@ in this and future transient-detection operations.\n\ } } - TransientDetector t (pl->session().frame_rate()); bool existing_results = !results.empty(); - _transients.clear (); - _valid_transients = false; + try { - for (uint32_t i = 0; i < n_channels(); ++i) { + TransientDetector t (pl->session().frame_rate()); - AnalysisFeatureList these_results; + _transients.clear (); + _valid_transients = false; - t.reset (); + for (uint32_t i = 0; i < n_channels(); ++i) { - if (t.run ("", this, i, these_results)) { - return -1; - } + AnalysisFeatureList these_results; - /* translate all transients to give absolute position */ + t.reset (); - for (AnalysisFeatureList::iterator i = these_results.begin(); i != these_results.end(); ++i) { - (*i) += _position; - } + if (t.run ("", this, i, these_results)) { + return -1; + } - /* merge */ + /* translate all transients to give absolute position */ - _transients.insert (_transients.end(), these_results.begin(), these_results.end()); + for (AnalysisFeatureList::iterator i = these_results.begin(); i != these_results.end(); ++i) { + (*i) += _position; + } + + /* merge */ + + _transients.insert (_transients.end(), these_results.begin(), these_results.end()); + } + } catch (...) { + error << string_compose(_("Transient Analysis failed for %1."), _("Audio Region")) << endmsg; + return -1; } if (!results.empty()) { -- cgit v1.2.3