summaryrefslogtreecommitdiff
path: root/gtk2_ardour/rhythm_ferret.cc
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2017-02-04 12:58:33 +0000
committerJohn Emmas <johne53@tiscali.co.uk>2017-02-04 12:58:33 +0000
commitefd859a0ee590d4c09d09abddc4c3e9ca2d26fc1 (patch)
tree3525c79060aca43987e0ab435189dfb6be2ac7ca /gtk2_ardour/rhythm_ferret.cc
parentd1599abad301b81a05b208704434f19d8bb76d4e (diff)
Fix a crash in rhythm ferret if the relevant plugin couldn't be found for some reason
The crash was caused by not catching 'failed_constructor()' (which gets thrown in the c'tor for AudioAnalyser).
Diffstat (limited to 'gtk2_ardour/rhythm_ferret.cc')
-rw-r--r--gtk2_ardour/rhythm_ferret.cc36
1 files changed, 21 insertions, 15 deletions
diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc
index 4d39232d8c..2106f487d2 100644
--- a/gtk2_ardour/rhythm_ferret.cc
+++ b/gtk2_ardour/rhythm_ferret.cc
@@ -253,28 +253,34 @@ RhythmFerret::run_analysis ()
int
RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, frameoffset_t /*offset*/, AnalysisFeatureList& results)
{
- TransientDetector t (_session->frame_rate());
+ try {
+ TransientDetector t (_session->frame_rate());
- for (uint32_t i = 0; i < readable->n_channels(); ++i) {
+ for (uint32_t i = 0; i < readable->n_channels(); ++i) {
- AnalysisFeatureList these_results;
+ AnalysisFeatureList these_results;
- t.reset ();
- float dB = detection_threshold_adjustment.get_value();
- float coeff = dB > -80.0f ? pow (10.0f, dB * 0.05f) : 0.0f;
- t.set_threshold (coeff);
- t.set_sensitivity (4, sensitivity_adjustment.get_value());
+ t.reset ();
+ float dB = detection_threshold_adjustment.get_value();
+ float coeff = dB > -80.0f ? pow (10.0f, dB * 0.05f) : 0.0f;
+ t.set_threshold (coeff);
+ t.set_sensitivity (4, sensitivity_adjustment.get_value());
- if (t.run ("", readable.get(), i, these_results)) {
- continue;
- }
+ if (t.run ("", readable.get(), i, these_results)) {
+ continue;
+ }
- /* merge */
+ /* merge */
- results.insert (results.end(), these_results.begin(), these_results.end());
- these_results.clear ();
+ results.insert (results.end(), these_results.begin(), these_results.end());
+ these_results.clear ();
- t.update_positions (readable.get(), i, results);
+ t.update_positions (readable.get(), i, results);
+ }
+
+ } catch (failed_constructor& err) {
+ error << "Could not load percussion onset detection plugin" << endmsg;
+ return -1;
}
return 0;