diff options
Diffstat (limited to 'gtk2_ardour')
28 files changed, 409 insertions, 554 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 74daa23a9a..a39283c977 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -324,7 +324,7 @@ ActionManager::set_sensitive (vector<RefPtr<Action> >& actions, bool state) void ActionManager::uncheck_toggleaction (const char * name) { - char *last_slash = strrchr (name, '/'); + const char *last_slash = strrchr (name, '/'); if (last_slash == 0) { fatal << string_compose (_("programmer error: %1 %2"), X_("illegal toggle action name"), name) << endmsg; @@ -339,7 +339,7 @@ ActionManager::uncheck_toggleaction (const char * name) memcpy (group_name, name + 10, len); group_name[len] = '\0'; - char* action_name = last_slash + 1; + const char* action_name = last_slash + 1; RefPtr<Action> act = get_action (group_name, action_name); if (act) { diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 0af0a88e11..0b9b9f1f74 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1835,44 +1835,6 @@ ARDOUR_UI::stop_blinking () } } -void -ARDOUR_UI::name_io_setup (AudioEngine& engine, - string& buf, - IO& io, - bool in) -{ - vector<string> connections; - - if (in) { - if (io.n_inputs().n_total() == 0) { - buf = _("none"); - return; - } - - /* XXX we're not handling multiple ports yet. */ - - if (io.input(0)->get_connections(connections) == 0) { - buf = _("off"); - } else { - buf = connections.front(); - } - - } else { - - if (io.n_outputs().n_total() == 0) { - buf = _("none"); - return; - } - - /* XXX we're not handling multiple ports yet. */ - - if (io.output(0)->get_connections(connections) == 0) { - buf = _("off"); - } else { - buf = connections.front(); - } - } -} /** Ask the user for the name of a new shapshot and then take it. */ diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 2c840324e0..aae644dbec 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -176,8 +176,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI static sigc::signal<void> SuperRapidScreenUpdate; static sigc::signal<void,nframes_t, bool, nframes_t> Clock; - void name_io_setup (ARDOUR::AudioEngine&, std::string&, ARDOUR::IO& io, bool in); - XMLNode* editor_settings() const; XMLNode* mixer_settings () const; XMLNode* keyboard_settings () const; diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index 6ce54f7882..8f0c25bdb0 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -37,6 +37,7 @@ #include <gtkmm2ext/bindable_button.h> #include <gtkmm2ext/utils.h> +#include "ardour/amp.h" #include "ardour/audio_diskstream.h" #include "ardour/audioplaylist.h" #include "ardour/event_type_map.h" @@ -347,13 +348,14 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool return; } - boost::shared_ptr<AutomationTimeAxisView> gain_track(new AutomationTimeAxisView (_session, - _route, _route, c, - _editor, - *this, - false, - parent_canvas, - _route->describe_parameter(param))); + boost::shared_ptr<AutomationTimeAxisView> + gain_track(new AutomationTimeAxisView (_session, + _route, _route->amp(), c, + _editor, + *this, + false, + parent_canvas, + _route->amp()->describe_parameter(param))); add_automation_child(Evoral::Parameter(GainAutomation), gain_track, show); @@ -396,11 +398,11 @@ AudioTimeAxisView::ensure_pan_views (bool show) /* we don't already have an AutomationTimeAxisView for this parameter */ - std::string const name = _route->describe_parameter (pan_control->parameter ()); + std::string const name = _route->panner()->describe_parameter (pan_control->parameter ()); boost::shared_ptr<AutomationTimeAxisView> pan_track ( new AutomationTimeAxisView (_session, - _route, _route, pan_control, + _route, _route->panner(), pan_control, _editor, *this, false, diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 78faf66944..e72c5add00 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -255,15 +255,20 @@ void AutomationTimeAxisView::set_automation_state (AutoState state) { if (!ignore_state_request) { + _automatable->set_parameter_automation_state (_control->parameter(), state); +#if 0 if (_route == _automatable) { // This is a time axis for route (not region) automation _route->set_parameter_automation_state (_control->parameter(), state); } if (_control->list()) _control->alist()->set_automation_state(state); +#endif } - if (_view) + + if (_view) { _view->set_automation_state (state); + } } void diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 00b4a3656d..964ee38712 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -67,10 +67,12 @@ Editor::handle_new_route (RouteList& routes) if (route->is_hidden()) { continue; } - - if (route->default_type() == ARDOUR::DataType::AUDIO) + + DataType dt = route->input()->default_type(); + + if (dt == ARDOUR::DataType::AUDIO) tv = new AudioTimeAxisView (*this, *session, route, *track_canvas); - else if (route->default_type() == ARDOUR::DataType::MIDI) + else if (dt == ARDOUR::DataType::MIDI) tv = new MidiTimeAxisView (*this, *session, route, *track_canvas); else throw unknown_type(); diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc index 2f66e58fe5..7b665a6087 100644 --- a/gtk2_ardour/export_channel_selector.cc +++ b/gtk2_ardour/export_channel_selector.cc @@ -112,14 +112,14 @@ PortExportChannelSelector::fill_route_list () /* Add master bus and then everything else */ - ARDOUR::IO * master = session->master_out().get(); + ARDOUR::IO* master = session->master_out()->output().get(); channel_view.add_route (master); for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) { - if (it->get() == master) { + if ((*it)->output().get() == master) { continue; } - channel_view.add_route (it->get()); + channel_view.add_route ((*it)->output().get()); } update_channel_count (); @@ -261,27 +261,27 @@ PortExportChannelSelector::ChannelTreeView::set_config (ChannelConfigPtr c) } void -PortExportChannelSelector::ChannelTreeView::add_route (ARDOUR::IO * route) +PortExportChannelSelector::ChannelTreeView::add_route (ARDOUR::IO * io) { Gtk::TreeModel::iterator iter = route_list->append(); Gtk::TreeModel::Row row = *iter; row[route_cols.selected] = false; - row[route_cols.name] = route->name(); - row[route_cols.io] = route; + row[route_cols.name] = io->name(); + row[route_cols.io] = io; /* Initialize port list */ Glib::RefPtr<Gtk::ListStore> port_list = Gtk::ListStore::create (route_cols.port_cols); row[route_cols.port_list_col] = port_list; - uint32_t outs = route->n_outputs().n_audio(); + uint32_t outs = io->n_ports().n_audio(); for (uint32_t i = 0; i < outs; ++i) { iter = port_list->append(); row = *iter; row[route_cols.port_cols.selected] = false; - row[route_cols.port_cols.port] = route->audio_output (i); + row[route_cols.port_cols.port] = io->audio (i); std::ostringstream oss; oss << "Out-" << (i + 1); diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 85e591a8cc..045c93173e 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -160,57 +160,58 @@ GainMeterBase::~GainMeterBase () } void -GainMeterBase::set_io (boost::shared_ptr<IO> io) +GainMeterBase::set_controls (boost::shared_ptr<Route> r, + boost::shared_ptr<PeakMeter> pm, + boost::shared_ptr<AutomationControl> gc, + boost::shared_ptr<Automatable> gc_owner) { connections.clear (); - _io = io; - - if (!_io) { + if (!pm && !gc) { level_meter->set_meter (0); gain_slider->set_controllable (boost::shared_ptr<PBD::Controllable>()); + _meter.reset (); + _gain_control.reset (); + _route.reset (); return; } - level_meter->set_meter (&_io->peak_meter()); - gain_slider->set_controllable (_io->gain_control()); - - boost::shared_ptr<Route> r; - - if ((r = boost::dynamic_pointer_cast<Route> (_io)) != 0) { + _meter = pm; + _gain_control = gc; + _route = r; - if (!r->is_hidden()) { - - using namespace Menu_Helpers; + level_meter->set_meter (pm.get()); + gain_slider->set_controllable (gc); - gain_astate_menu.items().clear (); - - gain_astate_menu.items().push_back (MenuElem (_("Manual"), - bind (mem_fun (*_io, &IO::set_parameter_automation_state), - Evoral::Parameter(GainAutomation), (AutoState) Off))); - gain_astate_menu.items().push_back (MenuElem (_("Play"), - bind (mem_fun (*_io, &IO::set_parameter_automation_state), - Evoral::Parameter(GainAutomation), (AutoState) Play))); - gain_astate_menu.items().push_back (MenuElem (_("Write"), - bind (mem_fun (*_io, &IO::set_parameter_automation_state), - Evoral::Parameter(GainAutomation), (AutoState) Write))); - gain_astate_menu.items().push_back (MenuElem (_("Touch"), - bind (mem_fun (*_io, &IO::set_parameter_automation_state), - Evoral::Parameter(GainAutomation), (AutoState) Touch))); - - connections.push_back (gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeterBase::gain_automation_style_button_event), false)); - connections.push_back (gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false)); - - connections.push_back (r->gain_control()->alist()->automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed))); - connections.push_back (r->gain_control()->alist()->automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed))); - - gain_automation_state_changed (); - } + if (!_route || !_route->is_hidden()) { + + using namespace Menu_Helpers; + + gain_astate_menu.items().clear (); + + gain_astate_menu.items().push_back (MenuElem (_("Manual"), + bind (mem_fun (*(gc_owner.get()), &Automatable::set_parameter_automation_state), + Evoral::Parameter(GainAutomation), (AutoState) Off))); + gain_astate_menu.items().push_back (MenuElem (_("Play"), + bind (mem_fun (*(gc_owner.get()), &Automatable::set_parameter_automation_state), + Evoral::Parameter(GainAutomation), (AutoState) Play))); + gain_astate_menu.items().push_back (MenuElem (_("Write"), + bind (mem_fun (*(gc_owner.get()), &Automatable::set_parameter_automation_state), + Evoral::Parameter(GainAutomation), (AutoState) Write))); + gain_astate_menu.items().push_back (MenuElem (_("Touch"), + bind (mem_fun (*(gc_owner.get()), &Automatable::set_parameter_automation_state), + Evoral::Parameter(GainAutomation), (AutoState) Touch))); + + connections.push_back (gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeterBase::gain_automation_style_button_event), false)); + connections.push_back (gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false)); + + connections.push_back (gc->alist()->automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed))); + connections.push_back (gc->alist()->automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed))); + + gain_automation_state_changed (); } - //cerr << "Connect " << this << " to gain change for " << _io->name() << endl; - - connections.push_back (_io->gain_control()->Changed.connect (mem_fun(*this, &GainMeterBase::gain_changed))); + connections.push_back (gc->Changed.connect (mem_fun (*this, &GainMeterBase::gain_changed))); gain_changed (); show_gain (); @@ -272,10 +273,8 @@ GainMeterBase::peak_button_release (GdkEventButton* ev) if (ev->button == 1 && Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier|Keyboard::TertiaryModifier)) { ResetAllPeakDisplays (); } else if (ev->button == 1 && Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { - boost::shared_ptr<Route> r; - - if ((r = boost::dynamic_pointer_cast<Route> (_io)) != 0) { - ResetGroupPeakDisplays (r->mix_group()); + if (_route) { + ResetGroupPeakDisplays (_route->mix_group()); } } else { reset_peak_display (); @@ -287,12 +286,7 @@ GainMeterBase::peak_button_release (GdkEventButton* ev) void GainMeterBase::reset_peak_display () { - boost::shared_ptr<Route> r; - - if ((r = boost::dynamic_pointer_cast<Route> (_io)) != 0) { - r->peak_meter().reset_max(); - } - + _meter->reset_max(); level_meter->clear_meters(); max_peak = -INFINITY; peak_display.set_label (_("-Inf")); @@ -302,13 +296,9 @@ GainMeterBase::reset_peak_display () void GainMeterBase::reset_group_peak_display (RouteGroup* group) { - boost::shared_ptr<Route> r; - - if ((r = boost::dynamic_pointer_cast<Route> (_io)) != 0) { - if (group == r->mix_group()) { - reset_peak_display (); + if (_route && group == _route->mix_group()) { + reset_peak_display (); } - } } void @@ -354,7 +344,7 @@ GainMeterBase::gain_activated () f = min (f, 6.0f); - _io->gain_control()->set_value (dB_to_coefficient(f)); + _gain_control->set_value (dB_to_coefficient(f)); if (gain_display.has_focus()) { PublicEditor::instance().reset_focus(); @@ -384,7 +374,7 @@ GainMeterBase::gain_adjusted () //cerr << this << " for " << _io->name() << " GAIN ADJUSTED\n"; if (!ignore_toggle) { //cerr << "Set GC\n"; - _io->gain_control()->set_value (slider_position_to_gain (gain_adjustment.get_value())); + _gain_control->set_value (slider_position_to_gain (gain_adjustment.get_value())); //cerr << "Set GC OUT\n"; } show_gain (); @@ -393,7 +383,7 @@ GainMeterBase::gain_adjusted () void GainMeterBase::effective_gain_display () { - gfloat value = gain_to_slider_position (_io->effective_gain()); + gfloat value = gain_to_slider_position (_gain_control->get_value()); //cerr << this << " for " << _io->name() << " EGAIN = " << value // << " AGAIN = " << gain_adjustment.get_value () << endl; @@ -428,7 +418,7 @@ void GainMeterBase::update_gain_sensitive () { static_cast<Gtkmm2ext::SliderController*>(gain_slider)->set_sensitive ( - !(_io->gain_control()->alist()->automation_state() & Play)); + !(_gain_control->alist()->automation_state() & Play)); } @@ -459,7 +449,7 @@ GainMeterBase::meter_press(GdkEventButton* ev) wait_for_release = false; - if ((_route = boost::dynamic_pointer_cast<Route>(_io)) == 0) { + if (!_route) { return FALSE; } @@ -482,10 +472,10 @@ GainMeterBase::meter_press(GdkEventButton* ev) } } - if (ev->button == 1 || Keyboard::is_button2_event (ev)) { + if (_route && (ev->button == 1 || Keyboard::is_button2_event (ev))) { if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { - + /* Primary+Tertiary-click applies change to all routes */ _session.begin_reversible_command (_("meter point change")); @@ -534,10 +524,8 @@ GainMeterBase::meter_release(GdkEventButton* ev) if (wait_for_release){ wait_for_release = false; - boost::shared_ptr<Route> r; - - if ((r = boost::dynamic_pointer_cast<Route>(_io)) != 0) { - set_meter_point (*r, old_meter_point); + if (_route) { + set_meter_point (*_route, old_meter_point); } } } @@ -566,9 +554,7 @@ GainMeterBase::set_mix_group_meter_point (Route& route, MeterPoint mp) void GainMeterBase::meter_point_clicked () { - boost::shared_ptr<Route> r; - - if ((r = boost::dynamic_pointer_cast<Route> (_io)) != 0) { + if (_route) { /* WHAT? */ } } @@ -576,14 +562,14 @@ GainMeterBase::meter_point_clicked () gint GainMeterBase::start_gain_touch (GdkEventButton* ev) { - _io->gain_control()->start_touch (); + _gain_control->start_touch (); return FALSE; } gint GainMeterBase::end_gain_touch (GdkEventButton* ev) { - _io->gain_control()->stop_touch (); + _gain_control->stop_touch (); return FALSE; } @@ -686,10 +672,10 @@ GainMeterBase::gain_automation_style_changed () { switch (_width) { case Wide: - gain_automation_style_button.set_label (astyle_string(_io->gain_control()->alist()->automation_style())); + gain_automation_style_button.set_label (astyle_string(_gain_control->alist()->automation_style())); break; case Narrow: - gain_automation_style_button.set_label (short_astyle_string(_io->gain_control()->alist()->automation_style())); + gain_automation_style_button.set_label (short_astyle_string(_gain_control->alist()->automation_style())); break; } } @@ -703,14 +689,14 @@ GainMeterBase::gain_automation_state_changed () switch (_width) { case Wide: - gain_automation_state_button.set_label (astate_string(_io->gain_control()->alist()->automation_state())); + gain_automation_state_button.set_label (astate_string(_gain_control->alist()->automation_state())); break; case Narrow: - gain_automation_state_button.set_label (short_astate_string(_io->gain_control()->alist()->automation_state())); + gain_automation_state_button.set_label (short_astate_string(_gain_control->alist()->automation_state())); break; } - x = (_io->gain_control()->alist()->automation_state() != Off); + x = (_gain_control->alist()->automation_state() != Off); if (gain_automation_state_button.get_active() != x) { ignore_toggle = true; @@ -811,8 +797,11 @@ GainMeter::GainMeter (Session& s) meter_metric_area.signal_expose_event().connect (mem_fun(*this, &GainMeter::meter_metrics_expose)); } -void -GainMeter::set_io (boost::shared_ptr<IO> io) +void +GainMeter::set_controls (boost::shared_ptr<Route> r, + boost::shared_ptr<PeakMeter> meter, + boost::shared_ptr<AutomationControl> gain_control, + boost::shared_ptr<Automatable> gc_owner) { if (level_meter->get_parent()) { hbox.remove (*level_meter); @@ -826,30 +815,17 @@ GainMeter::set_io (boost::shared_ptr<IO> io) fader_vbox->remove (gain_automation_state_button); } - GainMeterBase::set_io (io); + GainMeterBase::set_controls (r, meter, gain_control, gc_owner); - boost::shared_ptr<Route> r; - - if ((r = boost::dynamic_pointer_cast<Route> (_io)) != 0) { - - /* - if we have a non-hidden route (ie. we're not the click or the auditioner), - pack some route-dependent stuff. - */ - - gain_display_box.pack_end (peak_display, true, true); - hbox.pack_end (*level_meter, true, true); - - if (!r->is_hidden()) { - fader_vbox->pack_start (gain_automation_state_button, false, false, 0); - } - - } else { - - /* we're managing a non-Route IO (e.g. Send) */ - - gain_display_box.pack_end (peak_display, true, true); - hbox.pack_end (*level_meter, true, true); + /* + if we have a non-hidden route (ie. we're not the click or the auditioner), + pack some route-dependent stuff. + */ + + gain_display_box.pack_end (peak_display, true, true); + hbox.pack_end (*level_meter, true, true); + + if (!r->is_hidden()) { fader_vbox->pack_start (gain_automation_state_button, false, false, 0); } } @@ -941,7 +917,7 @@ GainMeter::meter_metrics_expose (GdkEventExpose *ev) boost::shared_ptr<PBD::Controllable> GainMeterBase::get_controllable() { - return _io->gain_control(); + return _gain_control; } diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index ea817bcae2..7feaf5c0e4 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -46,6 +46,8 @@ namespace ARDOUR { class Session; class Route; class RouteGroup; + class PeakMeter; + class Automatable; } namespace Gtkmm2ext { class FastMeter; @@ -62,8 +64,10 @@ class GainMeterBase : virtual public sigc::trackable bool horizontal); virtual ~GainMeterBase (); - virtual void set_io (boost::shared_ptr<ARDOUR::IO>); - boost::shared_ptr<ARDOUR::IO> io() const { return _io; } + virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route, + boost::shared_ptr<ARDOUR::PeakMeter> meter, + boost::shared_ptr<ARDOUR::AutomationControl> gain_control, + boost::shared_ptr<ARDOUR::Automatable> gc_owner); void update_gain_sensitive (); void update_meters (); @@ -83,7 +87,9 @@ class GainMeterBase : virtual public sigc::trackable protected: friend class MixerStrip; - boost::shared_ptr<ARDOUR::IO> _io; + boost::shared_ptr<ARDOUR::Route> _route; + boost::shared_ptr<ARDOUR::PeakMeter> _meter; + boost::shared_ptr<ARDOUR::AutomationControl> _gain_control; ARDOUR::Session& _session; std::vector<sigc::connection> connections; @@ -176,7 +182,10 @@ class GainMeter : public GainMeterBase, public Gtk::VBox GainMeter (ARDOUR::Session&); ~GainMeter () {} - void set_io (boost::shared_ptr<ARDOUR::IO>); + virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route, + boost::shared_ptr<ARDOUR::PeakMeter> meter, + boost::shared_ptr<ARDOUR::AutomationControl> gain_control, + boost::shared_ptr<ARDOUR::Automatable> gc_owner); int get_gm_width (); void setup_meters (int len=0); diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index fb7d946f7d..4333efd8ea 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -41,12 +41,14 @@ using namespace ARDOUR; using namespace Gtk; -IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool in) +IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io) : PortMatrix (session, io->default_type()) , _io (io) - , _find_inputs_for_io_outputs (in) { /* signal flow from 0 to 1 */ + + _find_inputs_for_io_outputs = (_io->direction() == IO::Output); + if (_find_inputs_for_io_outputs) { _other = 1; _ours = 0; @@ -73,9 +75,7 @@ IOSelector::setup_ports (int dim) } else { _port_group->clear (); - _port_group->add_bundle ( - _find_inputs_for_io_outputs ? _io->bundle_for_outputs() : _io->bundle_for_inputs() - ); + _port_group->add_bundle (_io->bundle ()); } _ports[dim].resume_signals (); @@ -96,17 +96,9 @@ IOSelector::set_state (ARDOUR::BundleChannel c[2], bool s) } if (s) { - if (!_find_inputs_for_io_outputs) { - _io->connect_input (f, *j, 0); - } else { - _io->connect_output (f, *j, 0); - } + _io->connect (f, *j, 0); } else { - if (!_find_inputs_for_io_outputs) { - _io->disconnect_input (f, *j, 0); - } else { - _io->disconnect_output (f, *j, 0); - } + _io->disconnect (f, *j, 0); } } } @@ -147,9 +139,9 @@ uint32_t IOSelector::n_io_ports () const { if (!_find_inputs_for_io_outputs) { - return _io->inputs().num_ports (_io->default_type()); + return _io->n_ports().get (_io->default_type()); } else { - return _io->outputs().num_ports (_io->default_type()); + return _io->n_ports().get (_io->default_type()); } } @@ -161,27 +153,13 @@ IOSelector::add_channel (boost::shared_ptr<ARDOUR::Bundle> b) // The IO selector only works for single typed IOs const ARDOUR::DataType t = _io->default_type (); - if (!_find_inputs_for_io_outputs) { - - try { - _io->add_input_port ("", this); - } - - catch (AudioEngine::PortRegistrationFailure& err) { - MessageDialog msg (_("There are no more JACK ports available.")); - msg.run (); - } - - } else { - - try { - _io->add_output_port ("", this); - } - - catch (AudioEngine::PortRegistrationFailure& err) { - MessageDialog msg (_("There are no more JACK ports available.")); - msg.run (); - } + try { + _io->add_port ("", this); + } + + catch (AudioEngine::PortRegistrationFailure& err) { + MessageDialog msg (_("There are no more JACK ports available.")); + msg.run (); } } @@ -193,11 +171,7 @@ IOSelector::remove_channel (ARDOUR::BundleChannel bc) return; } - if (_find_inputs_for_io_outputs) { - _io->remove_output_port (f, this); - } else { - _io->remove_input_port (f, this); - } + _io->remove_port (f, this); } bool @@ -206,9 +180,9 @@ IOSelector::list_is_global (int dim) const return (dim == _other); } -IOSelectorWindow::IOSelectorWindow (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool for_input, bool can_cancel) +IOSelectorWindow::IOSelectorWindow (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool can_cancel) : ArdourDialog ("I/O selector") - , _selector (session, io, !for_input) + , _selector (session, io) , add_button (_("Add Port")) , disconnect_button (_("Disconnect All")) , ok_button (can_cancel ? _("OK"): _("Close")) @@ -327,8 +301,8 @@ IOSelectorWindow::io_name_changed (void* src) } PortInsertUI::PortInsertUI (ARDOUR::Session& sess, boost::shared_ptr<ARDOUR::PortInsert> pi) - : input_selector (sess, pi->io(), true), - output_selector (sess, pi->io(), false) + : input_selector (sess, pi->input()) + , output_selector (sess, pi->output()) { output_selector.set_min_height_divisor (2); input_selector.set_min_height_divisor (2); diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h index 872fd5d7d6..d6b00254be 100644 --- a/gtk2_ardour/io_selector.h +++ b/gtk2_ardour/io_selector.h @@ -30,7 +30,7 @@ namespace ARDOUR { class IOSelector : public PortMatrix { public: - IOSelector (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool); + IOSelector (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>); void set_state (ARDOUR::BundleChannel c[2], bool); PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const; @@ -74,7 +74,7 @@ class IOSelector : public PortMatrix class IOSelectorWindow : public ArdourDialog { public: - IOSelectorWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool for_input, bool can_cancel = false); + IOSelectorWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool can_cancel = false); IOSelector& selector() { return _selector; } diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 18786fe54a..c8cd5fe464 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -506,13 +506,7 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool if (existing != _automation_tracks.end()) return; - boost::shared_ptr<AutomationControl> c - = boost::dynamic_pointer_cast<AutomationControl>(_route->data().control(param)); - - if (!c) { - c = boost::dynamic_pointer_cast<AutomationControl>(_route->control_factory(param)); - _route->add_control(c); - } + boost::shared_ptr<AutomationControl> c = _route->get_control (param); assert(c); diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index fdc1e2f39b..13e077c12f 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -34,6 +34,7 @@ #include <gtkmm2ext/bindable_button.h> #include "ardour/ardour.h" +#include "ardour/amp.h" #include "ardour/session.h" #include "ardour/audioengine.h" #include "ardour/route.h" @@ -71,20 +72,6 @@ sigc::signal<void,boost::shared_ptr<Route> > MixerStrip::SwitchIO; int MixerStrip::scrollbar_height = 0; -#ifdef VARISPEED_IN_MIXER_STRIP -static void -speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg) -{ - float val = adj.get_value (); - - if (val == 1.0) { - strcpy (buf, "1"); - } else { - snprintf (buf, 32, "%.3f", val); - } -} -#endif - MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer) : AxisView(sess) , RouteUI (sess, _("Mute"), _("Solo"), _("Record")) @@ -99,8 +86,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer) , bottom_button_table (1, 2) , meter_point_label (_("pre")) , comment_button (_("Comments")) - , speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1) - , speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true) { init (); @@ -128,8 +113,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt , bottom_button_table (1, 2) , meter_point_label (_("pre")) , comment_button (_("Comments")) - , speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1) - , speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true) { init (); @@ -146,7 +129,6 @@ MixerStrip::init () route_ops_menu = 0; ignore_comment_edit = false; ignore_toggle = false; - ignore_speed_adjustment = false; comment_window = 0; comment_area = 0; _width_owner = 0; @@ -340,12 +322,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) button_table.remove (*show_sends_button); } -#ifdef VARISPEED_IN_MIXER_STRIP - if (speed_frame->get_parent()) { - button_table.remove (*speed_frame); - } -#endif - RouteUI::set_route (rt); delete input_selector; @@ -354,14 +330,16 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) delete output_selector; output_selector = 0; - if (_current_send) { - _current_send->set_metering (false); + boost::shared_ptr<Send> send; + + if (_current_delivery && (send = boost::dynamic_pointer_cast<Send>(_current_delivery))) { + send->set_metering (false); } - _current_send.reset (); + _current_delivery = _route->main_outs (); - panners.set_io (rt); - gpm.set_io (rt); + panners.set_panner (rt->main_outs()->panner()); + gpm.set_controls (rt, rt->shared_peak_meter(), rt->gain_control(), rt->amp()); pre_processor_box.set_route (rt); post_processor_box.set_route (rt); @@ -388,20 +366,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) connections.push_back (at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen))); -#ifdef VARISPEED_IN_MIXER_STRIP - speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed)); - - speed_frame.set_name ("BaseFrame"); - speed_frame.set_shadow_type (Gtk::SHADOW_IN); - speed_frame.add (speed_spinner); - - speed_spinner.set_print_func (speed_printer, 0); - - ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed")); - - button_table.attach (speed_frame, 0, 2, 5, 6); -#endif /* VARISPEED_IN_MIXER_STRIP */ - button_table.attach (*rec_enable_button, 0, 2, 2, 3); rec_enable_button->show(); @@ -443,9 +407,9 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) connections.push_back (_route->meter_change.connect ( mem_fun(*this, &MixerStrip::meter_changed))); - connections.push_back (_route->input_changed.connect ( + connections.push_back (_route->input()->changed.connect ( mem_fun(*this, &MixerStrip::input_changed))); - connections.push_back (_route->output_changed.connect ( + connections.push_back (_route->output()->changed.connect ( mem_fun(*this, &MixerStrip::output_changed))); connections.push_back (_route->mix_group_changed.connect ( mem_fun(*this, &MixerStrip::mix_group_changed))); @@ -458,8 +422,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) if (is_audio_track()) { connections.push_back (audio_track()->DiskstreamChanged.connect ( mem_fun(*this, &MixerStrip::diskstream_changed))); - connections.push_back (get_diskstream()->SpeedChanged.connect ( - mem_fun(*this, &MixerStrip::speed_changed))); } connections.push_back (_route->NameChanged.connect ( @@ -485,10 +447,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) panners.setup_pan (); - if (is_audio_track()) { - speed_changed (); - } - update_diskstream_display (); update_input_display (); update_output_display (); @@ -530,9 +488,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) comment_button.show(); group_button.show(); group_label.show(); - speed_spinner.show(); - speed_label.show(); - speed_frame.show(); show (); } @@ -703,7 +658,7 @@ MixerStrip::output_press (GdkEventButton *ev) citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output))); citems.push_back (SeparatorElem()); - ARDOUR::BundleList current = _route->bundles_connected_to_outputs (); + ARDOUR::BundleList current = _route->output()->bundles_connected (); boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles (); for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) { @@ -712,7 +667,7 @@ MixerStrip::output_press (GdkEventButton *ev) boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes (); for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) { - maybe_add_bundle_to_output_menu ((*i)->bundle_for_inputs(), current); + maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current); } if (citems.size() == 2) { @@ -734,7 +689,7 @@ void MixerStrip::edit_output_configuration () { if (output_selector == 0) { - output_selector = new IOSelectorWindow (_session, _route, false); + output_selector = new IOSelectorWindow (_session, _route->output()); } if (output_selector->is_visible()) { @@ -748,7 +703,7 @@ void MixerStrip::edit_input_configuration () { if (input_selector == 0) { - input_selector = new IOSelectorWindow (_session, _route, true); + input_selector = new IOSelectorWindow (_session, _route->input()); } if (input_selector->is_visible()) { @@ -784,7 +739,7 @@ MixerStrip::input_press (GdkEventButton *ev) citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input))); citems.push_back (SeparatorElem()); - ARDOUR::BundleList current = _route->bundles_connected_to_inputs (); + ARDOUR::BundleList current = _route->input()->bundles_connected (); boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles (); for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) { @@ -793,7 +748,7 @@ MixerStrip::input_press (GdkEventButton *ev) boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes (); for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) { - maybe_add_bundle_to_input_menu ((*i)->bundle_for_outputs(), current); + maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current); } if (citems.size() == 2) { @@ -817,12 +772,12 @@ MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c) return; } - ARDOUR::BundleList current = _route->bundles_connected_to_inputs (); + ARDOUR::BundleList current = _route->input()->bundles_connected (); if (std::find (current.begin(), current.end(), c) == current.end()) { - _route->connect_input_ports_to_bundle (c, this); + _route->input()->connect_ports_to_bundle (c, this); } else { - _route->disconnect_input_ports_from_bundle (c, this); + _route->input()->disconnect_ports_from_bundle (c, this); } } @@ -833,12 +788,12 @@ MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c) return; } - ARDOUR::BundleList current = _route->bundles_connected_to_outputs (); + ARDOUR::BundleList current = _route->output()->bundles_connected (); if (std::find (current.begin(), current.end(), c) == current.end()) { - _route->connect_output_ports_to_bundle (c, this); + _route->output()->connect_ports_to_bundle (c, this); } else { - _route->disconnect_output_ports_from_bundle (c, this); + _route->output()->disconnect_ports_from_bundle (c, this); } } @@ -848,7 +803,7 @@ MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR: using namespace Menu_Helpers; if (b->ports_are_outputs() == false || - route()->default_type() != b->type() || + route()->input()->default_type() != b->type() || b->nchannels() != _route->n_inputs().get (b->type ())) { return; @@ -874,7 +829,7 @@ MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR using namespace Menu_Helpers; if (b->ports_are_inputs() == false || - route()->default_type() != b->type() || + route()->output()->default_type() != b->type() || b->nchannels() != _route->n_outputs().get (b->type ())) { return; @@ -938,7 +893,7 @@ MixerStrip::connect_to_pan () void MixerStrip::update_input_display () { - ARDOUR::BundleList const c = _route->bundles_connected_to_inputs (); + ARDOUR::BundleList const c = _route->input()->bundles_connected(); if (c.size() > 1) { input_label.set_text (_("Inputs")); @@ -960,7 +915,7 @@ MixerStrip::update_input_display () void MixerStrip::update_output_display () { - ARDOUR::BundleList const c = _route->bundles_connected_to_outputs (); + ARDOUR::BundleList const c = _route->output()->bundles_connected (); /* XXX: how do we represent >1 connected bundle? */ if (c.size() > 1) { @@ -1269,43 +1224,6 @@ MixerStrip::list_route_operations () refresh_remote_control_menu(); } - -void -MixerStrip::speed_adjustment_changed () -{ - /* since there is a usable speed adjustment, there has to be a diskstream */ - if (!ignore_speed_adjustment) { - get_diskstream()->set_speed (speed_adjustment.get_value()); - } -} - -void -MixerStrip::speed_changed () -{ - Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display)); -} - -void -MixerStrip::update_speed_display () -{ - float val; - - val = get_diskstream()->speed(); - - if (val != 1.0) { - speed_spinner.set_name ("MixerStripSpeedBaseNotOne"); - } else { - speed_spinner.set_name ("MixerStripSpeedBase"); - } - - if (speed_adjustment.get_value() != val) { - ignore_speed_adjustment = true; - speed_adjustment.set_value (val); - ignore_speed_adjustment = false; - } -} - - void MixerStrip::set_selected (bool yn) { @@ -1383,12 +1301,10 @@ MixerStrip::map_frozen () case AudioTrack::Frozen: pre_processor_box.set_sensitive (false); post_processor_box.set_sensitive (false); - speed_spinner.set_sensitive (false); break; default: pre_processor_box.set_sensitive (true); post_processor_box.set_sensitive (true); - speed_spinner.set_sensitive (true); // XXX need some way, maybe, to retoggle redirect editors break; } @@ -1499,8 +1415,6 @@ MixerStrip::meter_changed (void *src) void MixerStrip::switch_io (boost::shared_ptr<Route> target) { - boost::shared_ptr<IO> to_display; - if (_route == target || _route->is_master()) { /* don't change the display for the target or the master bus */ return; @@ -1519,22 +1433,28 @@ MixerStrip::switch_io (boost::shared_ptr<Route> target) return; } - if (_current_send) { - _current_send->set_metering (false); + boost::shared_ptr<Send> send; + + if (_current_delivery && (send = boost::dynamic_pointer_cast<Send>(_current_delivery))) { + send->set_metering (false); } - _current_send = _route->send_for (target); + _current_delivery = _route->send_for (target->input()); - if (_current_send) { - to_display = _current_send->io(); + if (_current_delivery) { + send = boost::dynamic_pointer_cast<Send>(_current_delivery); + send->set_metering (true); + _current_delivery->GoingAway.connect (mem_fun (*this, &MixerStrip::revert_to_default_display)); + gain_meter().set_controls (_route, send->meter(), send->amp()->gain_control(), send->amp()); + panner_ui().set_panner (_current_delivery->panner()); - _current_send->set_metering (true); - _current_send->GoingAway.connect (mem_fun (*this, &MixerStrip::revert_to_default_display)); + } else { + _current_delivery = _route->main_outs (); + gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->gain_control(), _route->amp()); + panner_ui().set_panner (_route->main_outs()->panner()); } - gain_meter().set_io (to_display); gain_meter().setup_meters (); - panner_ui().set_io (to_display); panner_ui().setup_pan (); } @@ -1544,14 +1464,17 @@ MixerStrip::revert_to_default_display () { show_sends_button->set_active (false); - if (_current_send) { - _current_send->set_metering (false); - _current_send.reset(); + boost::shared_ptr<Send> send; + + if (_current_delivery && (send = boost::dynamic_pointer_cast<Send>(_current_delivery))) { + send->set_metering (false); } + + _current_delivery = _route->main_outs(); - gain_meter().set_io (_route); + gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->gain_control(), _route->amp()); gain_meter().setup_meters (); - panner_ui().set_io (_route); + panner_ui().set_panner (_route->main_outs()->panner()); panner_ui().setup_pan (); } diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index f0cc4c67c6..43c2e197fd 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -242,15 +242,6 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void route_active_changed (); - /* speed control (for tracks only) */ - - Gtk::Adjustment speed_adjustment; - Gtkmm2ext::ClickBox speed_spinner; - Gtk::Label speed_label; - Gtk::Frame speed_frame; - - void speed_adjustment_changed (); - void speed_changed (); void name_changed (); void update_speed_display (); void map_frozen (); @@ -263,7 +254,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void engine_stopped(); void switch_io (boost::shared_ptr<ARDOUR::Route>); - boost::shared_ptr<ARDOUR::Send> _current_send; + boost::shared_ptr<ARDOUR::Delivery> _current_delivery; void revert_to_default_display (); static int scrollbar_height; diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index b35ebe5f22..29c991a995 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -25,6 +25,7 @@ #include <gtkmm2ext/barcontroller.h> #include "midi++/manager.h" #include "pbd/fastlog.h" +#include "pbd/stacktrace.h" #include "ardour_ui.h" #include "panner_ui.h" @@ -33,6 +34,7 @@ #include "panner.h" #include "gui_thread.h" +#include "ardour/delivery.h" #include "ardour/session.h" #include "ardour/panner.h" #include "ardour/route.h" @@ -131,13 +133,8 @@ PannerUI::PannerUI (Session& s) } void -PannerUI::set_io (boost::shared_ptr<IO> io) +PannerUI::set_panner (boost::shared_ptr<Panner> p) { - if (io && !io->panner()) { - cerr << "PannerUI::set_io IO has no panners" << endl; - return; - } - connections.clear (); delete pan_astyle_menu; @@ -146,18 +143,18 @@ PannerUI::set_io (boost::shared_ptr<IO> io) delete pan_astate_menu; pan_astate_menu = 0; - _io = io; - + _panner = p; + delete panner; panner = 0; - if (!_io) { + if (!_panner) { return; } - connections.push_back (_io->panner()->Changed.connect (mem_fun(*this, &PannerUI::panner_changed))); - connections.push_back (_io->panner()->LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage))); - connections.push_back (_io->panner()->StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state))); + connections.push_back (_panner->Changed.connect (mem_fun(*this, &PannerUI::panner_changed))); + connections.push_back (_panner->LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage))); + connections.push_back (_panner->StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state))); setup_pan (); @@ -196,16 +193,16 @@ PannerUI::build_astate_menu () } pan_astate_menu->items().push_back (MenuElem (_("Manual"), bind ( - mem_fun (_io->panner().get(), &Panner::set_automation_state), + mem_fun (_panner.get(), &Panner::set_automation_state), (AutoState) Off))); pan_astate_menu->items().push_back (MenuElem (_("Play"), bind ( - mem_fun (_io->panner().get(), &Panner::set_automation_state), + mem_fun (_panner.get(), &Panner::set_automation_state), (AutoState) Play))); pan_astate_menu->items().push_back (MenuElem (_("Write"), bind ( - mem_fun (_io->panner().get(), &Panner::set_automation_state), + mem_fun (_panner.get(), &Panner::set_automation_state), (AutoState) Write))); pan_astate_menu->items().push_back (MenuElem (_("Touch"), bind ( - mem_fun (_io->panner().get(), &Panner::set_automation_state), + mem_fun (_panner.get(), &Panner::set_automation_state), (AutoState) Touch))); } @@ -242,7 +239,7 @@ bool PannerUI::panning_link_button_release (GdkEventButton* ev) { if (!ignore_toggle) { - _io->panner()->set_linked (!_io->panner()->linked()); + _panner->set_linked (!_panner->linked()); } return true; } @@ -250,12 +247,12 @@ PannerUI::panning_link_button_release (GdkEventButton* ev) void PannerUI::panning_link_direction_clicked() { - switch (_io->panner()->link_direction()) { + switch (_panner->link_direction()) { case Panner::SameDirection: - _io->panner()->set_link_direction (Panner::OppositeDirection); + _panner->set_link_direction (Panner::OppositeDirection); break; default: - _io->panner()->set_link_direction (Panner::SameDirection); + _panner->set_link_direction (Panner::SameDirection); break; } } @@ -265,7 +262,7 @@ PannerUI::update_pan_linkage () { ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::update_pan_linkage)); - bool x = _io->panner()->linked(); + bool x = _panner->linked(); bool bx = panning_link_button.get_active(); if (x != bx) { @@ -277,7 +274,7 @@ PannerUI::update_pan_linkage () panning_link_direction_button.set_sensitive (x); - switch (_io->panner()->link_direction()) { + switch (_panner->link_direction()) { case Panner::SameDirection: panning_link_direction_button.set_image (*(manage (new Image (get_xpm ("forwardblarrow.xpm"))))); break; @@ -339,11 +336,16 @@ PannerUI::update_pan_state () void PannerUI::setup_pan () { - if (!_io || !_io->panner()) { + cerr << "Setup pan for " << _panner->name() << endl; + // PBD::stacktrace (cerr, 5); + + if (!_panner) { return; } - uint32_t nouts = _io->n_outputs ().n_audio(); + uint32_t nouts = _panner->nouts(); + + cerr << "\tnouts = " << nouts << endl; if (nouts == 0 || nouts == 1) { @@ -364,7 +366,7 @@ PannerUI::setup_pan () } else if (nouts == 2) { vector<Adjustment*>::size_type asz; - uint32_t npans = _io->panner()->npanners(); + uint32_t npans = _panner->npanners(); while (!pan_adjustments.empty()) { delete pan_bars.back(); @@ -381,7 +383,7 @@ PannerUI::setup_pan () /* initialize adjustment with 0.0 (L) or 1.0 (R) for the first and second panners, which serves as a default, otherwise use current value */ - rx = _io->panner()->pan_control( asz)->get_value(); + rx = _panner->pan_control( asz)->get_value(); if (npans == 1) { x = 0.5; @@ -395,20 +397,24 @@ PannerUI::setup_pan () pan_adjustments.push_back (new Adjustment (x, 0, 1.0, 0.005, 0.05)); bc = new PannerBar (*pan_adjustments[asz], - boost::static_pointer_cast<PBD::Controllable>( _io->panner()->pan_control( asz )) ); + boost::static_pointer_cast<PBD::Controllable>( _panner->pan_control( asz )) ); /* now set adjustment with current value of panner, then connect the signals */ pan_adjustments.back()->set_value(rx); pan_adjustments.back()->signal_value_changed().connect (bind (mem_fun(*this, &PannerUI::pan_adjustment_changed), (uint32_t) asz)); - _io->panner()->pan_control( asz )->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz)); + _panner->pan_control( asz )->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz)); bc->set_name ("PanSlider"); bc->set_shadow_type (Gtk::SHADOW_NONE); - - bc->StartGesture.connect (bind (mem_fun (*_io, &IO::start_pan_touch), (uint32_t) asz)); - bc->StopGesture.connect (bind (mem_fun (*_io, &IO::end_pan_touch), (uint32_t) asz)); + + boost::shared_ptr<AutomationControl> ac = _panner->pan_control (asz); + + if (asz) { + bc->StartGesture.connect (mem_fun (*ac, &AutomationControl::start_touch)); + bc->StopGesture.connect (mem_fun (*ac, &AutomationControl::stop_touch)); + } char buf[64]; snprintf (buf, sizeof (buf), _("panner for channel %zu"), asz + 1); @@ -437,7 +443,7 @@ PannerUI::setup_pan () } else { if (!panner) { - panner = new Panner2d (_io->panner(), 61); + panner = new Panner2d (_panner, 61); panner->set_name ("MixerPanZone"); panner->show (); @@ -446,9 +452,9 @@ PannerUI::setup_pan () } update_pan_sensitive (); - panner->reset (_io->n_inputs().n_audio()); + panner->reset (nouts); if (big_window) { - big_window->reset (_io->n_inputs().n_audio()); + big_window->reset (_panner->npanners()); } panner->set_size_request (-1, 61); @@ -467,7 +473,7 @@ PannerUI::pan_button_event (GdkEventButton* ev, uint32_t which) case 1: if (panner && ev->type == GDK_2BUTTON_PRESS) { if (!big_window) { - big_window = new Panner2dWindow (panner->get_panner(), 400, _io->n_inputs().n_audio()); + big_window = new Panner2dWindow (_panner, 400, _panner->npanners()); } big_window->show (); return true; @@ -502,7 +508,7 @@ PannerUI::build_pan_menu (uint32_t which) /* set state first, connect second */ - (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_io->panner()->streampanner(which).muted()); + (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_panner->streampanner(which).muted()); (dynamic_cast<CheckMenuItem*> (&items.back()))->signal_toggled().connect (bind (mem_fun(*this, &PannerUI::pan_mute), which)); @@ -511,7 +517,7 @@ PannerUI::build_pan_menu (uint32_t which) /* set state first, connect second */ - bypass_menu_item->set_active (_io->panner()->bypassed()); + bypass_menu_item->set_active (_panner->bypassed()); bypass_menu_item->signal_toggled().connect (mem_fun(*this, &PannerUI::pan_bypass_toggle)); items.push_back (MenuElem (_("Reset"), bind (mem_fun (*this, &PannerUI::pan_reset), which))); @@ -522,38 +528,38 @@ PannerUI::build_pan_menu (uint32_t which) void PannerUI::pan_mute (uint32_t which) { - StreamPanner& sp = _io->panner()->streampanner(which); + StreamPanner& sp = _panner->streampanner(which); sp.set_muted (!sp.muted()); } void PannerUI::pan_bypass_toggle () { - if (bypass_menu_item && (_io->panner()->bypassed() != bypass_menu_item->get_active())) { - _io->panner()->set_bypassed (!_io->panner()->bypassed()); + if (bypass_menu_item && (_panner->bypassed() != bypass_menu_item->get_active())) { + _panner->set_bypassed (!_panner->bypassed()); } } void PannerUI::pan_reset (uint32_t which) { - _io->panner()->reset_streampanner (which); + _panner->reset_streampanner (which); } void PannerUI::pan_reset_all () { - _io->panner()->reset_to_default (); + _panner->reset_to_default (); } void PannerUI::effective_pan_display () { - if (_io->panner()->empty()) { + if (_panner->empty()) { return; } - switch (_io->n_outputs().n_audio()) { + switch (_panner->nouts()) { case 0: case 1: /* relax */ @@ -576,7 +582,7 @@ PannerUI::pan_changed (void *src) return; } - switch (_io->panner()->npanners()) { + switch (_panner->npanners()) { case 0: panning_link_direction_button.set_sensitive (false); panning_link_button.set_sensitive (false); @@ -590,7 +596,7 @@ PannerUI::pan_changed (void *src) panning_link_button.set_sensitive (true); } - uint32_t nouts = _io->n_outputs().n_audio(); + uint32_t nouts = _panner->nouts(); switch (nouts) { case 0: @@ -612,11 +618,11 @@ PannerUI::pan_changed (void *src) void PannerUI::pan_adjustment_changed (uint32_t which) { - if (!in_pan_update && which < _io->panner()->npanners()) { + if (!in_pan_update && which < _panner->npanners()) { float xpos; float val = pan_adjustments[which]->get_value (); - xpos = _io->panner()->pan_control( which )->get_value(); + xpos = _panner->pan_control( which )->get_value(); /* add a kinda-sorta detent for the middle */ @@ -633,7 +639,7 @@ PannerUI::pan_adjustment_changed (uint32_t which) if (!Panner::equivalent (val, xpos)) { - _io->panner()->streampanner(which).set_position (val); + _panner->streampanner(which).set_position (val); /* XXX the panner objects have no access to the session, so do this here. ick. @@ -648,11 +654,11 @@ PannerUI::pan_value_changed (uint32_t which) { ENSURE_GUI_THREAD (bind (mem_fun(*this, &PannerUI::pan_value_changed), which)); - if (_io->n_outputs().n_audio() > 1 && which < _io->panner()->npanners()) { + if (_panner->npanners() > 1 && which < _panner->npanners()) { float xpos; float val = pan_adjustments[which]->get_value (); - _io->panner()->streampanner(which).get_position (xpos); + _panner->streampanner(which).get_position (xpos); if (!Panner::equivalent (val, xpos)) { in_pan_update = true; @@ -678,14 +684,14 @@ PannerUI::update_pan_bars (bool only_if_aplay) float xpos, val; if (only_if_aplay) { - boost::shared_ptr<AutomationList> alist (_io->panner()->streampanner(n).pan_control()->alist()); + boost::shared_ptr<AutomationList> alist (_panner->streampanner(n).pan_control()->alist()); if (!alist->automation_playback()) { continue; } } - _io->panner()->streampanner(n).get_effective_position (xpos); + _panner->streampanner(n).get_effective_position (xpos); val = (*i)->get_value (); if (!Panner::equivalent (val, xpos)) { @@ -699,9 +705,9 @@ PannerUI::update_pan_bars (bool only_if_aplay) void PannerUI::update_pan_sensitive () { - bool sensitive = !(_io->panner()->automation_state() & Play); + bool sensitive = !(_panner->automation_state() & Play); - switch (_io->n_outputs().n_audio()) { + switch (_panner->nouts()) { case 0: case 1: break; @@ -771,10 +777,10 @@ PannerUI::pan_automation_style_changed () switch (_width) { case Wide: - pan_automation_style_button.set_label (astyle_string(_io->panner()->automation_style())); + pan_automation_style_button.set_label (astyle_string(_panner->automation_style())); break; case Narrow: - pan_automation_style_button.set_label (short_astyle_string(_io->panner()->automation_style())); + pan_automation_style_button.set_label (short_astyle_string(_panner->automation_style())); break; } } @@ -788,10 +794,10 @@ PannerUI::pan_automation_state_changed () switch (_width) { case Wide: - pan_automation_state_button.set_label (astate_string(_io->panner()->automation_state())); + pan_automation_state_button.set_label (astate_string(_panner->automation_state())); break; case Narrow: - pan_automation_state_button.set_label (short_astate_string(_io->panner()->automation_state())); + pan_automation_state_button.set_label (short_astate_string(_panner->automation_state())); break; } @@ -800,11 +806,11 @@ PannerUI::pan_automation_state_changed () here. */ - if (_io->panner()->empty()) { + if (_panner->empty()) { return; } - x = (_io->panner()->streampanner(0).pan_control()->alist()->automation_state() != Off); + x = (_panner->streampanner(0).pan_control()->alist()->automation_state() != Off); if (pan_automation_state_button.get_active() != x) { ignore_toggle = true; diff --git a/gtk2_ardour/panner_ui.h b/gtk2_ardour/panner_ui.h index 602164d7a9..95e1e6c688 100644 --- a/gtk2_ardour/panner_ui.h +++ b/gtk2_ardour/panner_ui.h @@ -40,8 +40,9 @@ class PannerBar; class Panner2dWindow; namespace ARDOUR { - class IO; class Session; + class Panner; + class Delivery; } namespace Gtkmm2ext { class FastMeter; @@ -58,7 +59,7 @@ class PannerUI : public Gtk::HBox PannerUI (ARDOUR::Session&); ~PannerUI (); - virtual void set_io (boost::shared_ptr<ARDOUR::IO>); + virtual void set_panner (boost::shared_ptr<ARDOUR::Panner>); void pan_changed (void *); @@ -76,7 +77,7 @@ class PannerUI : public Gtk::HBox private: friend class MixerStrip; - boost::shared_ptr<ARDOUR::IO> _io; + boost::shared_ptr<ARDOUR::Panner> _panner; ARDOUR::Session& _session; std::vector<sigc::connection> connections; diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc index 3ff074f9d7..99c4861f79 100644 --- a/gtk2_ardour/port_group.cc +++ b/gtk2_ardour/port_group.cc @@ -36,6 +36,7 @@ using namespace std; using namespace Gtk; +using namespace ARDOUR; /** PortGroup constructor. * @param n Name. @@ -50,7 +51,7 @@ PortGroup::PortGroup (std::string const & n) * @param b Bundle. */ void -PortGroup::add_bundle (boost::shared_ptr<ARDOUR::Bundle> b) +PortGroup::add_bundle (boost::shared_ptr<Bundle> b) { assert (b.get()); _bundles.push_back (b); @@ -62,11 +63,11 @@ PortGroup::add_bundle (boost::shared_ptr<ARDOUR::Bundle> b) } void -PortGroup::remove_bundle (boost::shared_ptr<ARDOUR::Bundle> b) +PortGroup::remove_bundle (boost::shared_ptr<Bundle> b) { assert (b.get()); - ARDOUR::BundleList::iterator i = std::find (_bundles.begin(), _bundles.end(), b); + BundleList::iterator i = std::find (_bundles.begin(), _bundles.end(), b); if (i == _bundles.end()) { return; } @@ -78,7 +79,7 @@ PortGroup::remove_bundle (boost::shared_ptr<ARDOUR::Bundle> b) } void -PortGroup::bundle_changed (ARDOUR::Bundle::Change c) +PortGroup::bundle_changed (Bundle::Change c) { BundleChanged (c); } @@ -103,7 +104,7 @@ PortGroup::clear () bool PortGroup::has_port (std::string const& p) const { - for (ARDOUR::BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) { + for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) { if ((*i)->offers_port_alone (p)) { return true; } @@ -112,7 +113,7 @@ PortGroup::has_port (std::string const& p) const return false; } -boost::shared_ptr<ARDOUR::Bundle> +boost::shared_ptr<Bundle> PortGroup::only_bundle () { assert (_bundles.size() == 1); @@ -124,7 +125,7 @@ uint32_t PortGroup::total_channels () const { uint32_t n = 0; - for (ARDOUR::BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) { + for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) { n += (*i)->nchannels (); } @@ -135,21 +136,49 @@ PortGroup::total_channels () const /** PortGroupList constructor. */ PortGroupList::PortGroupList () - : _type (ARDOUR::DataType::AUDIO), _signals_suspended (false), _pending_change (false) + : _type (DataType::AUDIO), _signals_suspended (false), _pending_change (false) { } void -PortGroupList::set_type (ARDOUR::DataType t) +PortGroupList::set_type (DataType t) { _type = t; clear (); } +void +PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boost::shared_ptr<RouteBundle> rb, bool inputs) +{ + boost::shared_ptr<Processor> p (wp.lock()); + + if (!p) { + return; + } + + boost::shared_ptr<IOProcessor> iop = boost::dynamic_pointer_cast<IOProcessor> (p); + + if (iop) { + + if (inputs) { + if (!iop->output()) { + return; + } + } else { + if (!iop->input()) { + return; + } + } + + rb->add_processor_bundle (inputs ? iop->output()->bundle() : iop->input()->bundle()); + } +} + + /** Gather bundles from around the system and put them in this PortGroupList */ void -PortGroupList::gather (ARDOUR::Session& session, bool inputs) +PortGroupList::gather (Session& session, bool inputs) { clear (); @@ -162,49 +191,28 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) the route's IO bundles and processor bundles together so that they are presented as one bundle in the matrix. */ - boost::shared_ptr<ARDOUR::RouteList> routes = session.get_routes (); - - for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) { + boost::shared_ptr<RouteList> routes = session.get_routes (); - boost::shared_ptr<RouteBundle> rb ( - new RouteBundle ( - inputs ? (*i)->bundle_for_inputs() : (*i)->bundle_for_outputs() - ) - ); + for (RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) { - uint32_t n = 0; - while (1) { - boost::shared_ptr<ARDOUR::Processor> p = (*i)->nth_processor (n); - if (p == 0) { - break; - } + boost::shared_ptr<RouteBundle> rb (new RouteBundle (inputs ? (*i)->output()->bundle() : (*i)->input()->bundle())); - boost::shared_ptr<ARDOUR::IOProcessor> iop = boost::dynamic_pointer_cast<ARDOUR::IOProcessor> (p); + (*i)->foreach_processor (bind (mem_fun (*this, &PortGroupList::maybe_add_processor_to_bundle), rb, inputs)); - if (iop) { - rb->add_processor_bundle ( - inputs ? iop->io()->bundle_for_inputs() : iop->io()->bundle_for_outputs() - ); - - } - - ++n; - } - /* Work out which group to put this bundle in */ boost::shared_ptr<PortGroup> g; - if (_type == ARDOUR::DataType::AUDIO) { + if (_type == DataType::AUDIO) { - if (boost::dynamic_pointer_cast<ARDOUR::AudioTrack> (*i)) { + if (boost::dynamic_pointer_cast<AudioTrack> (*i)) { g = track; - } else if (!boost::dynamic_pointer_cast<ARDOUR::MidiTrack>(*i)) { + } else if (!boost::dynamic_pointer_cast<MidiTrack>(*i)) { g = bus; } - } else if (_type == ARDOUR::DataType::MIDI) { + } else if (_type == DataType::MIDI) { - if (boost::dynamic_pointer_cast<ARDOUR::MidiTrack> (*i)) { + if (boost::dynamic_pointer_cast<MidiTrack> (*i)) { g = track; } @@ -219,11 +227,11 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) /* Bundles owned by the session. We only add the mono ones and the User ones otherwise there is duplication of the same ports within the matrix */ - boost::shared_ptr<ARDOUR::BundleList> b = session.bundles (); - for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) { + boost::shared_ptr<BundleList> b = session.bundles (); + for (BundleList::iterator i = b->begin(); i != b->end(); ++i) { if ((*i)->ports_are_inputs() == inputs && (*i)->type() == _type) { - if ((*i)->nchannels() == 1 || boost::dynamic_pointer_cast<ARDOUR::UserBundle> (*i)) { + if ((*i)->nchannels() == 1 || boost::dynamic_pointer_cast<UserBundle> (*i)) { system->add_bundle (*i); } @@ -282,10 +290,10 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) emit_changed (); } -boost::shared_ptr<ARDOUR::Bundle> +boost::shared_ptr<Bundle> PortGroupList::make_bundle_from_ports (std::vector<std::string> const & p, bool inputs) const { - boost::shared_ptr<ARDOUR::Bundle> b (new ARDOUR::Bundle ("", _type, inputs)); + boost::shared_ptr<Bundle> b (new Bundle ("", _type, inputs)); std::string const pre = common_prefix (p); if (!pre.empty()) { @@ -366,7 +374,7 @@ PortGroupList::clear () } -ARDOUR::BundleList const & +BundleList const & PortGroupList::bundles () const { _bundles.clear (); @@ -410,7 +418,7 @@ PortGroupList::add_group (boost::shared_ptr<PortGroup> g) } void -PortGroupList::remove_bundle (boost::shared_ptr<ARDOUR::Bundle> b) +PortGroupList::remove_bundle (boost::shared_ptr<Bundle> b) { for (List::iterator i = _groups.begin(); i != _groups.end(); ++i) { (*i)->remove_bundle (b); @@ -446,7 +454,7 @@ PortGroupList::resume_signals () _signals_suspended = false; } -RouteBundle::RouteBundle (boost::shared_ptr<ARDOUR::Bundle> r) +RouteBundle::RouteBundle (boost::shared_ptr<Bundle> r) : _route (r) { _route->Changed.connect (sigc::hide (sigc::mem_fun (*this, &RouteBundle::reread_component_bundles))); @@ -470,7 +478,7 @@ RouteBundle::reread_component_bundles () } } - for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _processor.begin(); i != _processor.end(); ++i) { + for (std::vector<boost::shared_ptr<Bundle> >::iterator i = _processor.begin(); i != _processor.end(); ++i) { add_channels_from_bundle (*i); } @@ -478,7 +486,7 @@ RouteBundle::reread_component_bundles () } void -RouteBundle::add_processor_bundle (boost::shared_ptr<ARDOUR::Bundle> p) +RouteBundle::add_processor_bundle (boost::shared_ptr<Bundle> p) { p->Changed.connect (sigc::hide (sigc::mem_fun (*this, &RouteBundle::reread_component_bundles))); _processor.push_back (p); diff --git a/gtk2_ardour/port_group.h b/gtk2_ardour/port_group.h index 02dd965e1d..707cc04966 100644 --- a/gtk2_ardour/port_group.h +++ b/gtk2_ardour/port_group.h @@ -31,9 +31,11 @@ namespace ARDOUR { class Session; class Bundle; + class Processor; } class PortMatrix; +class RouteBundle; /** A list of bundles and ports, grouped by some aspect of their * type e.g. busses, tracks, system. Each group has 0 or more bundles @@ -119,7 +121,8 @@ class PortGroupList : public sigc::trackable std::string common_prefix_before (std::vector<std::string> const &, std::string const &) const; void emit_changed (); boost::shared_ptr<ARDOUR::Bundle> make_bundle_from_ports (std::vector<std::string> const &, bool) const; - + void maybe_add_processor_to_bundle (boost::weak_ptr<ARDOUR::Processor>, boost::shared_ptr<RouteBundle>, bool); + ARDOUR::DataType _type; mutable ARDOUR::BundleList _bundles; List _groups; diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index f850582fec..f8ea758549 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -452,7 +452,7 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins) } if (_route->add_processor (processor, _placement, &err_streams)) { - weird_plugin_dialog (**p, err_streams, _route); + weird_plugin_dialog (**p, err_streams); // XXX SHAREDPTR delete plugin here .. do we even need to care? } else { @@ -467,7 +467,7 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins) } void -ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams, boost::shared_ptr<IO> io) +ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams) { ArdourDialog dialog (_("ardour: weird plugin dialog")); Label label; @@ -511,7 +511,7 @@ ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams, b void ProcessorBox::choose_insert () { - boost::shared_ptr<Processor> processor (new PortInsert (_session)); + boost::shared_ptr<Processor> processor (new PortInsert (_session, _route->mute_master())); processor->ActiveChanged.connect (bind ( mem_fun(*this, &ProcessorBox::show_processor_active), boost::weak_ptr<Processor>(processor))); @@ -522,7 +522,7 @@ ProcessorBox::choose_insert () void ProcessorBox::choose_send () { - boost::shared_ptr<Send> send (new Send (_session)); + boost::shared_ptr<Send> send (new Send (_session, _route->mute_master())); /* make an educated guess at the initial number of outputs for the send */ ChanCount outs = (_session.master_out()) @@ -531,14 +531,14 @@ ProcessorBox::choose_send () /* XXX need processor lock on route */ try { - send->io()->ensure_io (ChanCount::ZERO, outs, false, this); + send->output()->ensure_io (outs, false, this); } catch (AudioEngine::PortRegistrationFailure& err) { error << string_compose (_("Cannot set up new send: %1"), err.what()) << endmsg; return; } /* let the user adjust the IO setup before creation */ - IOSelectorWindow *ios = new IOSelectorWindow (_session, send->io(), false, true); + IOSelectorWindow *ios = new IOSelectorWindow (_session, send->output(), true); ios->show_all (); /* keep a reference to the send so it doesn't get deleted while @@ -588,14 +588,14 @@ ProcessorBox::choose_return () /* XXX need processor lock on route */ try { - retrn->io()->ensure_io (ins, ChanCount::ZERO, false, this); + retrn->input()->ensure_io (ins, false, this); } catch (AudioEngine::PortRegistrationFailure& err) { error << string_compose (_("Cannot set up new return: %1"), err.what()) << endmsg; return; } /* let the user adjust the IO setup before creation */ - IOSelectorWindow *ios = new IOSelectorWindow (_session, retrn->io(), true, true); + IOSelectorWindow *ios = new IOSelectorWindow (_session, retrn->output(), true); ios->show_all (); /* keep a reference to the send so it doesn't get deleted while @@ -1050,7 +1050,7 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist) if (type->value() == "send") { XMLNode n (**niter); Send::make_unique (n, _session); - p.reset (new Send (_session, n)); + p.reset (new Send (_session, _route->mute_master(), n)); } else if (type->value() == "meter") { p = _route->shared_peak_meter(); @@ -1064,7 +1064,7 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist) continue; } else if (type->value() == "listen") { - p.reset (new Delivery (_session, **niter)); + p.reset (new Delivery (_session, _route->mute_master(), **niter)); } else { p.reset (new PluginInsert (_session, **niter)); @@ -1214,8 +1214,8 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor) gidget = send_ui; #else if (_parent_strip) { - _parent_strip->gain_meter().set_io (send->io()); - _parent_strip->panner_ui().set_io (send->io()); + _parent_strip->gain_meter().set_controls (_route, send->meter(), send->amp()->gain_control(), send->amp()); + _parent_strip->panner_ui().set_panner (send->panner()); } #endif diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index d53d05fe23..985c8a1177 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -205,7 +205,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject gint idle_delete_processor (boost::weak_ptr<ARDOUR::Processor>); - void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::ProcessorStreams streams, boost::shared_ptr<ARDOUR::IO> io); + void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::ProcessorStreams streams); static ProcessorBox* _current_processor_box; static bool enter_box (GdkEventCrossing*, ProcessorBox*); diff --git a/gtk2_ardour/return_ui.cc b/gtk2_ardour/return_ui.cc index ac06529d38..155a1095c1 100644 --- a/gtk2_ardour/return_ui.cc +++ b/gtk2_ardour/return_ui.cc @@ -19,6 +19,7 @@ #include <gtkmm2ext/doi.h> +#include "ardour/amp.h" #include "ardour/io.h" #include "ardour/return.h" @@ -37,7 +38,7 @@ ReturnUI::ReturnUI (boost::shared_ptr<Return> r, Session& se) , _session (se) , _gpm (se) { - _gpm.set_io (r->io()); + _gpm.set_controls (boost::shared_ptr<Route>(), r->meter(), r->amp()->gain_control(), r->amp()); _hbox.pack_start (_gpm, true, true); set_name ("ReturnUIFrame"); @@ -47,7 +48,7 @@ ReturnUI::ReturnUI (boost::shared_ptr<Return> r, Session& se) _vbox.pack_start (_hbox, false, false, false); - io = manage (new IOSelector (se, r->io(), true)); + io = manage (new IOSelector (se, r->output())); pack_start (_vbox, false, false); @@ -55,21 +56,19 @@ ReturnUI::ReturnUI (boost::shared_ptr<Return> r, Session& se) show_all (); - //_return->set_metering (true); - - _return->io()->input_changed.connect (mem_fun (*this, &ReturnUI::ins_changed)); - //_return->io()->output_changed.connect (mem_fun (*this, &ReturnUI::outs_changed)); + _return->set_metering (true); + _return->input()->changed.connect (mem_fun (*this, &ReturnUI::ins_changed)); _gpm.setup_meters (); _gpm.set_fader_name ("ReturnUIFrame"); - + // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun (*this, &ReturnUI::update)); fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &ReturnUI::fast_update)); } ReturnUI::~ReturnUI () { - //_return->set_metering (false); + _return->set_metering (false); /* XXX not clear that we need to do this */ @@ -111,12 +110,8 @@ ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> s, Session& ss) set_name ("ReturnUIWindow"); - going_away_connection = s->GoingAway.connect ( - mem_fun (*this, &ReturnUIWindow::return_going_away)); - - signal_delete_event().connect (bind ( - sigc::ptr_fun (just_hide_it), - reinterpret_cast<Window *> (this))); + going_away_connection = s->GoingAway.connect (mem_fun (*this, &ReturnUIWindow::return_going_away)); + signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window *> (this))); } ReturnUIWindow::~ReturnUIWindow () diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 5c709d80bf..d2fc106c42 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -298,7 +298,7 @@ RouteParams_UI::cleanup_latency_frame () void RouteParams_UI::setup_latency_frame () { - latency_widget = new LatencyGUI (*(_route.get()), session->frame_rate(), session->engine().frames_per_cycle()); + latency_widget = new LatencyGUI (*(_route->output()), session->frame_rate(), session->engine().frames_per_cycle()); char buf[128]; snprintf (buf, sizeof (buf), _("Playback delay: %u samples"), _route->initial_delay()); @@ -322,13 +322,13 @@ RouteParams_UI::setup_io_frames() cleanup_io_frames(); // input - _input_iosel = new IOSelector (*session, _route, false); + _input_iosel = new IOSelector (*session, _route->input()); _input_iosel->setup (); input_frame.add (*_input_iosel); input_frame.show_all(); // output - _output_iosel = new IOSelector (*session, _route, true); + _output_iosel = new IOSelector (*session, _route->output()); _output_iosel->setup (); output_frame.add (*_output_iosel); output_frame.show_all(); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index df85cf69a4..715a70b1d3 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -40,6 +40,7 @@ #include <gtkmm2ext/bindable_button.h> #include <gtkmm2ext/utils.h> +#include "ardour/amp.h" #include "ardour/audioplaylist.h" #include "ardour/diskstream.h" #include "ardour/event_type_map.h" @@ -110,7 +111,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh visual_button (_("v")), gm (sess, slider, true) { - gm.set_io (rt); + gm.set_controls (_route, _route->shared_peak_meter(), _route->gain_control(), _route->amp()); gm.get_level_meter().set_no_show_all(); gm.get_level_meter().setup_meters(50); @@ -187,8 +188,8 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh controls_hbox.pack_start(gm.get_level_meter(), false, false); _route->meter_change.connect (mem_fun(*this, &RouteTimeAxisView::meter_changed)); - _route->input_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed)); - _route->output_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed)); + _route->input()->changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed)); + _route->output()->changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed)); controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); @@ -231,7 +232,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); _route->processors_changed.connect (mem_fun(*this, &RouteTimeAxisView::processors_changed)); _route->NameChanged.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed)); - _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); + _route->solo_isolated_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); if (is_track()) { diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 393ab011f3..b62229a70c 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -101,7 +101,6 @@ RouteUI::init () ignore_toggle = false; wait_for_release = false; route_active_menu_item = 0; - was_solo_safe = false; polarity_menu_item = 0; denormal_menu_item = 0; multiple_mute_change = false; @@ -192,7 +191,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp) connections.push_back (_route->active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed))); connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed))); connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed))); - connections.push_back (_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed))); + connections.push_back (_route->solo_isolated_changed.connect (mem_fun(*this, &RouteUI::solo_changed))); if (is_track()) { boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route); @@ -396,7 +395,7 @@ RouteUI::solo_press(GdkEventButton* ev) Config->set_solo_latched (false); } } else { - _route->set_solo_safe (!_route->solo_safe(), this); + _route->set_solo_isolated (!_route->solo_isolated(), this); wait_for_release = false; } @@ -621,7 +620,7 @@ RouteUI::update_solo_display () ignore_toggle = false; } - if (_route->solo_safe()) { + if (_route->solo_isolated()) { solo_button->set_visual_state (2); } else if (_route->soloed()) { solo_button->set_visual_state (1); @@ -663,8 +662,7 @@ RouteUI::update_mute_display () if (Config->get_show_solo_mutes()) { if (_route->muted()) { mute_button->set_visual_state (2); - } else if (!_route->soloed() && _route->solo_muted()) { - + } else if (!_route->soloed() && _session.soloing()) { mute_button->set_visual_state (1); } else { mute_button->set_visual_state (0); @@ -804,10 +802,10 @@ RouteUI::build_solo_menu (void) MenuList& items = solo_menu->items(); CheckMenuItem* check; - check = new CheckMenuItem(_("Solo Lock")); - check->set_active (_route->solo_safe()); - check->signal_toggled().connect (bind (mem_fun (*this, &RouteUI::toggle_solo_safe), check)); - _route->solo_safe_changed.connect(bind (mem_fun (*this, &RouteUI::solo_safe_toggle), check)); + check = new CheckMenuItem(_("Solo Isolate")); + check->set_active (_route->solo_isolated()); + check->signal_toggled().connect (bind (mem_fun (*this, &RouteUI::toggle_solo_isolated), check)); + _route->solo_isolated_changed.connect(bind (mem_fun (*this, &RouteUI::solo_isolated_toggle), check)); items.push_back (CheckMenuElem(*check)); check->show_all(); @@ -823,9 +821,11 @@ RouteUI::build_mute_menu(void) mute_menu = new Menu; mute_menu->set_name ("ArdourContextMenu"); + +#if FIX_ME_IN_3_0 MenuList& items = mute_menu->items(); CheckMenuItem* check; - + check = new CheckMenuItem(_("Pre Fader")); init_mute_menu(PRE_FADER, check); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), PRE_FADER, check)); @@ -853,29 +853,27 @@ RouteUI::build_mute_menu(void) _route->main_outs_changed.connect(bind (mem_fun (*this, &RouteUI::main_outs_toggle), check)); items.push_back (CheckMenuElem(*check)); check->show_all(); - +#endif //items.push_back (SeparatorElem()); // items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn))); } void -RouteUI::init_mute_menu(mute_type type, CheckMenuItem* check) +RouteUI::init_mute_menu(MuteMaster::MutePoint mp, CheckMenuItem* check) { - if (_route->get_mute_config (type)) { - check->set_active (true); - } + check->set_active (_route->mute_master()->muted_at (mp)); } void -RouteUI::toggle_mute_menu(mute_type type, Gtk::CheckMenuItem* check) +RouteUI::toggle_mute_menu(MuteMaster::MutePoint mp, Gtk::CheckMenuItem* check) { - _route->set_mute_config(type, check->get_active(), this); + // _route->set_mute_config(type, check->get_active(), this); } void -RouteUI::toggle_solo_safe (Gtk::CheckMenuItem* check) +RouteUI::toggle_solo_isolated (Gtk::CheckMenuItem* check) { - _route->set_solo_safe (check->get_active(), this); + _route->set_solo_isolated (check->get_active(), this); } void @@ -1166,16 +1164,17 @@ RouteUI::denormal_protection_changed () /* no signal for this yet */ } - void -RouteUI::solo_safe_toggle(void* src, Gtk::CheckMenuItem* check) +RouteUI::solo_isolated_toggle(void* src, Gtk::CheckMenuItem* check) { - bool yn = _route->solo_safe (); + bool yn = _route->solo_isolated (); if (check->get_active() != yn) { check->set_active (yn); } } + +#ifdef FIX_THIS_FOR_3_0 void RouteUI::pre_fader_toggle(void* src, Gtk::CheckMenuItem* check) { @@ -1219,17 +1218,18 @@ RouteUI::main_outs_toggle(void* src, Gtk::CheckMenuItem* check) check->set_active (yn); } } +#endif void RouteUI::disconnect_input () { - _route->disconnect_inputs (this); + _route->input()->disconnect (this); } void RouteUI::disconnect_output () { - _route->disconnect_outputs (this); + _route->output()->disconnect (this); } bool @@ -1308,7 +1308,7 @@ RouteUI::map_frozen () void RouteUI::adjust_latency () { - LatencyDialog dialog (_route->name() + _("latency"), *(_route.get()), _session.frame_rate(), _session.engine().frames_per_cycle()); + LatencyDialog dialog (_route->name() + _("latency"), *(_route->output()), _session.frame_rate(), _session.engine().frames_per_cycle()); } void diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index de8d7ea30c..fc6ef87f57 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -24,6 +24,7 @@ #include "pbd/xml++.h" #include "ardour/ardour.h" +#include "ardour/mute_master.h" #include "ardour/route.h" #include "ardour/track.h" @@ -125,17 +126,17 @@ class RouteUI : public virtual AxisView void build_remote_control_menu (void); void refresh_remote_control_menu (); - void solo_safe_toggle (void*, Gtk::CheckMenuItem*); - void toggle_solo_safe (Gtk::CheckMenuItem*); + void solo_isolated_toggle (void*, Gtk::CheckMenuItem*); + void toggle_solo_isolated (Gtk::CheckMenuItem*); - void toggle_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*); + void toggle_mute_menu(ARDOUR::MuteMaster::MutePoint, Gtk::CheckMenuItem*); void pre_fader_toggle(void*, Gtk::CheckMenuItem*); void post_fader_toggle(void*, Gtk::CheckMenuItem*); void control_outs_toggle(void*, Gtk::CheckMenuItem*); void main_outs_toggle(void*, Gtk::CheckMenuItem*); void build_mute_menu(void); - void init_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*); + void init_mute_menu(ARDOUR::MuteMaster::MutePoint, Gtk::CheckMenuItem*); void set_mix_group_solo(boost::shared_ptr<ARDOUR::Route>, bool); void set_mix_group_mute(boost::shared_ptr<ARDOUR::Route>, bool); @@ -169,7 +170,6 @@ class RouteUI : public virtual AxisView virtual void update_rec_display (); void update_mute_display (); - bool was_solo_safe; void update_solo_display (); virtual void map_frozen (); diff --git a/gtk2_ardour/send_ui.cc b/gtk2_ardour/send_ui.cc index 672d5f3d20..19baaa7f93 100644 --- a/gtk2_ardour/send_ui.cc +++ b/gtk2_ardour/send_ui.cc @@ -19,6 +19,7 @@ #include <gtkmm2ext/doi.h> +#include "ardour/amp.h" #include "ardour/io.h" #include "ardour/send.h" @@ -38,8 +39,8 @@ SendUI::SendUI (boost::shared_ptr<Send> s, Session& se) , _gpm (se) , _panners (se) { - _panners.set_io (s->io()); - _gpm.set_io (s->io()); + _panners.set_panner (s->panner()); + _gpm.set_controls (boost::shared_ptr<Route>(), s->meter(), s->amp()->gain_control(), s->amp()); _hbox.pack_start (_gpm, true, true); set_name ("SendUIFrame"); @@ -50,7 +51,7 @@ SendUI::SendUI (boost::shared_ptr<Send> s, Session& se) _vbox.pack_start (_hbox, false, false, false); _vbox.pack_start (_panners, false,false); - io = manage (new IOSelector (se, s->io(), true)); + io = manage (new IOSelector (se, s->output())); pack_start (_vbox, false, false); @@ -60,8 +61,8 @@ SendUI::SendUI (boost::shared_ptr<Send> s, Session& se) _send->set_metering (true); - _send->io()->input_changed.connect (mem_fun (*this, &SendUI::ins_changed)); - _send->io()->output_changed.connect (mem_fun (*this, &SendUI::outs_changed)); + _send->input()->changed.connect (mem_fun (*this, &SendUI::ins_changed)); + _send->output()->changed.connect (mem_fun (*this, &SendUI::outs_changed)); _panners.set_width (Wide); _panners.setup_pan (); diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index 76c8a85b88..09138f428e 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -25,12 +25,12 @@ public: void setup_ports (int dim) { - cerr << _session.the_auditioner()->outputs().num_ports() << "\n"; + cerr << _session.the_auditioner()->output()->n_ports() << "\n"; if (dim == OURS) { _port_group->clear (); - _port_group->add_bundle (_session.click_io()->bundle_for_outputs()); - _port_group->add_bundle (_session.the_auditioner()->bundle_for_outputs()); + _port_group->add_bundle (_session.click_io()->bundle()); + _port_group->add_bundle (_session.the_auditioner()->output()->bundle()); } else { _ports[OTHER].gather (_session, true); } @@ -41,7 +41,7 @@ public: Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel); Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel); - if (c[OURS].bundle == _session.click_io()->bundle_for_outputs()) { + if (c[OURS].bundle == _session.click_io()->bundle()) { for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) { for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) { @@ -50,9 +50,9 @@ public: assert (f); if (s) { - _session.click_io()->connect_output (f, *j, 0); + _session.click_io()->connect (f, *j, 0); } else { - _session.click_io()->disconnect_output (f, *j, 0); + _session.click_io()->disconnect (f, *j, 0); } } } @@ -64,7 +64,7 @@ public: Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel); Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel); - if (c[OURS].bundle == _session.click_io()->bundle_for_outputs()) { + if (c[OURS].bundle == _session.click_io()->bundle()) { for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) { for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) { diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 98dd328f55..cc9d09b654 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -39,6 +39,7 @@ #include "evoral/SMF.hpp" +#include "ardour/amp.h" #include "ardour/audio_library.h" #include "ardour/auditioner.h" #include "ardour/audioregion.h" @@ -594,7 +595,10 @@ SoundFileBrowser::add_gain_meter () delete gm; gm = new GainMeter (*session); - gm->set_io (session->the_auditioner()); + + boost::shared_ptr<Route> r = session->the_auditioner (); + + gm->set_controls (r, r->shared_peak_meter(), r->gain_control(), r->amp()); meter_packer.set_border_width (12); meter_packer.pack_start (*gm, false, true); |