megaopus patch #2 for today: remove nframes64_t and sframes_t from source
[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
14 #include "ardour_dialog.h"
15
16 namespace ARDOUR {
17         class Readable;
18 }
19
20 class Editor;
21 class RegionView;
22
23 class RhythmFerret : public ArdourDialog {
24   public:
25         /* order of these enums must match the _analyse_mode_strings
26            in rhythm_ferret.cc
27         */
28         enum AnalysisMode {
29                 PercussionOnset,
30                 NoteOnset
31         };
32
33         enum Action {
34                 SplitRegion,
35                 DefineTempoMap,
36                 ConformRegion
37         };
38
39         RhythmFerret (Editor&);
40
41         void set_session (ARDOUR::Session*);
42
43   protected:
44         void on_hide ();
45
46   private:
47         Editor& editor;
48
49         Gtk::ComboBoxText operation_selector;
50
51         Gtk::ComboBoxText analysis_mode_selector;
52
53         /* transient detection widgets */
54
55         Gtk::Adjustment detection_threshold_adjustment;
56         Gtk::HScale detection_threshold_scale;
57         Gtk::Adjustment sensitivity_adjustment;
58         Gtk::HScale sensitivity_scale;
59         Gtk::Button analyze_button;
60
61         /* onset detection widgets */
62
63         Gtk::ComboBoxText onset_detection_function_selector;
64         Gtk::Adjustment peak_picker_threshold_adjustment;
65         Gtk::HScale peak_picker_threshold_scale;
66         Gtk::Adjustment silence_threshold_adjustment;
67         Gtk::HScale silence_threshold_scale;
68
69         /* generic stuff */
70
71         Gtk::Adjustment trigger_gap_adjustment;
72         Gtk::SpinButton trigger_gap_spinner;
73
74         Gtk::Button action_button;
75
76         std::vector<std::string> analysis_mode_strings;
77         std::vector<std::string> onset_function_strings;
78         std::vector<std::string> operation_strings;
79
80         ARDOUR::AnalysisFeatureList current_results;
81
82         AnalysisMode get_analysis_mode () const;
83         Action get_action() const;
84         void analysis_mode_changed ();
85         int get_note_onset_function ();
86
87         void run_analysis ();
88         int run_percussion_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::frameoffset_t offset, ARDOUR::AnalysisFeatureList& results);
89         int run_note_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::frameoffset_t offset, ARDOUR::AnalysisFeatureList& results);
90
91         void do_action ();
92         void do_split_action ();
93         void do_region_split (RegionView* rv, const ARDOUR::AnalysisFeatureList&);
94 };
95
96 #endif /* __gtk2_ardour_rhythm_ferret_h__ */