merge with 2.0-ongoing @ rev 3147
[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         Gtk::Adjustment detection_threshold_adjustment;
75         Gtk::HScale detection_threshold_scale;
76         Gtk::Label detection_threshold_label;
77         Gtk::Adjustment sensitivity_adjustment;
78         Gtk::HScale sensitivity_scale;
79         Gtk::Label sensitivity_label;
80         Gtk::Button analyze_button;
81         Gtk::Adjustment trigger_gap_adjustment;
82         Gtk::SpinButton trigger_gap_spinner;
83         Gtk::Label trigger_gap_label;
84
85         Gtk::Label operation_clarification_label;
86         Gtk::Button action_button;
87
88         std::vector<std::string> analysis_mode_strings;
89
90         ARDOUR::AnalysisFeatureList current_results;
91
92         AnalysisMode get_analysis_mode () const;
93         Action get_action() const;
94
95         void run_analysis ();
96         int run_percussion_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, nframes64_t offset, ARDOUR::AnalysisFeatureList& results);
97
98         void do_action ();
99         void do_split_action ();
100         void do_region_split (RegionView* rv, const ARDOUR::AnalysisFeatureList&);
101 };
102
103 #endif /* __gtk2_ardour_rhythm_ferret_h__ */