From 325671e20afa56f5c796d14ce9bb76146a232f0b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 10 Mar 2010 17:31:16 +0000 Subject: how about that ... a monitor/main section .. GUI is still unfinished .. several small fixes to processor loading/listen mgmt and a few debug output lines rmeoved. knob images are provisional, and can be found in icons/knob.png and related files git-svn-id: svn://localhost/ardour2/branches/3.0@6744 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor.cc | 2 +- gtk2_ardour/gain_meter.h | 1 + gtk2_ardour/icons/bigknob.png | Bin 0 -> 69192 bytes gtk2_ardour/icons/knob.png | Bin 0 -> 48086 bytes gtk2_ardour/icons/littleknob.png | Bin 0 -> 38955 bytes gtk2_ardour/level_meter.h | 4 +- gtk2_ardour/mixer_ui.cc | 23 +- gtk2_ardour/mixer_ui.h | 3 + gtk2_ardour/monitor_section.cc | 562 +++++++++++++++++++++++++++++++++++++++ gtk2_ardour/monitor_section.h | 98 +++++++ gtk2_ardour/rc_option_editor.cc | 1 + gtk2_ardour/route_ui.cc | 16 +- gtk2_ardour/wscript | 2 + 13 files changed, 700 insertions(+), 12 deletions(-) create mode 100644 gtk2_ardour/icons/bigknob.png create mode 100644 gtk2_ardour/icons/knob.png create mode 100644 gtk2_ardour/icons/littleknob.png create mode 100644 gtk2_ardour/monitor_section.cc create mode 100644 gtk2_ardour/monitor_section.h (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 4b97ceea2d..1c56abb47d 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4792,7 +4792,7 @@ Editor::handle_new_route (RouteList& routes) for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr route = (*x); - if (route->is_hidden()) { + if (route->is_hidden() || route->is_control()) { continue; } diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index 7d089e2ef1..2513e4d267 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -34,6 +34,7 @@ #include "pbd/signals.h" +#include "ardour/chan_count.h" #include "ardour/types.h" #include "ardour/session_handle.h" diff --git a/gtk2_ardour/icons/bigknob.png b/gtk2_ardour/icons/bigknob.png new file mode 100644 index 0000000000..a5a3f5df56 Binary files /dev/null and b/gtk2_ardour/icons/bigknob.png differ diff --git a/gtk2_ardour/icons/knob.png b/gtk2_ardour/icons/knob.png new file mode 100644 index 0000000000..1047e49bfa Binary files /dev/null and b/gtk2_ardour/icons/knob.png differ diff --git a/gtk2_ardour/icons/littleknob.png b/gtk2_ardour/icons/littleknob.png new file mode 100644 index 0000000000..5ee1bc332a Binary files /dev/null and b/gtk2_ardour/icons/littleknob.png differ diff --git a/gtk2_ardour/level_meter.h b/gtk2_ardour/level_meter.h index 4b2a0cdbc9..06c7230b7c 100644 --- a/gtk2_ardour/level_meter.h +++ b/gtk2_ardour/level_meter.h @@ -74,13 +74,13 @@ class LevelMeter : public Gtk::HBox, public ARDOUR::SessionHandlePtr struct MeterInfo { Gtkmm2ext::FastMeter *meter; gint16 width; - int length; + int length; bool packed; MeterInfo() { meter = 0; width = 0; - length = 0; + length = 0; packed = false; } }; diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 4b4a5b41b1..c98d0028e9 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -42,6 +42,7 @@ #include "keyboard.h" #include "mixer_ui.h" #include "mixer_strip.h" +#include "monitor_section.h" #include "plugin_selector.h" #include "ardour_ui.h" #include "prompter.h" @@ -66,6 +67,7 @@ Mixer_UI::Mixer_UI () { _strip_width = Config->get_default_narrow_ms() ? Narrow : Wide; track_menu = 0; + monitor_section = 0; route_group_context_menu = 0; no_track_list_redisplay = false; in_group_row_change = false; @@ -253,6 +255,8 @@ Mixer_UI::Mixer_UI () MixerStrip::CatchDeletion.connect (*this, ui_bind (&Mixer_UI::remove_strip, this, _1), gui_context()); + MonitorSection::setup_knob_images (); + #ifndef DEFER_PLUGIN_SELECTOR_LOAD _plugin_selector = new PluginSelector (PluginManager::the_manager ()); #endif @@ -313,9 +317,18 @@ Mixer_UI::add_strip (RouteList& routes) boost::shared_ptr route = (*x); if (route->is_hidden()) { - return; + continue; } + if (route->is_control()) { + monitor_section = new MonitorSection (_session); + out_packer.pack_end (monitor_section->pack_widget(), false, false); + monitor_section->pack_widget().show_all (); + /* no regular strip */ + continue; + } + + strip = new MixerStrip (*this, _session, route); strips.push_back (strip); @@ -508,10 +521,14 @@ Mixer_UI::session_going_away () group_model->clear (); _selection.clear (); track_model->clear (); + + delete monitor_section; + monitor_section = 0; for (list::iterator i = strips.begin(); i != strips.end(); ++i) { delete (*i); } + strips.clear (); WindowTitle title(Glib::get_application_name()); @@ -576,6 +593,10 @@ Mixer_UI::fast_update_strips () for (list::iterator i = strips.begin(); i != strips.end(); ++i) { (*i)->fast_update (); } + + if (monitor_section) { + monitor_section->fast_update (); + } } } diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index e03d2efebd..87bf57a6df 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -50,6 +50,7 @@ namespace ARDOUR { class MixerStrip; class PluginSelector; class MixerGroupTabs; +class MonitorSection; class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr { @@ -194,6 +195,8 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR void track_column_click (gint); void build_track_menu (); + MonitorSection* monitor_section; + PluginSelector *_plugin_selector; void strip_property_changed (const PBD::PropertyChange&, MixerStrip *); diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc new file mode 100644 index 0000000000..51659adcb6 --- /dev/null +++ b/gtk2_ardour/monitor_section.cc @@ -0,0 +1,562 @@ +#include + +#include "pbd/compose.h" +#include "pbd/error.h" + +#include "gtkmm2ext/bindable_button.h" +#include "gtkmm2ext/tearoff.h" +#include "gtkmm2ext/actions.h" + +#include "ardour/dB.h" +#include "ardour/monitor_processor.h" +#include "ardour/route.h" +#include "ardour/utils.h" + +#include "monitor_section.h" +#include "utils.h" +#include "volume_controller.h" + +#include "i18n.h" + +using namespace ARDOUR; +using namespace Gtk; +using namespace Gtkmm2ext; +using namespace PBD; +using namespace std; + +Glib::RefPtr MonitorSection::monitor_actions; +Glib::RefPtr MonitorSection::big_knob_pixbuf; +Glib::RefPtr MonitorSection::little_knob_pixbuf; + +MonitorSection::MonitorSection (Session* s) + : AxisView (s) + , RouteUI (s) + , main_table (2, 3) + , meter (s) + , _tearoff (0) + , gain_adjustment (1.0, 0.0, 2.0, 0.01, 0.1) + , gain_control (0) + , dim_adjustment (0.2, 0.0, 1.0, 0.01, 0.1) + , dim_control (0) + , solo_boost_adjustment (1.0, 1.0, 2.0, 0.01, 0.1) + , solo_boost_control (0) + , solo_in_place_button (solo_model_group, _("SiP")) + , afl_button (solo_model_group, _("AFL")) + , pfl_button (solo_model_group, _("PFL")) + , cut_all_button (_("MUTE")) + , dim_all_button (_("DIM")) + +{ + Glib::RefPtr act; + + if (!monitor_actions) { + + /* do some static stuff */ + + register_actions (); + + } + + _route = _session->control_out (); + + if (!_route) { + throw failed_constructor (); + } + + _monitor = _route->monitor_control (); + + if (!_monitor) { + throw failed_constructor (); + } + + HBox* sub_knob_packer = manage (new HBox); + sub_knob_packer->set_spacing (12); + + VBox* spin_packer; + Label* spin_label; + + gain_control = new VolumeController (big_knob_pixbuf, &gain_adjustment, true); + gain_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::gain_value_changed)); + gain_control->spinner().signal_output().connect (sigc::bind (sigc::mem_fun (*this, &MonitorSection::nonlinear_gain_printer), + &gain_control->spinner())); + + HBox* center_gain_control = manage (new HBox); + center_gain_control->pack_start (*gain_control, true, true); + + spin_label = manage (new Label (_("Gain (dB)"))); + spin_packer = manage (new VBox); + spin_packer->set_spacing (6); + spin_packer->pack_start (*center_gain_control, false, false); + spin_packer->pack_start (*spin_label, false, false); + + knob_packer.pack_start (*spin_packer, false, false); + + dim_control = new VolumeController (little_knob_pixbuf, &dim_adjustment, true, 30, 30); + dim_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::dim_level_changed)); + dim_control->spinner().signal_output().connect (sigc::bind (sigc::mem_fun (*this, &MonitorSection::linear_gain_printer), + &dim_control->spinner())); + + spin_label = manage (new Label (_("Dim Cut (dB)"))); + spin_packer = manage (new VBox); + spin_packer->set_spacing (6); + spin_packer->pack_start (*dim_control, false, false); + spin_packer->pack_start (*spin_label, false, false); + + sub_knob_packer->pack_start (*spin_packer, false, true); + + solo_boost_control = new VolumeController (little_knob_pixbuf, &solo_boost_adjustment, true, 30, 30); + solo_boost_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MonitorSection::solo_boost_changed)); + solo_boost_control->spinner().signal_output().connect (sigc::bind (sigc::mem_fun (*this, &MonitorSection::linear_gain_printer), + &solo_boost_control->spinner())); + + spin_label = manage (new Label (_("Solo Boost (dB)"))); + spin_packer = manage (new VBox); + spin_packer->set_spacing (6); + spin_packer->pack_start (*solo_boost_control, false, false); + spin_packer->pack_start (*spin_label, false, false); + + sub_knob_packer->pack_start (*spin_packer, false, true); + + knob_packer.pack_start (*sub_knob_packer, false, true); + + sub_knob_packer->show (); + knob_packer.show (); + gain_control->show_all (); + dim_control->show_all (); + solo_boost_control->show_all (); + + meter.set_meter (&_route->peak_meter()); + meter.setup_meters (300, 5); + + table_knob_packer.pack_start (main_table, true, true); + table_knob_packer.pack_start (knob_packer, false, false); + + table_knob_packer.show (); + + solo_model_box.set_spacing (12); + solo_model_box.pack_start (solo_in_place_button, false, false); + solo_model_box.pack_start (afl_button, false, false); + solo_model_box.pack_start (pfl_button, false, false); + + solo_in_place_button.show (); + afl_button.show (); + pfl_button.show (); + solo_model_box.show (); + + upper_packer.pack_start (solo_model_box, false, false); + + act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all")); + if (act) { + act->connect_proxy (cut_all_button); + } + + act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all")); + if (act) { + act->connect_proxy (dim_all_button); + } + + cut_all_button.show (); + dim_all_button.show (); + + lower_packer.pack_start (dim_all_button, false, false); + lower_packer.pack_start (cut_all_button, false, false); + + vpacker.set_border_width (12); + vpacker.set_spacing (12); + vpacker.pack_start (upper_packer, false, false); + vpacker.pack_start (table_knob_packer, false, false); + vpacker.pack_start (lower_packer, false, false); + + VBox* keep_meter_under_control = manage (new VBox); + keep_meter_under_control->pack_start (meter, false, false); + keep_meter_under_control->show (); + + hpacker.set_border_width (12); + hpacker.set_spacing (12); + hpacker.pack_start (*keep_meter_under_control, false, false); + hpacker.pack_start (vpacker, true, true); + + main_table.show (); + hpacker.show (); + upper_packer.show (); + lower_packer.show (); + vpacker.show (); + meter.show_all (); + + populate_buttons (); + map_state (); + + _tearoff = new TearOff (hpacker); + /* if torn off, make this a normal window */ + _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL); + _tearoff->tearoff_window().set_title (X_("Monitor")); +} + +MonitorSection::~MonitorSection () +{ + delete _tearoff; + delete gain_control; + delete dim_control; + delete solo_boost_control; +} + +void +MonitorSection::populate_buttons () +{ + Glib::RefPtr act; + uint32_t nchans = _route->monitor_control()->output_streams().n_audio(); + + main_table.resize (nchans+1, 5); + main_table.set_col_spacings (6); + main_table.set_row_spacings (6); + main_table.set_homogeneous (true); + + Label* l1 = manage (new Label (X_("out"))); + main_table.attach (*l1, 0, 1, 0, 1, SHRINK|FILL, SHRINK|FILL); + l1 = manage (new Label (X_("cut"))); + main_table.attach (*l1, 1, 2, 0, 1, SHRINK|FILL, SHRINK|FILL); + l1 = manage (new Label (X_("dim"))); + main_table.attach (*l1, 2, 3, 0, 1, SHRINK|FILL, SHRINK|FILL); + l1 = manage (new Label (X_("solo"))); + main_table.attach (*l1, 3, 4, 0, 1, SHRINK|FILL, SHRINK|FILL); + l1 = manage (new Label (X_("inv"))); + main_table.attach (*l1, 4, 5, 0, 1, SHRINK|FILL, SHRINK|FILL); + +#if 0 + /* the "all" buttons for cut & dim */ + + Label *la = manage (new Label (X_("all"))); + main_table.attach (*la, 0, 1, 1, 2, SHRINK|FILL, SHRINK|FILL); + + + /* cut all */ + + BindableToggleButton* ca = manage (new BindableToggleButton (X_(""))); + ca->set_name (X_("MixerMuteButton")); + gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (ca->gobj()), false); + main_table.attach (*ca, 1, 2, 1, 2, SHRINK|FILL, SHRINK|FILL); + + act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all")); + if (act) { + act->connect_proxy (*ca); + } + + /* dim all */ + + BindableToggleButton* da = manage (new BindableToggleButton (X_(""))); + da->set_name (X_("MixerMuteButton")); + gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (da->gobj()), false); + main_table.attach (*da, 2, 3, 1, 2, SHRINK|FILL, SHRINK|FILL); + + act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all")); + if (act) { + act->connect_proxy (*da); + } + + uint32_t row_offset = 2; +#else + uint32_t row_offset = 1; +#endif + + for (uint32_t i = 0; i < nchans; ++i) { + + string l; + char buf[64]; + + if (nchans == 2) { + if (i == 0) { + l = "L"; + } else { + l = "R"; + } + } else { + char buf[32]; + snprintf (buf, sizeof (buf), "%d", i+1); + l = buf; + } + + Label* c1 = manage (new Label (l)); + main_table.attach (*c1, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); + + /* Cut */ + + BindableToggleButton* c2 = manage (new BindableToggleButton (X_(""))); + c2->set_name (X_("MixerMuteButton")); + gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); + main_table.attach (*c2, 1, 2, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); + + snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1); + act = ActionManager::get_action (X_("Monitor"), buf); + if (act) { + act->connect_proxy (*c2); + } + + /* Dim */ + + BindableToggleButton* c3 = manage (new BindableToggleButton (X_(""))); + c3->set_name (X_("MixerMuteButton")); + gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); + main_table.attach (*c3, 2, 3, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); + + snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1); + act = ActionManager::get_action (X_("Monitor"), buf); + if (act) { + act->connect_proxy (*c3); + } + + /* Solo */ + + BindableToggleButton* c4 = manage (new BindableToggleButton (X_(""))); + c4->set_name (X_("MixerSoloButton")); + gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); + main_table.attach (*c4, 3, 4, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); + + snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1); + act = ActionManager::get_action (X_("Monitor"), buf); + if (act) { + act->connect_proxy (*c4); + } + + /* Invert (Polarity/Phase) */ + + BindableToggleButton* c5 = manage (new BindableToggleButton (X_(""))); + c5->set_name (X_("MixerPhaseInvertButton")); + gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); + main_table.attach (*c5, 4, 5, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); + + snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1); + act = ActionManager::get_action (X_("Monitor"), buf); + if (act) { + act->connect_proxy (*c5); + } + + } + + main_table.show_all (); +} + +void +MonitorSection::set_button_names () +{ + rec_enable_button_label.set_text ("rec"); + mute_button_label.set_text ("rec"); + solo_button_label.set_text ("rec"); +} + +Widget& +MonitorSection::pack_widget () const +{ + return *_tearoff; +} + +void +MonitorSection::dim_all () +{ + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all"); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + _monitor->set_dim_all (tact->get_active()); + } + +} + +void +MonitorSection::cut_all () +{ + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all"); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + _monitor->set_cut_all (tact->get_active()); + } +} + +void +MonitorSection::cut_channel (uint32_t chn) +{ + char buf[64]; + snprintf (buf, sizeof (buf), "monitor-cut-%u", chn); + + --chn; // 0-based in backend + + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + _monitor->set_cut (chn, tact->get_active()); + } +} + +void +MonitorSection::dim_channel (uint32_t chn) +{ + char buf[64]; + snprintf (buf, sizeof (buf), "monitor-dim-%u", chn); + + --chn; // 0-based in backend + + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + _monitor->set_dim (chn, tact->get_active()); + } + +} + +void +MonitorSection::solo_channel (uint32_t chn) +{ + char buf[64]; + snprintf (buf, sizeof (buf), "monitor-solo-%u", chn); + + --chn; // 0-based in backend + + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + _monitor->set_solo (chn, tact->get_active()); + } + +} + +void +MonitorSection::invert_channel (uint32_t chn) +{ + char buf[64]; + + --chn; // 0-based in backend + + snprintf (buf, sizeof (buf), "monitor-invert-%u", chn); + Glib::RefPtr act = ActionManager::get_action (X_("Monitor"), buf); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + _monitor->set_polarity (chn, tact->get_active()); + } + +} + +void +MonitorSection::register_actions () +{ + string action_name; + string action_descr; + + monitor_actions = ActionGroup::create (X_("Monitor")); + ActionManager::add_action_group (monitor_actions); + + ActionManager::register_toggle_action (monitor_actions, "monitor-cut-all", "", + sigc::mem_fun (*this, &MonitorSection::cut_all)); + + ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", + sigc::mem_fun (*this, &MonitorSection::dim_all)); + + /* note the 1-based counting for naming vs. 0-based for action */ + + for (uint32_t chn = 1; chn <= 16; ++chn) { + + /* for the time being, do not use the action description because it always + shows up in the buttons, which is undesirable. + */ + + action_name = string_compose (X_("monitor-cut-%1"), chn); + action_descr = string_compose (_("Cut Monitor Chn %1"), chn); + ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", + sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn)); + + action_name = string_compose (X_("monitor-dim-%1"), chn); + action_descr = string_compose (_("Dim Monitor Chn %1"), chn+1); + ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", + sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn)); + + action_name = string_compose (X_("monitor-solo-%1"), chn); + action_descr = string_compose (_("Solo Monitor Chn %1"), chn); + ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", + sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn)); + + action_name = string_compose (X_("monitor-invert-%1"), chn); + action_descr = string_compose (_("Invert Monitor Chn %1"), chn); + ActionManager::register_toggle_action (monitor_actions, action_name.c_str(), "", + sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn)); + + } +} + +void +MonitorSection::fast_update () +{ + meter.update_meters (); +} + +void +MonitorSection::setup_knob_images () +{ + try { + + big_knob_pixbuf = ::get_icon ("knob"); + + } catch (...) { + + error << "No knob image found (or not loadable) at " + << " .... " + << endmsg; + throw failed_constructor (); + } + + try { + + little_knob_pixbuf = ::get_icon ("littleknob"); + + } catch (...) { + + error << "No knob image found (or not loadable) at " + << " .... " + << endmsg; + throw failed_constructor (); + } +} + +void +MonitorSection::gain_value_changed () +{ + _route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); +} + +void +MonitorSection::dim_level_changed () +{ + _monitor->set_dim_level (dim_adjustment.get_value()); +} + +void +MonitorSection::solo_boost_changed () +{ + _monitor->set_solo_boost_level (solo_boost_adjustment.get_value()); +} + +bool +MonitorSection::nonlinear_gain_printer (SpinButton* button) +{ + double val = button->get_adjustment()->get_value(); + char buf[16]; + snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain (val))); + button->set_text (buf); + return true; +} + +bool +MonitorSection::linear_gain_printer (SpinButton* button) +{ + double val = button->get_adjustment()->get_value(); + char buf[16]; + snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (val)); + button->set_text (buf); + return true; +} + +void +MonitorSection::map_state () +{ + cerr << "route gain = " << _route->gain_control()->get_value() << endl; + + gain_control->get_adjustment()->set_value (gain_to_slider_position (_route->gain_control()->get_value())); + dim_control->get_adjustment()->set_value (_monitor->dim_level()); + solo_boost_control->get_adjustment()->set_value (_monitor->solo_boost_level()); +} diff --git a/gtk2_ardour/monitor_section.h b/gtk2_ardour/monitor_section.h new file mode 100644 index 0000000000..6ea9d3b571 --- /dev/null +++ b/gtk2_ardour/monitor_section.h @@ -0,0 +1,98 @@ +/* + Copyright (C) 2010 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. + +*/ + +#include +#include + +#include "gtkmm2ext/bindable_button.h" + +#include "axis_view.h" +#include "level_meter.h" +#include "route_ui.h" + +namespace Gtkmm2ext { + class TearOff; +} + +class VolumeController; + +class MonitorSection : public RouteUI +{ + public: + MonitorSection (ARDOUR::Session*); + ~MonitorSection (); + + Gtk::Widget& pack_widget () const; + void fast_update (); + static void setup_knob_images (); + + private: + Gtk::VBox vpacker; + Gtk::HBox hpacker; + Gtk::Table main_table; + Gtk::VBox upper_packer; + Gtk::VBox lower_packer; + Gtk::VBox table_knob_packer; + Gtk::VBox knob_packer; + LevelMeter meter; + Gtkmm2ext::TearOff* _tearoff; + + Gtk::Adjustment gain_adjustment; + VolumeController* gain_control; + Gtk::Adjustment dim_adjustment; + VolumeController* dim_control; + Gtk::Adjustment solo_boost_adjustment; + VolumeController* solo_boost_control; + + void populate_buttons (); + void set_button_names (); + void map_state (); + + boost::shared_ptr _monitor; + boost::shared_ptr _route; + + static Glib::RefPtr monitor_actions; + void register_actions (); + + static Glib::RefPtr big_knob_pixbuf; + static Glib::RefPtr little_knob_pixbuf; + + void cut_channel (uint32_t); + void dim_channel (uint32_t); + void solo_channel (uint32_t); + void invert_channel (uint32_t); + void dim_all (); + void cut_all (); + void mono (); + void dim_level_changed (); + void solo_boost_changed (); + void gain_value_changed (); + + bool nonlinear_gain_printer (Gtk::SpinButton*); + bool linear_gain_printer (Gtk::SpinButton*); + + Gtk::RadioButtonGroup solo_model_group; + Gtk::RadioButton solo_in_place_button; + Gtk::RadioButton afl_button; + Gtk::RadioButton pfl_button; + Gtk::HBox solo_model_box; + + BindableToggleButton cut_all_button; + BindableToggleButton dim_all_button; +}; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index f9432bf88b..b3d7364ebd 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -738,6 +738,7 @@ public: h->pack_start (*l, false, false); h->pack_start (*_db_slider, false, false); h->pack_start (_db_display, false, false); + h->show_all (); set_size_request_to_display_given_text (_db_display, "-99.0", 12, 12); diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 1a75132e4c..c074c93cd0 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -766,13 +766,13 @@ RouteUI::update_solo_display () void RouteUI::solo_changed_so_update_mute () { - Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_mute_display, this)); + update_mute_display (); } void RouteUI::mute_changed(void* /*src*/) { - Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_mute_display, this)); + update_mute_display (); } int @@ -812,6 +812,10 @@ RouteUI::mute_visual_state (Session* s, boost::shared_ptr r) void RouteUI::update_mute_display () { + if (!_route) { + return; + } + bool model = _route->muted(); bool view = mute_button->get_active(); @@ -837,17 +841,13 @@ RouteUI::route_rec_enable_changed () void RouteUI::session_rec_enable_changed () { - if (!rec_enable_button) { - return; - } - - Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_rec_display, this)); + update_rec_display (); } void RouteUI::update_rec_display () { - if (!rec_enable_button) { + if (!rec_enable_button || !_route) { return; } diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 05725a7e7a..e328a96263 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -137,6 +137,7 @@ gtk2_ardour_sources = [ 'mixer_group_tabs.cc', 'mixer_strip.cc', 'mixer_ui.cc', + 'monitor_section.cc', 'nag.cc', 'option_editor.cc', 'opts.cc', @@ -197,6 +198,7 @@ gtk2_ardour_sources = [ 'ui_config.cc', 'utils.cc', 'version.cc', + 'volume_controller.cc', 'waveview.cc', ] -- cgit v1.2.3