changes to help strp silence
[ardour.git] / gtk2_ardour / rhythm_ferret.cc
index aeaff98a540a717145dc0bbdbd2f9b6933441589..de18fe7b5d907d3c75e67d3c8c0ce8c45209bfda 100644 (file)
@@ -2,6 +2,7 @@
 #include <gtkmm2ext/utils.h>
 
 #include "pbd/memento_command.h"
+#include "pbd/convert.h"
 
 #include "ardour/transient_detector.h"
 #include "ardour/onset_detector.h"
@@ -92,17 +93,17 @@ RhythmFerret::RhythmFerret (PublicEditor& e)
 
        ferret_packer.set_spacing (6);
        ferret_packer.set_border_width (6);
-       
+
        vector<string> strings;
 
        analysis_mode_strings = I18N (_analysis_mode_strings);
        Gtkmm2ext::set_popdown_strings (analysis_mode_selector, analysis_mode_strings);
        analysis_mode_selector.set_active_text (analysis_mode_strings.front());
-       analysis_mode_selector.signal_changed().connect (mem_fun (*this, &RhythmFerret::analysis_mode_changed));
+       analysis_mode_selector.signal_changed().connect (sigc::mem_fun (*this, &RhythmFerret::analysis_mode_changed));
 
        onset_function_strings = I18N (_onset_function_strings);
        Gtkmm2ext::set_popdown_strings (onset_detection_function_selector, onset_function_strings);
-       /* Onset plugin uses complex domain as default function 
+       /* Onset plugin uses complex domain as default function
           XXX there should be a non-hacky way to set this
         */
        onset_detection_function_selector.set_active_text (onset_function_strings[3]);
@@ -123,14 +124,14 @@ RhythmFerret::RhythmFerret (PublicEditor& e)
 
        ferret_packer.pack_start (analyze_button, false, false);
 
-       analyze_button.signal_clicked().connect (mem_fun (*this, &RhythmFerret::run_analysis));
-       
+       analyze_button.signal_clicked().connect (sigc::mem_fun (*this, &RhythmFerret::run_analysis));
+
        box = manage (new HBox);
        box->set_spacing (6);
        box->pack_start (detection_threshold_label, false, false);
        box->pack_start (detection_threshold_scale, true, true);
        perc_onset_packer.pack_start (*box, false, false);
-               
+
        box = manage (new HBox);
        box->set_spacing (6);
        box->pack_start (sensitivity_label, false, false);
@@ -142,13 +143,13 @@ RhythmFerret::RhythmFerret (PublicEditor& e)
        box->pack_start (onset_function_label, false, false);
        box->pack_start (onset_detection_function_selector, true, true);
        note_onset_packer.pack_start (*box, false, false);
-               
+
        box = manage (new HBox);
        box->set_spacing (6);
        box->pack_start (peak_picker_label, false, false);
        box->pack_start (peak_picker_threshold_scale, true, true);
        note_onset_packer.pack_start (*box, false, false);
-       
+
        box = manage (new HBox);
        box->set_spacing (6);
        box->pack_start (silence_label, false, false);
@@ -158,7 +159,7 @@ RhythmFerret::RhythmFerret (PublicEditor& e)
        analysis_mode_changed ();
 
        ferret_frame.add (ferret_packer);
-       
+
        logo = manage (new Gtk::Image (::get_icon (X_("ferret_02"))));
 
        if (logo) {
@@ -170,8 +171,8 @@ RhythmFerret::RhythmFerret (PublicEditor& e)
        lower_hpacker.set_border_width (6);
        lower_hpacker.set_spacing (6);
 
-       action_button.signal_clicked().connect (mem_fun (*this, &RhythmFerret::do_action));
-       
+       action_button.signal_clicked().connect (sigc::mem_fun (*this, &RhythmFerret::do_action));
+
        get_vbox()->set_border_width (6);
        get_vbox()->set_spacing (6);
        get_vbox()->pack_start (upper_hpacker, true, true);
@@ -210,7 +211,7 @@ RhythmFerret::get_analysis_mode () const
 
        if (str == analysis_mode_strings[(int) NoteOnset]) {
                return NoteOnset;
-       } 
+       }
 
        return PercussionOnset;
 }
@@ -230,7 +231,7 @@ RhythmFerret::get_action () const
 void
 RhythmFerret::run_analysis ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -268,7 +269,7 @@ RhythmFerret::run_analysis ()
 int
 RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, AnalysisFeatureList& results)
 {
-       TransientDetector t (session->frame_rate());
+       TransientDetector t (_session->frame_rate());
 
        for (uint32_t i = 0; i < readable->n_channels(); ++i) {
 
@@ -289,13 +290,13 @@ RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readabl
                }
 
                /* merge */
-               
+
                results.insert (results.end(), these_results.begin(), these_results.end());
                these_results.clear ();
        }
 
        if (!results.empty()) {
-               TransientDetector::cleanup_transients (results, session->frame_rate(), trigger_gap_adjustment.get_value());
+               TransientDetector::cleanup_transients (results, _session->frame_rate(), trigger_gap_adjustment.get_value());
        }
 
        return 0;
@@ -322,30 +323,30 @@ int
 RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, AnalysisFeatureList& results)
 {
        try {
-               OnsetDetector t (session->frame_rate());
-               
+               OnsetDetector t (_session->frame_rate());
+
                for (uint32_t i = 0; i < readable->n_channels(); ++i) {
-                       
+
                        AnalysisFeatureList these_results;
-                       
+
                        t.reset ();
-                       
+
                        t.set_function (get_note_onset_function());
                        t.set_silence_threshold (silence_threshold_adjustment.get_value());
                        t.set_peak_threshold (peak_picker_threshold_adjustment.get_value());
-                       
+
                        if (t.run ("", readable.get(), i, these_results)) {
                                continue;
                        }
-                       
+
                        /* translate all transients to give absolute position */
-                       
+
                        for (AnalysisFeatureList::iterator x = these_results.begin(); x != these_results.end(); ++x) {
                                (*x) += offset;
                        }
-                       
+
                        /* merge */
-                       
+
                        results.insert (results.end(), these_results.begin(), these_results.end());
                        these_results.clear ();
                }
@@ -356,7 +357,7 @@ RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, nfr
        }
 
        if (!results.empty()) {
-               OnsetDetector::cleanup_onsets (results, session->frame_rate(), trigger_gap_adjustment.get_value());
+               OnsetDetector::cleanup_onsets (results, _session->frame_rate(), trigger_gap_adjustment.get_value());
        }
 
        return 0;
@@ -365,7 +366,7 @@ RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, nfr
 void
 RhythmFerret::do_action ()
 {
-       if (!session || current_results.empty()) {
+       if (!_session || current_results.empty()) {
                return;
        }
 
@@ -390,7 +391,7 @@ RhythmFerret::do_split_action ()
                return;
        }
 
-       session->begin_reversible_command (_("split regions (rhythm ferret)"));
+       _session->begin_reversible_command (_("split regions (rhythm ferret)"));
 
        for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ) {
 
@@ -407,8 +408,8 @@ RhythmFerret::do_split_action ()
 
                i = tmp;
        }
-       
-       session->commit_reversible_command ();
+
+       _session->commit_reversible_command ();
 }
 
 void