From 49445140345fd4e57a833d3803e529c0c07d221c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 15 Jul 2009 00:47:34 +0000 Subject: processor naming tweaks, processor visibility tweaks and more, trying to finish this audio routing thing... git-svn-id: svn://localhost/ardour2/branches/3.0@5364 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/amp.cc | 6 ++ libs/ardour/ardour/amp.h | 2 +- libs/ardour/ardour/delivery.h | 3 +- libs/ardour/ardour/internal_send.h | 3 +- libs/ardour/ardour/meter.h | 2 + libs/ardour/ardour/route.h | 2 +- libs/ardour/ardour/send.h | 6 +- libs/ardour/ardour/session.h | 4 +- libs/ardour/delivery.cc | 4 - libs/ardour/internal_send.cc | 22 ++++- libs/ardour/meter.cc | 6 ++ libs/ardour/route.cc | 189 ++++++++++++++++--------------------- libs/ardour/send.cc | 22 +++-- libs/ardour/session.cc | 18 ++-- 14 files changed, 152 insertions(+), 137 deletions(-) (limited to 'libs') diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index 34ea20addf..9aa88068a9 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -323,3 +323,9 @@ Amp::setup_gain_automation (sframes_t start_frame, sframes_t end_frame, nframes_ _apply_gain_automation = false; } } + +bool +Amp::visible() const +{ + return true; +} diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index 822d7a2d6d..7be324dba1 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -39,7 +39,7 @@ public: std::string display_name() const; - bool visible () const { return false; } + bool visible () const; bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; bool configure_io (ChanCount in, ChanCount out); diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index 1d01acad5f..e46823d075 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -37,7 +37,8 @@ public: Insert = 0x1, Send = 0x2, Listen = 0x4, - Main = 0x8 + Main = 0x8, + Aux = 0x10 }; /* Delivery to an existing output */ diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index ea2ffce3fe..3e89b8aec6 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -28,10 +28,11 @@ namespace ARDOUR { class InternalSend : public Send { public: - InternalSend (Session&, boost::shared_ptr, boost::shared_ptr send_to); + InternalSend (Session&, boost::shared_ptr, boost::shared_ptr send_to, Delivery::Role role); InternalSend (Session&, boost::shared_ptr, const XMLNode&); virtual ~InternalSend (); + std::string display_name() const; bool set_name (const std::string&); bool visible() const; diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index 414b559de0..e1fd97f107 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -53,6 +53,8 @@ public: PeakMeter(Session& s) : Processor(s, "Meter") {} PeakMeter(Session&s, const XMLNode& node); + bool visible() const; + void meter(); void reset (); diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 133ec1eb78..7a44cb454c 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -260,7 +260,7 @@ class Route : public SessionObject, public AutomatableControls sigc::signal SelectedChanged; - int listen_via (boost::shared_ptr, bool); + int listen_via (boost::shared_ptr, Placement p, bool active, bool aux); void drop_listen (boost::shared_ptr); bool feeds (boost::shared_ptr); diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 37d56e2abd..d4b9bca1b3 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -37,12 +37,14 @@ class Amp; class Send : public Delivery { public: - Send (Session&, boost::shared_ptr, bool internal = false); - Send (Session&, boost::shared_ptr, const XMLNode&, bool internal = false); + Send (Session&, boost::shared_ptr, Delivery::Role r = Delivery::Send); + Send (Session&, boost::shared_ptr, const XMLNode&, Delivery::Role r = Delivery::Send); virtual ~Send (); uint32_t bit_slot() const { return _bitslot; } + bool visible() const; + boost::shared_ptr amp() const { return _amp; } boost::shared_ptr meter() const { return _meter; } diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 429d30a5c1..7669883185 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -740,8 +740,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable boost::shared_ptr control_out() const { return _control_out; } boost::shared_ptr master_out() const { return _master_out; } - void globally_add_internal_sends (boost::shared_ptr dest); - void add_internal_sends (boost::shared_ptr dest, boost::shared_ptr senders); + void globally_add_internal_sends (boost::shared_ptr dest, Placement p); + void add_internal_sends (boost::shared_ptr dest, Placement p, boost::shared_ptr senders); static void set_disable_all_loaded_plugins (bool yn) { _disable_all_loaded_plugins = yn; diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 1d86542100..49f4569a1c 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -178,10 +178,6 @@ Delivery::increment_output_offset (nframes_t n) bool Delivery::visible () const { - if (_role & Main) { - return false; - } - return true; } diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index 718e34f29e..540a6869e1 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -33,8 +33,8 @@ using namespace PBD; using namespace ARDOUR; -InternalSend::InternalSend (Session& s, boost::shared_ptr mm, boost::shared_ptr sendto) - : Send (s, mm, true) +InternalSend::InternalSend (Session& s, boost::shared_ptr mm, boost::shared_ptr sendto, Delivery::Role role) + : Send (s, mm, role) , _send_to (sendto) { if ((target = _send_to->get_return_buffer ()) == 0) { @@ -42,12 +42,12 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr mm, boost: } set_name (sendto->name()); - + _send_to->GoingAway.connect (mem_fun (*this, &InternalSend::send_to_going_away)); } InternalSend::InternalSend (Session& s, boost::shared_ptr mm, const XMLNode& node) - : Send (s, mm, node, true) + : Send (s, mm, node, Delivery::Aux /* will be reset in set_state() */) { set_state (node); } @@ -223,8 +223,22 @@ InternalSend::set_name (const std::string& str) return IOProcessor::set_name (str); } +std::string +InternalSend::display_name () const +{ + if (_role == Aux) { + return string_compose (X_("aux-%1"), _name); + } else { + return _name; + } +} + bool InternalSend::visible () const { + if (_role == Aux) { + return true; + } + return false; } diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 7f05cf103d..3bc12f20d6 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -218,3 +218,9 @@ PeakMeter::state (bool full_state) return node; } + +bool +PeakMeter::visible() const +{ + return true; +} diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index af80fd6c89..cc90a855a5 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -619,22 +619,10 @@ Route::add_processor (boost::shared_ptr processor, Placement placemen if (placement == PreFader) { /* generic pre-fader: insert immediately before the amp */ - loc = find(_processors.begin(), _processors.end(), _amp); + loc = find (_processors.begin(), _processors.end(), _amp); } else { - /* generic post-fader: insert at end */ - loc = _processors.end(); - - if (processor->visible() && !_processors.empty()) { - /* check for invisible processors stacked at the end and leave them there */ - ProcessorList::iterator p; - p = _processors.end(); - --p; - while (!(*p)->visible() && p != _processors.begin()) { - --p; - } - ++p; - loc = p; - } + /* generic post-fader: insert right before the main outs */ + loc = find (_processors.begin(), _processors.end(), _main_outs); } return add_processor (processor, loc, err); @@ -725,129 +713,116 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter { const XMLProperty *prop; - // legacy sessions use a different node name for sends - if (node.name() == "Send") { - - try { - boost::shared_ptr send (new Send (_session, _mute_master, node)); - add_processor (send, iter); - return true; - } - - catch (failed_constructor &err) { - error << _("Send construction failed") << endmsg; - return false; - } - - } else if (node.name() == "Processor") { + if (node.name() != "Processor") { + return false; + } - try { - if ((prop = node.property ("type")) != 0) { - - boost::shared_ptr processor; + try { + if ((prop = node.property ("type")) != 0) { + + boost::shared_ptr processor; - if (prop->value() == "ladspa" || prop->value() == "Ladspa" || - prop->value() == "lv2" || - prop->value() == "vst" || - prop->value() == "audiounit") { + if (prop->value() == "ladspa" || prop->value() == "Ladspa" || + prop->value() == "lv2" || + prop->value() == "vst" || + prop->value() == "audiounit") { - processor.reset (new PluginInsert(_session, node)); + processor.reset (new PluginInsert(_session, node)); - } else if (prop->value() == "port") { + } else if (prop->value() == "port") { - processor.reset (new PortInsert (_session, _mute_master, node)); + processor.reset (new PortInsert (_session, _mute_master, node)); - } else if (prop->value() == "send") { + } else if (prop->value() == "send") { - processor.reset (new Send (_session, _mute_master, node)); + processor.reset (new Send (_session, _mute_master, node)); - } else if (prop->value() == "meter") { + } else if (prop->value() == "meter") { - if (_meter) { - if (_meter->set_state (node)) { - return false; - } else { - return true; - } + if (_meter) { + if (_meter->set_state (node)) { + return false; + } else { + return true; } + } - _meter.reset (new PeakMeter (_session, node)); - processor = _meter; + _meter.reset (new PeakMeter (_session, node)); + processor = _meter; - } else if (prop->value() == "amp") { + } else if (prop->value() == "amp") { - /* amp always exists */ + /* amp always exists */ - processor = _amp; - if (processor->set_state (node)) { - return false; - } else { - /* never any reason to add it */ - return true; - } + processor = _amp; + if (processor->set_state (node)) { + return false; + } else { + /* never any reason to add it */ + return true; + } - } else if (prop->value() == "listen" || prop->value() == "deliver") { + } else if (prop->value() == "listen" || prop->value() == "deliver") { - /* XXX need to generalize */ + /* XXX need to generalize */ - } else if (prop->value() == "intsend") { + } else if (prop->value() == "intsend") { - processor.reset (new InternalSend (_session, _mute_master, node)); + processor.reset (new InternalSend (_session, _mute_master, node)); - } else if (prop->value() == "intreturn") { + } else if (prop->value() == "intreturn") { - if (_intreturn) { - if (_intreturn->set_state (node)) { - return false; - } else { - return true; - } + if (_intreturn) { + if (_intreturn->set_state (node)) { + return false; + } else { + return true; } - _intreturn.reset (new InternalReturn (_session, node)); - processor = _intreturn; + } + _intreturn.reset (new InternalReturn (_session, node)); + processor = _intreturn; - } else if (prop->value() == "main-outs") { + } else if (prop->value() == "main-outs") { - if (_main_outs) { - if (_main_outs->set_state (node)) { - return false; - } else { - return true; - } + if (_main_outs) { + if (_main_outs->set_state (node)) { + return false; + } else { + return true; } + } - _main_outs.reset (new Delivery (_session, _output, _mute_master, node)); - processor = _main_outs; + _main_outs.reset (new Delivery (_session, _output, _mute_master, node)); + processor = _main_outs; - } else { - error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg; - } + } else { + error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg; + } - if (iter == _processors.end() && processor->visible() && !_processors.empty()) { - /* check for invisible processors stacked at the end and leave them there */ - ProcessorList::iterator p; - p = _processors.end(); + if (iter == _processors.end() && processor->visible() && !_processors.empty()) { + /* check for invisible processors stacked at the end and leave them there */ + ProcessorList::iterator p; + p = _processors.end(); + --p; + while (!(*p)->visible() && p != _processors.begin()) { --p; - while (!(*p)->visible() && p != _processors.begin()) { - --p; - } - ++p; - iter = p; } - - return (add_processor (processor, iter) == 0); - - } else { - error << _("Processor XML node has no type property") << endmsg; + ++p; + iter = p; } - } - catch (failed_constructor &err) { - warning << _("processor could not be created. Ignored.") << endmsg; + return (add_processor (processor, iter) == 0); + + } else { + error << _("Processor XML node has no type property") << endmsg; return false; } } - return false; + + catch (failed_constructor &err) { + warning << _("processor could not be created. Ignored.") << endmsg; + return false; + } } int @@ -1885,7 +1860,7 @@ Route::release_return_buffer () const } int -Route::listen_via (boost::shared_ptr route, bool active) +Route::listen_via (boost::shared_ptr route, Placement placement, bool active, bool aux) { vector ports; vector::const_iterator i; @@ -1917,7 +1892,7 @@ Route::listen_via (boost::shared_ptr route, bool active) boost::shared_ptr listener; try { - listener.reset (new InternalSend (_session, _mute_master, route)); + listener.reset (new InternalSend (_session, _mute_master, route, (aux ? Delivery::Aux : Delivery::Listen))); } catch (failed_constructor& err) { return -1; @@ -1927,7 +1902,7 @@ Route::listen_via (boost::shared_ptr route, bool active) _control_outs = listener; } - add_processor (listener, (Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader)); + add_processor (listener, placement); return 0; } diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index df6b87a686..3d44070e68 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -36,9 +36,8 @@ using namespace ARDOUR; using namespace PBD; -Send::Send (Session& s, boost::shared_ptr mm, bool internal) - : Delivery (s, mm, string_compose (_("send %1"), (_bitslot = s.next_send_id()) + 1), - (internal ? Delivery::Listen : Delivery::Send)) +Send::Send (Session& s, boost::shared_ptr mm, Role r) + : Delivery (s, mm, string_compose (_("send %1"), (_bitslot = s.next_send_id()) + 1), r) , _metering (false) { _amp.reset (new Amp (_session, _mute_master)); @@ -47,8 +46,8 @@ Send::Send (Session& s, boost::shared_ptr mm, bool internal) ProcessorCreated (this); /* EMIT SIGNAL */ } -Send::Send (Session& s, boost::shared_ptr mm, const XMLNode& node, bool internal) - : Delivery (s, mm, "send", (internal ? Delivery::Listen : Delivery::Send)) +Send::Send (Session& s, boost::shared_ptr mm, const XMLNode& node, Role r) + : Delivery (s, mm, "send", r) , _metering (false) { _amp.reset (new Amp (_session, _mute_master)); @@ -184,6 +183,7 @@ Send::make_unique (XMLNode &state, Session &session) state.property("name")->set_value (name); XMLNode* io = state.child ("IO"); + if (io) { io->property("name")->set_value (name); } @@ -194,7 +194,7 @@ Send::set_name (const std::string& new_name) { std::string unique_name; - if (_role != Listen) { + if (_role == Delivery::Send) { char buf[32]; snprintf (buf, sizeof (buf), "%u", _bitslot); unique_name = new_name; @@ -205,3 +205,13 @@ Send::set_name (const std::string& new_name) return Delivery::set_name (unique_name); } + +bool +Send::visible () const +{ + if (_role == Listen) { + return false; + } + + return true; +} diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 7abbcb49d1..b1d33e948c 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -820,7 +820,9 @@ Session::hookup_io () continue; } - (*x)->listen_via (_control_out, false); + (*x)->listen_via (_control_out, + (Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader), + false, false); } } @@ -2147,8 +2149,9 @@ Session::add_routes (RouteList& new_routes, bool save) if ((*x)->is_control() || (*x)->is_master()) { continue; } - cerr << "Add listen via control outs\n"; - (*x)->listen_via (_control_out, false); + (*x)->listen_via (_control_out, + (Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader), + false, false); } resort_routes (); @@ -2164,7 +2167,7 @@ Session::add_routes (RouteList& new_routes, bool save) } void -Session::globally_add_internal_sends (boost::shared_ptr dest) +Session::globally_add_internal_sends (boost::shared_ptr dest, Placement p) { boost::shared_ptr r = routes.reader (); boost::shared_ptr t (new RouteList); @@ -2177,11 +2180,11 @@ Session::globally_add_internal_sends (boost::shared_ptr dest) } } - add_internal_sends (dest, t); + add_internal_sends (dest, p, t); } void -Session::add_internal_sends (boost::shared_ptr dest, boost::shared_ptr senders) +Session::add_internal_sends (boost::shared_ptr dest, Placement p, boost::shared_ptr senders) { if (dest->is_control() || dest->is_master()) { return; @@ -2197,8 +2200,7 @@ Session::add_internal_sends (boost::shared_ptr dest, boost::shared_ptrname() << " listening via " << dest->name() << endl; - (*i)->listen_via (dest, true); + (*i)->listen_via (dest, p, true, true); } } -- cgit v1.2.3