Strip trailing whitespace and fix other whitespace errors (e.g. space/tab mixing...
[ardour.git] / gtk2_ardour / rhythm_ferret.h
1 #ifndef __gtk2_ardour_rhythm_ferret_h__
2 #define __gtk2_ardour_rhythm_ferret_h__
3
4 #include <gtkmm/box.h>
5 #include <gtkmm/scale.h>
6 #include <gtkmm/spinbutton.h>
7 #include <gtkmm/radiobutton.h>
8 #include <gtkmm/radiobuttongroup.h>
9 #include <gtkmm/frame.h>
10 #include <gtkmm/image.h>
11 #include <gtkmm/comboboxtext.h>
12 #include <gtkmm/button.h>
13 #include <gtkmm/label.h>
14
15 #include "ardour_dialog.h"
16
17 namespace ARDOUR {
18         class Readable;
19 }
20
21 class PublicEditor;
22 class RegionView;
23
24 class RhythmFerret : public ArdourDialog {
25   public:
26         /* order of these enums must match the _analyse_mode_strings
27            in rhythm_ferret.cc
28         */
29         enum AnalysisMode {
30                 PercussionOnset,
31                 NoteOnset
32         };
33
34         enum Action {
35                 SplitRegion,
36                 DefineTempoMap,
37                 ConformRegion
38         };
39
40         RhythmFerret (PublicEditor&);
41         ~RhythmFerret ();
42
43         void set_session (ARDOUR::Session*);
44
45   protected:
46         void on_hide ();
47
48   private:
49         PublicEditor& editor;
50
51         Gtk::HBox  upper_hpacker;
52         Gtk::HBox  lower_hpacker;
53
54         Gtk::Frame operation_frame;
55         Gtk::Frame selection_frame;
56         Gtk::Frame ferret_frame;
57
58         Gtk::VBox  op_logo_packer;
59         Gtk::Image* logo;
60
61         /* operation frame */
62
63         Gtk::VBox op_packer;
64         Gtk::RadioButtonGroup operation_button_group;
65         Gtk::RadioButton region_split_button;
66         Gtk::RadioButton tempo_button;
67         Gtk::RadioButton region_conform_button;
68
69         /* analysis frame */
70
71         Gtk::VBox ferret_packer;
72         Gtk::ComboBoxText analysis_mode_selector;
73         Gtk::Label analysis_mode_label;
74
75         /* transient detection widgets */
76
77         Gtk::Adjustment detection_threshold_adjustment;
78         Gtk::HScale detection_threshold_scale;
79         Gtk::Label detection_threshold_label;
80         Gtk::Adjustment sensitivity_adjustment;
81         Gtk::HScale sensitivity_scale;
82         Gtk::Label sensitivity_label;
83         Gtk::Button analyze_button;
84         Gtk::VBox perc_onset_packer;
85
86         /* onset detection widgets */
87
88         Gtk::ComboBoxText onset_detection_function_selector;
89         Gtk::Label onset_function_label;
90         Gtk::Adjustment peak_picker_threshold_adjustment;
91         Gtk::HScale peak_picker_threshold_scale;
92         Gtk::Label peak_picker_label;
93         Gtk::Adjustment silence_threshold_adjustment;
94         Gtk::HScale silence_threshold_scale;
95         Gtk::Label silence_label;
96         Gtk::VBox note_onset_packer;
97
98         /* generic stuff */
99
100         Gtk::Adjustment trigger_gap_adjustment;
101         Gtk::SpinButton trigger_gap_spinner;
102         Gtk::Label trigger_gap_label;
103
104         Gtk::VBox analysis_packer;
105
106         Gtk::Label operation_clarification_label;
107         Gtk::Button action_button;
108
109         std::vector<std::string> analysis_mode_strings;
110         std::vector<std::string> onset_function_strings;
111
112         ARDOUR::AnalysisFeatureList current_results;
113
114         AnalysisMode get_analysis_mode () const;
115         Action get_action() const;
116         void analysis_mode_changed ();
117         int get_note_onset_function ();
118
119         void run_analysis ();
120         int run_percussion_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, nframes64_t offset, ARDOUR::AnalysisFeatureList& results);
121         int run_note_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, nframes64_t offset, ARDOUR::AnalysisFeatureList& results);
122
123         void do_action ();
124         void do_split_action ();
125         void do_region_split (RegionView* rv, const ARDOUR::AnalysisFeatureList&);
126 };
127
128 #endif /* __gtk2_ardour_rhythm_ferret_h__ */