-
Notifications
You must be signed in to change notification settings - Fork 716
/
Copy pathrhythm_ferret.h
135 lines (103 loc) · 3.53 KB
/
rhythm_ferret.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
Copyright (C) 2012 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __gtk2_ardour_rhythm_ferret_h__
#define __gtk2_ardour_rhythm_ferret_h__
#include <gtkmm/box.h>
#include <gtkmm/scale.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/radiobuttongroup.h>
#include <gtkmm/frame.h>
#include <gtkmm/image.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/button.h>
#include "ardour_dialog.h"
#include "region_selection.h"
namespace ARDOUR {
class Readable;
}
class Editor;
class RegionView;
class RhythmFerret : public ArdourDialog
{
public:
/* order of these enums must match the _analyse_mode_strings
* in rhythm_ferret.cc
*/
enum AnalysisMode {
PercussionOnset,
NoteOnset
};
enum Action {
SplitRegion,
SnapRegionsToGrid,
ConformRegion
};
RhythmFerret (Editor&);
void set_session (ARDOUR::Session*);
void on_response (int);
protected:
void on_hide ();
private:
Editor& editor;
Gtk::ComboBoxText operation_selector;
Gtk::ComboBoxText analysis_mode_selector;
/* transient detection widgets */
Gtk::Adjustment detection_threshold_adjustment;
Gtk::HScale detection_threshold_scale;
Gtk::Adjustment sensitivity_adjustment;
Gtk::HScale sensitivity_scale;
Gtk::Button analyze_button;
/* onset detection widgets */
Gtk::ComboBoxText onset_detection_function_selector;
Gtk::Adjustment peak_picker_threshold_adjustment;
Gtk::HScale peak_picker_threshold_scale;
Gtk::Adjustment silence_threshold_adjustment;
Gtk::HScale silence_threshold_scale;
#ifdef HAVE_AUBIO4
Gtk::Adjustment minioi_adjustment;
Gtk::HScale minioi_scale;
#endif
/* generic stuff */
Gtk::Adjustment trigger_gap_adjustment;
Gtk::SpinButton trigger_gap_spinner;
Gtk::CheckButton filter_to_grid;
Gtk::Button action_button;
std::vector<std::string> analysis_mode_strings;
std::vector<std::string> onset_function_strings;
std::vector<std::string> operation_strings;
ARDOUR::AnalysisFeatureList current_results;
void clear_transients ();
/** Regions that we have added transient marks to */
RegionSelection regions_with_transients;
AnalysisMode get_analysis_mode () const;
Action get_action() const;
void analysis_mode_changed ();
int get_note_onset_function ();
void run_analysis ();
int run_percussion_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::sampleoffset_t offset, ARDOUR::AnalysisFeatureList& results);
int run_note_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::sampleoffset_t offset, ARDOUR::AnalysisFeatureList& results);
void do_action ();
void do_split_action ();
void do_region_split (RegionView* rv, const ARDOUR::AnalysisFeatureList&);
};
struct GridFilterElement {
GridFilterElement(RegionView* reg_view, samplepos_t onset, samplepos_t snaped);
samplepos_t snaped_sample;
samplepos_t sample;
samplepos_t distance;
RegionView* region_view;
};
#endif /* __gtk2_ardour_rhythm_ferret_h__ */