13
0

Tidy up rhythm ferret dialogue a bit and move its menu option into the Region menu.

git-svn-id: svn://localhost/ardour2/branches/3.0@7029 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-04-30 13:29:14 +00:00
parent 30aad22680
commit 7df6278865
4 changed files with 67 additions and 149 deletions

View File

@ -272,6 +272,8 @@
<menuitem action='set-punch-from-region'/>
<menuitem action='add-range-marker-from-region'/>
<menuitem action='add-range-markers-from-region'/>
<separator/>
<menuitem action='toggle-rhythm-ferret'/>
</menu>
<menu action='TrackMenu'>
@ -428,7 +430,6 @@
<menuitem action='ToggleBundleManager'/>
<menuitem action='ToggleThemeManager'/>
<menuitem action='ToggleBigClock'/>
<menuitem action='toggle-rhythm-ferret'/>
<menuitem action='toggle-audio-connection-manager'/>
<menuitem action='toggle-midi-connection-manager'/>
<menuitem action='toggle-log-window'/>

View File

@ -522,8 +522,9 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "split-region-at-transients", _("Split Regions At Percussion Onsets"), sigc::mem_fun(*this, &Editor::split_region_at_transients));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-rhythm-ferret", _("Rhythm Ferret"), sigc::mem_fun(*this, &Editor::show_rhythm_ferret));
act = ActionManager::register_action (editor_actions, "toggle-rhythm-ferret", _("Rhythm Ferret..."), sigc::mem_fun(*this, &Editor::show_rhythm_ferret));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-audio-connection-manager", _("Audio Connection Manager"), sigc::bind (sigc::mem_fun (*this, &Editor::show_global_port_matrix), ARDOUR::DataType::AUDIO));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-midi-connection-manager", _("MIDI Connection Manager"), sigc::bind (sigc::mem_fun (*this, &Editor::show_global_port_matrix), ARDOUR::DataType::MIDI));

View File

