diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-19 02:49:01 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-19 02:49:01 +0000 |
commit | f0748535a5023d132eff03999a705a3e56c516db (patch) | |
tree | 34924d873426319d77cb52ac3239acb7aec916a1 /gtk2_ardour/monitor_section.cc | |
parent | 295eb9a395d2ad36654a1d71019a571400adaee8 (diff) |
save tearoff state; restore monitor section state reasonably well; fixup access control to parts of editor.h (needs more work); extend CrossThread just a little
git-svn-id: svn://localhost/ardour2/branches/3.0@6774 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/monitor_section.cc')
-rw-r--r-- | gtk2_ardour/monitor_section.cc | 92 |
1 files changed, 77 insertions, 15 deletions
diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 8909a1649c..480786eb2c 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -61,18 +61,8 @@ MonitorSection::MonitorSection (Session* s) } - _route = _session->control_out (); - - if (!_route) { - throw failed_constructor (); - } - - _monitor = _route->monitor_control (); - - if (!_monitor) { - throw failed_constructor (); - } - + set_session (s); + VBox* sub_knob_packer = manage (new VBox); sub_knob_packer->set_spacing (12); @@ -264,6 +254,36 @@ MonitorSection::~MonitorSection () delete _tearoff; } +void +MonitorSection::set_session (Session* s) +{ + AxisView::set_session (s); + + if (_session) { + + _route = _session->control_out (); + + if (_route) { + /* session with control outs */ + _monitor = _route->monitor_control (); + meter.set_meter (&_route->peak_meter()); + } else { + /* session with no control outs */ + _monitor.reset (); + _route.reset (); + meter.set_meter (0); + } + + } else { + /* no session */ + _monitor.reset (); + _route.reset (); + meter.set_meter (0); + } + + /* both might be null */ +} + MonitorSection::ChannelButtonSet::ChannelButtonSet () : cut (X_("")) , dim (X_("")) @@ -283,6 +303,10 @@ MonitorSection::ChannelButtonSet::ChannelButtonSet () void MonitorSection::populate_buttons () { + if (!_monitor) { + return; + } + Glib::RefPtr<Action> act; uint32_t nchans = _monitor->output_streams().n_audio(); @@ -378,6 +402,10 @@ MonitorSection::pack_widget () const void MonitorSection::dim_all () { + if (!_monitor) { + return; + } + Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all"); if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); @@ -389,6 +417,10 @@ MonitorSection::dim_all () void MonitorSection::cut_all () { + if (!_monitor) { + return; + } + Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all"); if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); @@ -399,6 +431,10 @@ MonitorSection::cut_all () void MonitorSection::mono () { + if (!_monitor) { + return; + } + Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "monitor-mono"); if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); @@ -409,6 +445,10 @@ MonitorSection::mono () void MonitorSection::cut_channel (uint32_t chn) { + if (!_monitor) { + return; + } + char buf[64]; snprintf (buf, sizeof (buf), "monitor-cut-%u", chn); @@ -424,6 +464,10 @@ MonitorSection::cut_channel (uint32_t chn) void MonitorSection::dim_channel (uint32_t chn) { + if (!_monitor) { + return; + } + char buf[64]; snprintf (buf, sizeof (buf), "monitor-dim-%u", chn); @@ -440,6 +484,10 @@ MonitorSection::dim_channel (uint32_t chn) void MonitorSection::solo_channel (uint32_t chn) { + if (!_monitor) { + return; + } + char buf[64]; snprintf (buf, sizeof (buf), "monitor-solo-%u", chn); @@ -456,6 +504,10 @@ MonitorSection::solo_channel (uint32_t chn) void MonitorSection::invert_channel (uint32_t chn) { + if (!_monitor) { + return; + } + char buf[64]; snprintf (buf, sizeof (buf), "monitor-invert-%u", chn); @@ -625,19 +677,25 @@ MonitorSection::setup_knob_images () void MonitorSection::gain_value_changed () { - _route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); + if (_route) { + _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()); + if (_monitor) { + _monitor->set_dim_level (dim_adjustment.get_value()); + } } void MonitorSection::solo_boost_changed () { - _monitor->set_solo_boost_level (solo_boost_adjustment.get_value()); + if (_monitor) { + _monitor->set_solo_boost_level (solo_boost_adjustment.get_value()); + } } bool @@ -663,6 +721,10 @@ MonitorSection::linear_gain_printer (SpinButton* button) void MonitorSection::map_state () { + if (!_route || !_monitor) { + return; + } + 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()); |