2 Copyright (C) 2012 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk2_ardour_rhythm_ferret_h__
21 #define __gtk2_ardour_rhythm_ferret_h__
23 #include <gtkmm/box.h>
24 #include <gtkmm/scale.h>
25 #include <gtkmm/spinbutton.h>
26 #include <gtkmm/radiobutton.h>
27 #include <gtkmm/radiobuttongroup.h>
28 #include <gtkmm/frame.h>
29 #include <gtkmm/image.h>
30 #include <gtkmm/comboboxtext.h>
31 #include <gtkmm/button.h>
33 #include "ardour_dialog.h"
34 #include "region_selection.h"
43 class RhythmFerret : public ArdourDialog {
45 /* order of these enums must match the _analyse_mode_strings
59 RhythmFerret (Editor&);
61 void set_session (ARDOUR::Session*);
69 Gtk::ComboBoxText operation_selector;
71 Gtk::ComboBoxText analysis_mode_selector;
73 /* transient detection widgets */
75 Gtk::Adjustment detection_threshold_adjustment;
76 Gtk::HScale detection_threshold_scale;
77 Gtk::Adjustment sensitivity_adjustment;
78 Gtk::HScale sensitivity_scale;
79 Gtk::Button analyze_button;
81 /* onset detection widgets */
83 Gtk::ComboBoxText onset_detection_function_selector;
84 Gtk::Adjustment peak_picker_threshold_adjustment;
85 Gtk::HScale peak_picker_threshold_scale;
86 Gtk::Adjustment silence_threshold_adjustment;
87 Gtk::HScale silence_threshold_scale;
91 Gtk::Adjustment trigger_gap_adjustment;
92 Gtk::SpinButton trigger_gap_spinner;
94 Gtk::Button action_button;
96 std::vector<std::string> analysis_mode_strings;
97 std::vector<std::string> onset_function_strings;
98 std::vector<std::string> operation_strings;
100 ARDOUR::AnalysisFeatureList current_results;
102 void clear_transients ();
103 /** Regions that we have added transient marks to */
104 RegionSelection regions_with_transients;
106 AnalysisMode get_analysis_mode () const;
107 Action get_action() const;
108 void analysis_mode_changed ();
109 int get_note_onset_function ();
111 void run_analysis ();
112 int run_percussion_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::frameoffset_t offset, ARDOUR::AnalysisFeatureList& results);
113 int run_note_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::frameoffset_t offset, ARDOUR::AnalysisFeatureList& results);
116 void do_split_action ();
117 void do_region_split (RegionView* rv, const ARDOUR::AnalysisFeatureList&);
120 #endif /* __gtk2_ardour_rhythm_ferret_h__ */