#include <gtkmm2ext/utils.h>
#include "pbd/memento_command.h"
+#include "pbd/convert.h"
#include "ardour/transient_detector.h"
#include "ardour/onset_detector.h"
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]);
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);
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);
analysis_mode_changed ();
ferret_frame.add (ferret_packer);
-
+
logo = manage (new Gtk::Image (::get_icon (X_("ferret_02"))));
if (logo) {
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);
if (str == analysis_mode_strings[(int) NoteOnset]) {
return NoteOnset;
- }
+ }
return PercussionOnset;
}
void
RhythmFerret::run_analysis ()
{
- if (!session) {
+ if (!_session) {
return;
}
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) {
}
/* 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;
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 ();
}
}
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;
void
RhythmFerret::do_action ()
{
- if (!session || current_results.empty()) {
+ if (!_session || current_results.empty()) {
return;
}
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(); ) {
i = tmp;
}
-
- session->commit_reversible_command ();
+
+ _session->commit_reversible_command ();
}
void