From ac5bbf4b99635a71093f859e233ad5fe4b07453b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 25 Mar 2010 16:03:31 +0000 Subject: [PATCH] use correct (RCConfig-based) name for MIDI port in generic MIDI control stuff; make monitor section track configuration params that apply to it; add use-monitor-bus option to rc option editor git-svn-id: svn://localhost/ardour2/branches/3.0@6797 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui2.cc | 15 ---- gtk2_ardour/monitor_section.cc | 69 ++++++++++++------- gtk2_ardour/monitor_section.h | 4 ++ gtk2_ardour/rc_option_editor.cc | 8 +++ .../generic_midi_control_protocol.cc | 7 +- 5 files changed, 63 insertions(+), 40 deletions(-) diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 6162ef22d9..98b33081b0 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -159,21 +159,6 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtrtearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL); _tearoff->tearoff_window().set_title (X_("Monitor")); _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false); + + /* catch changes that affect us */ + + Config->ParameterChanged.connect (config_connection, ui_bind (&MonitorSection::parameter_changed, this, _1), gui_context()); } MonitorSection::~MonitorSection () @@ -722,6 +727,34 @@ MonitorSection::linear_gain_printer (SpinButton* button) return true; } +void +MonitorSection::update_solo_model () +{ + const char* action_name; + Glib::RefPtr act; + + if (Config->get_solo_control_is_listen_control()) { + switch (Config->get_listen_position()) { + case AfterFaderListen: + action_name = X_("solo-use-afl"); + break; + case PreFaderListen: + action_name = X_("solo-use-pfl"); + break; + } + } else { + action_name = X_("solo-use-in-place"); + } + + act = ActionManager::get_action (X_("Solo"), action_name); + if (act) { + Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); + if (ract) { + ract->set_active (true); + } + } +} + void MonitorSection::map_state () { @@ -733,31 +766,10 @@ MonitorSection::map_state () dim_control->get_adjustment()->set_value (_monitor->dim_level()); solo_boost_control->get_adjustment()->set_value (_monitor->solo_boost_level()); - const char *action_name; - - if (Config->get_solo_control_is_listen_control()) { - switch (Config->get_listen_position()) { - case AfterFaderListen: - action_name = X_("solo-use-afl"); - break; - case PreFaderListen: - action_name = X_("solo-use-afl"); - break; - } - } else { - action_name = X_("solo-use-in-place"); - } - Glib::RefPtr act; - - act = ActionManager::get_action (X_("Solo"), action_name); - if (act) { - Glib::RefPtr ract = Glib::RefPtr::cast_dynamic (act); - if (ract) { - ract->set_active (true); - } - } + update_solo_model (); + act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all"); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); @@ -871,3 +883,14 @@ MonitorSection::solo_cut_changed () { Config->set_solo_mute_gain (slider_position_to_gain (solo_cut_adjustment.get_value())); } + +void +MonitorSection::parameter_changed (std::string name) +{ + if (name == "solo-control-is-listen-control" || + name == "listen-position") { + update_solo_model (); + } else if (name == "solo-mute-gain") { + solo_cut_adjustment.set_value (gain_to_slider_position (Config->get_solo_mute_gain())); + } +} diff --git a/gtk2_ardour/monitor_section.h b/gtk2_ardour/monitor_section.h index ca6b546f3f..65d460d84d 100644 --- a/gtk2_ardour/monitor_section.h +++ b/gtk2_ardour/monitor_section.h @@ -117,4 +117,8 @@ class MonitorSection : public RouteUI void solo_blink (bool); bool cancel_solo (GdkEventButton*); void solo_cut_changed (); + void update_solo_model (); + void parameter_changed (std::string); + + PBD::ScopedConnection config_connection; }; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 1440081d57..88a650ad87 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1205,6 +1205,14 @@ RCOptionEditor::RCOptionEditor () add_option (_("Audio"), new OptionEditorHeading (_("Monitoring"))); + add_option (_("Audio"), + new BoolOption ( + "use-monitor-bus", + _("Use a monitor bus (allows AFL/PFL and more control)"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_use_monitor_bus), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_use_monitor_bus) + )); + ComboOption* mm = new ComboOption ( "monitoring-model", _("Monitoring handled by"), diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index 08c0e7a125..5d5fe2ae3a 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -36,6 +36,7 @@ #include "ardour/session.h" #include "ardour/route.h" #include "ardour/midi_ui.h" +#include "ardour/rc_configuration.h" #include "generic_midi_control_protocol.h" #include "midicontrollable.h" @@ -61,10 +62,12 @@ GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s) the name is defined in ardour.rc which is likely not internationalized. */ - _port = mm->port (X_("control")); + _port = mm->port (Config->get_midi_port_name()); if (_port == 0) { - error << _("no MIDI port named \"control\" exists - generic MIDI control disabled") << endmsg; + error << string_compose (_("no MIDI port named \"%1\" exists - generic MIDI control disabled"), + Config->get_midi_port_name()) + << endmsg; throw failed_constructor(); }