From aed1f0d228e6c2db43c0bb2152c6d7bc78a41530 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Thu, 8 Oct 2015 01:45:16 +1100 Subject: Made click emphasis optional with default click --- gtk2_ardour/rc_option_editor.cc | 39 ++++++++++++++++++++++++------ libs/ardour/ardour/rc_configuration_vars.h | 1 + libs/ardour/session_click.cc | 7 ++++-- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index a6e76bda2a..09a1cac478 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -79,7 +79,7 @@ public: , _click_browse_button (_("Browse...")) , _click_emphasis_browse_button (_("Browse...")) { - Table* t = manage (new Table (3, 3)); + Table* t = manage (new Table (3, 4)); t->set_spacings (4); Label* l = manage (left_aligned_label (_("Use default Click:"))); @@ -88,19 +88,25 @@ public: _use_default_click_check_button.signal_toggled().connect ( sigc::mem_fun (*this, &ClickOptions::use_default_click_toggled)); - l = manage (left_aligned_label (_("Click audio file:"))); + l = manage (left_aligned_label (_("Emphasis on first beat:"))); t->attach (*l, 0, 1, 1, 2, FILL); - t->attach (_click_path_entry, 1, 2, 1, 2, FILL); + t->attach (_use_emphasis_on_click_check_button, 1, 2, 1, 2, FILL); + _use_emphasis_on_click_check_button.signal_toggled().connect ( + sigc::mem_fun (*this, &ClickOptions::use_emphasis_on_click_toggled)); + + l = manage (left_aligned_label (_("Click audio file:"))); + t->attach (*l, 0, 1, 2, 3, FILL); + t->attach (_click_path_entry, 1, 2, 2, 3, FILL); _click_browse_button.signal_clicked ().connect ( sigc::mem_fun (*this, &ClickOptions::click_browse_clicked)); - t->attach (_click_browse_button, 2, 3, 1, 2, FILL); + t->attach (_click_browse_button, 2, 3, 2, 3, FILL); l = manage (left_aligned_label (_("Click emphasis audio file:"))); - t->attach (*l, 0, 1, 2, 3, FILL); - t->attach (_click_emphasis_path_entry, 1, 2, 2, 3, FILL); + t->attach (*l, 0, 1, 3, 4, FILL); + t->attach (_click_emphasis_path_entry, 1, 2, 3, 4, FILL); _click_emphasis_browse_button.signal_clicked ().connect ( sigc::mem_fun (*this, &ClickOptions::click_emphasis_browse_clicked)); - t->attach (_click_emphasis_browse_button, 2, 3, 2, 3, FILL); + t->attach (_click_emphasis_browse_button, 2, 3, 3, 4, FILL); _box->pack_start (*t, false, false); @@ -110,9 +116,11 @@ public: if (_rc_config->get_click_sound ().empty() && _rc_config->get_click_emphasis_sound().empty()) { _use_default_click_check_button.set_active (true); + _use_emphasis_on_click_check_button.set_active (true); } else { _use_default_click_check_button.set_active (false); + _use_emphasis_on_click_check_button.set_active (false); } } @@ -122,6 +130,10 @@ public: _click_path_entry.set_text (_rc_config->get_click_sound()); } else if (p == "click-emphasis-sound") { _click_emphasis_path_entry.set_text (_rc_config->get_click_emphasis_sound()); + } else if (p == "click-emphasis-toggle") { + bool x = _rc_config->get_click_emphasis_toggle (); + _use_emphasis_on_click_check_button.set_sensitive (x); + _use_emphasis_on_click_check_button.set_active (x); } } @@ -129,6 +141,7 @@ public: { parameter_changed ("click-sound"); parameter_changed ("click-emphasis-sound"); + parameter_changed ("click-emphasis-toggle"); } private: @@ -188,16 +201,28 @@ private: _click_emphasis_path_entry.set_sensitive (false); _click_browse_button.set_sensitive (false); _click_emphasis_browse_button.set_sensitive (false); + _use_emphasis_on_click_check_button.set_sensitive (true); } else { _click_path_entry.set_sensitive (true); _click_emphasis_path_entry.set_sensitive (true); _click_browse_button.set_sensitive (true); _click_emphasis_browse_button.set_sensitive (true); + _use_emphasis_on_click_check_button.set_sensitive (false); + } + } + + void use_emphasis_on_click_toggled () + { + if (_use_emphasis_on_click_check_button.get_active ()) { + _rc_config->set_click_emphasis_toggle(true); + } else { + _rc_config->set_click_emphasis_toggle(false); } } RCConfiguration* _rc_config; CheckButton _use_default_click_check_button; + CheckButton _use_emphasis_on_click_check_button; Entry _click_path_entry; Entry _click_emphasis_path_entry; Button _click_browse_button; diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index afa74325c0..869414a4be 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -148,6 +148,7 @@ CONFIG_VARIABLE (bool, clicking, "clicking", false) CONFIG_VARIABLE (std::string, click_sound, "click-sound", "") CONFIG_VARIABLE (std::string, click_emphasis_sound, "click-emphasis-sound", "") CONFIG_VARIABLE (gain_t, click_gain, "click-gain", 1.0) +CONFIG_VARIABLE (bool, click_emphasis_toggle, "click_emphasis_toggle", true) /* transport control and related */ diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index e6e8749aec..b8b0ed81da 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -81,13 +81,16 @@ Session::click (framepos_t start, framecnt_t nframes) for (TempoMap::BBTPointList::const_iterator i = points_begin; i != points_end; ++i) { switch ((*i).beat) { case 1: - if (click_emphasis_data) { + if (click_emphasis_data && Config->get_click_emphasis_toggle () == true) { clicks.push_back (new Click ((*i).frame, click_emphasis_length, click_emphasis_data)); } + if (click_data && Config->get_click_emphasis_toggle () == false) { + clicks.push_back (new Click ((*i).frame, click_length, click_data)); + } break; default: - if (click_emphasis_data == 0 || (click_emphasis_data && (*i).beat != 1)) { + if (click_emphasis_data == 0 || (Config->get_click_emphasis_toggle () == false) || (click_emphasis_data && (*i).beat != 1)) { clicks.push_back (new Click ((*i).frame, click_length, click_data)); } break; -- cgit v1.2.3