@ -46,55 +46,32 @@ static const gchar * _onset_function_strings[] = {
0
};
static const gchar * _operation_strings[] = {
N_("Split region"),
N_("Set tempo map"),
N_("Conform region"),
0
};
RhythmFerret::RhythmFerret (PublicEditor& e)
: ArdourDialog (_("Rhythm Ferret"))
, editor (e)
, operation_frame (_("Operation"))
, selection_frame (_("Selection"))
, ferret_frame (_("Analysis"))
, logo (0)
, region_split_button (operation_button_group, _("Split region"))
, tempo_button (operation_button_group, _("Set tempo map"))
, region_conform_button (operation_button_group, _("Conform region"))
, analysis_mode_label (_("Mode"))
, detection_threshold_adjustment (3, 0, 20, 1, 4)
, detection_threshold_scale (detection_threshold_adjustment)
, detection_threshold_label (_("Threshold"))
, sensitivity_adjustment (40, 0, 100, 1, 10)
, sensitivity_scale (sensitivity_adjustment)
, sensitivity_label (_("Sensitivity"))
, analyze_button (_("Analyze"))
, onset_function_label (_("Detection function"))
, peak_picker_threshold_adjustment (0.3, 0.0, 1.0, 0.01, 0.1)
, peak_picker_threshold_scale (peak_picker_threshold_adjustment)
, peak_picker_label (_("Peak Threshold"))
, silence_threshold_adjustment (-90.0, -120.0, 0.0, 1, 10)
, silence_threshold_scale (silence_threshold_adjustment)
, silence_label (_("Silent Threshold (dB)"))
, trigger_gap_adjustment (3, 0, 100, 1, 10)
, trigger_gap_spinner (trigger_gap_adjustment)
, trigger_gap_label (_("Trigger gap (msecs)"))
, action_button (Stock::APPLY)
{
upper_hpacker.set_spacing (6);
upper_hpacker.pack_start (ferret_frame, true, true);
upper_hpacker.pack_start (selection_frame, true, true);
upper_hpacker.pack_start (operation_frame, true, true);
op_packer.pack_start (region_split_button, false, false);
op_packer.pack_start (tempo_button, false, false);
op_packer.pack_start (region_conform_button, false, false);
operation_frame.add (op_packer);
HBox* box;
ferret_packer.set_spacing (6);
ferret_packer.set_border_width (6);
vector<string> strings;
operation_strings = I18N (_operation_strings);
Gtkmm2ext::set_popdown_strings (operation_selector, operation_strings);
operation_selector.set_active (0);
analysis_mode_strings = I18N (_analysis_mode_strings);
Gtkmm2ext::set_popdown_strings (analysis_mode_selector, analysis_mode_strings);
@ -108,100 +85,71 @@ RhythmFerret::RhythmFerret (PublicEditor& e)
*/
onset_detection_function_selector.set_active_text (onset_function_strings[3]);
box = manage (new HBox);
box->set_spacing (6);
box->pack_start (analysis_mode_label, false, false);
box->pack_start (analysis_mode_selector, true, true);
ferret_packer.pack_start (*box, false, false);
Table* t = manage (new Table (7, 3));
t->set_spacings (12);
ferret_packer.pack_start (analysis_packer, false, false);
int n = 0;
box = manage (new HBox);
box->set_spacing (6);
box->pack_start (trigger_gap_label, false, false);
box->pack_start (trigger_gap_spinner, false, false);
ferret_packer.pack_start (*box, false, false);
t->attach (*manage (new Label (_("Mode"), 1, 0.5)), 0, 1, n, n + 1, FILL);
t->attach (analysis_mode_selector, 1, 2, n, n + 1, FILL);
++n;
ferret_packer.pack_start (analyze_button, false, false);
t->attach (*manage (new Label (_("Detection function"), 1, 0.5)), 0, 1, n, n + 1, FILL);
t->attach (onset_detection_function_selector, 1, 2, n, n + 1, FILL);
++n;
t->attach (*manage (new Label (_("Trigger gap"), 1, 0.5)), 0, 1, n, n + 1, FILL);
t->attach (trigger_gap_spinner, 1, 2, n, n + 1, FILL);
t->attach (*manage (new Label (_("ms"))), 2, 3, n, n + 1, FILL);
++n;
t->attach (*manage (new Label (_("Threshold"), 1, 0.5)), 0, 1, n, n + 1, FILL);
t->attach (detection_threshold_scale, 1, 2, n, n + 1, FILL);
t->attach (*manage (new Label (_("dB"))), 2, 3, n, n + 1, FILL);
++n;
t->attach (*manage (new Label (_("Peak threshold"), 1, 0.5)), 0, 1, n, n + 1, FILL);
t->attach (peak_picker_threshold_scale, 1, 2, n, n + 1, FILL);
t->attach (*manage (new Label (_("dB"))), 2, 3, n, n + 1, FILL);
++n;
t->attach (*manage (new Label (_("Silence threshold"), 1, 0.5)), 0, 1, n, n + 1, FILL);
t->attach (silence_threshold_scale, 1, 2, n, n + 1, FILL);
t->attach (*manage (new Label (_("dB"))), 2, 3, n, n + 1, FILL);
++n;
t->attach (*manage (new Label (_("Sensitivity"), 1, 0.5)), 0, 1, n, n + 1, FILL);
t->attach (sensitivity_scale, 1, 2, n, n + 1, FILL);
++n;
t->attach (*manage (new Label (_("Operation"), 1, 0.5)), 0, 1, n, n + 1, FILL);
t->attach (operation_selector, 1, 2, n, n + 1, FILL);
++n;
analyze_button.signal_clicked().connect (sigc::mem_fun (*this, &RhythmFerret::run_analysis));
box = manage (new HBox);
box->set_spacing (6);
box->pack_start (detection_threshold_label, false, false);
box->pack_start (detection_threshold_scale, true, true);
perc_onset_packer.pack_start (*box, false, false);
box = manage (new HBox);
box->set_spacing (6);
box->pack_start (sensitivity_label, false, false);
box->pack_start (sensitivity_scale, true, true);
perc_onset_packer.pack_start (*box, false, false);
box = manage (new HBox);
box->set_spacing (6);
box->pack_start (onset_function_label, false, false);
box->pack_start (onset_detection_function_selector, true, true);
note_onset_packer.pack_start (*box, false, false);
box = manage (new HBox);
box->set_spacing (6);
box->pack_start (peak_picker_label, false, false);
box->pack_start (peak_picker_threshold_scale, true, true);
note_onset_packer.pack_start (*box, false, false);
box = manage (new HBox);
box->set_spacing (6);
box->pack_start (silence_label, false, false);
box->pack_start (silence_threshold_scale, true, true);
note_onset_packer.pack_start (*box, false, false);
analysis_mode_changed ();
ferret_frame.add (ferret_packer);
logo = manage (new Gtk::Image (::get_icon (X_("ferret_02"))));
if (logo) {
lower_hpacker.pack_start (*logo, false, false);
}
lower_hpacker.pack_start (operation_clarification_label, true, true);
lower_hpacker.pack_start (action_button, false, false);
lower_hpacker.set_border_width (6);
lower_hpacker.set_spacing (6);
action_button.signal_clicked().connect (sigc::mem_fun (*this, &RhythmFerret::do_action));
get_vbox()->set_border_width (6);
get_vbox()->set_spacing (6);
get_vbox()->pack_start (upper_hpacker, true, true);
get_vbox()->pack_start (lower_hpacker, false, false);
get_vbox()->pack_start (*t);
add_action_widget (analyze_button, 1);
add_action_widget (action_button, 0);
show_all ();
}
RhythmFerret::~RhythmFerret()
{
delete logo;
analysis_mode_changed ();
}
void
RhythmFerret::analysis_mode_changed ()
{
analysis_packer.children().clear ();
switch (get_analysis_mode()) {
case PercussionOnset:
analysis_packer.pack_start (perc_onset_packer);
break;
case NoteOnset:
analysis_packer.pack_start (note_onset_packer);
break;
}
analysis_packer.show_all ();
bool const perc = get_analysis_mode() == PercussionOnset;
detection_threshold_scale.set_sensitive (perc);
sensitivity_scale.set_sensitive (perc);
onset_detection_function_selector.set_sensitive (!perc);
peak_picker_threshold_scale.set_sensitive (!perc);
silence_threshold_scale.set_sensitive (!perc);
}
RhythmFerret::AnalysisMode
@ -219,9 +167,9 @@ RhythmFerret::get_analysis_mode () const
RhythmFerret::Action
RhythmFerret::get_action () const
{
if (tempo_button.get_active()) {
if (operation_selector.get_active_row_number() == 1) {
return DefineTempoMap;
} else if (region_conform_button.get_active()) {
} else if (operation_selector.get_active_row_number() == 2) {
return ConformRegion;
}

View File

@ -10,7 +10,6 @@
#include <gtkmm/image.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include "ardour_dialog.h"
@ -38,7 +37,6 @@ class RhythmFerret : public ArdourDialog {
};
RhythmFerret (PublicEditor&);
~RhythmFerret ();
void set_session (ARDOUR::Session*);
@ -48,66 +46,36 @@ class RhythmFerret : public ArdourDialog {
private:
PublicEditor& editor;
Gtk::HBox upper_hpacker;
Gtk::HBox lower_hpacker;
Gtk::ComboBoxText operation_selector;
Gtk::Frame operation_frame;
Gtk::Frame selection_frame;
Gtk::Frame ferret_frame;
Gtk::VBox op_logo_packer;
Gtk::Image* logo;
/* operation frame */
Gtk::VBox op_packer;
Gtk::RadioButtonGroup operation_button_group;
Gtk::RadioButton region_split_button;
Gtk::RadioButton tempo_button;
Gtk::RadioButton region_conform_button;
/* analysis frame */
Gtk::VBox ferret_packer;
Gtk::ComboBoxText analysis_mode_selector;
Gtk::Label analysis_mode_label;
/* transient detection widgets */
Gtk::Adjustment detection_threshold_adjustment;
Gtk::HScale detection_threshold_scale;
Gtk::Label detection_threshold_label;
Gtk::Adjustment sensitivity_adjustment;
Gtk::HScale sensitivity_scale;
Gtk::Label sensitivity_label;
Gtk::Button analyze_button;
Gtk::VBox perc_onset_packer;
/* onset detection widgets */
Gtk::ComboBoxText onset_detection_function_selector;
Gtk::Label onset_function_label;
Gtk::Adjustment peak_picker_threshold_adjustment;
Gtk::HScale peak_picker_threshold_scale;
Gtk::Label peak_picker_label;
Gtk::Adjustment silence_threshold_adjustment;
Gtk::HScale silence_threshold_scale;
Gtk::Label silence_label;
Gtk::VBox note_onset_packer;
/* generic stuff */
Gtk::Adjustment trigger_gap_adjustment;
Gtk::SpinButton trigger_gap_spinner;
Gtk::Label trigger_gap_label;
Gtk::VBox analysis_packer;
Gtk::Label operation_clarification_label;
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;