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
This commit is contained in:
Paul Davis 2009-07-15 00:47:34 +00:00
parent f01af9836e
commit 4944514034
17 changed files with 172 additions and 156 deletions

View File

@ -46,6 +46,7 @@
#include "ardour/audio_diskstream.h"
#include "ardour/audio_track.h"
#include "ardour/audioengine.h"
#include "ardour/internal_send.h"
#include "ardour/ladspa_plugin.h"
#include "ardour/meter.h"
#include "ardour/plugin_insert.h"
@ -768,11 +769,9 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
return;
}
#if 0
if (processor == _route->amp() || !processor->visible()) {
if (!processor->visible()) {
return;
}
#endif
Gtk::TreeModel::Row row = *(model->append());
row[columns.text] = processor_name (processor);
@ -804,7 +803,8 @@ ProcessorBox::processor_name (boost::weak_ptr<Processor> weak_processor)
name_display = " (";
}
if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0 &&
!boost::dynamic_pointer_cast<InternalSend>(processor)) {
name_display += '>';

View File

@ -526,7 +526,8 @@ RouteUI::build_sends_menu ()
sends_menu->set_name ("ArdourContextMenu");
MenuList& items = sends_menu->items();
items.push_back (MenuElem(_("Assign all tracks"), mem_fun (*this, &RouteUI::create_sends)));
items.push_back (MenuElem(_("Assign all tracks (prefader)"), bind (mem_fun (*this, &RouteUI::create_sends), PreFader)));
items.push_back (MenuElem(_("Assign all tracks (postfader)"), bind (mem_fun (*this, &RouteUI::create_sends), PostFader)));
items.push_back (MenuElem(_("Copy track gains to sends"), mem_fun (*this, &RouteUI::set_sends_gain_from_track)));
items.push_back (MenuElem(_("Set sends gain to -inf"), mem_fun (*this, &RouteUI::set_sends_gain_to_zero)));
items.push_back (MenuElem(_("Set sends gain to 0dB"), mem_fun (*this, &RouteUI::set_sends_gain_to_unity)));
@ -534,9 +535,9 @@ RouteUI::build_sends_menu ()
}
void
RouteUI::create_sends ()
RouteUI::create_sends (Placement p)
{
_session.globally_add_internal_sends (_route);
_session.globally_add_internal_sends (_route, p);
}
void

View File

@ -123,7 +123,7 @@ class RouteUI : public virtual AxisView
void set_sends_gain_from_track ();
void set_sends_gain_to_zero ();
void set_sends_gain_to_unity ();
void create_sends ();
void create_sends (ARDOUR::Placement);
void solo_changed(void*);
void solo_changed_so_update_mute ();

View File

@ -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;
}

View File

@ -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);

View File

@ -37,7 +37,8 @@ public:
Insert = 0x1,
Send = 0x2,
Listen = 0x4,
Main = 0x8
Main = 0x8,
Aux = 0x10
};
/* Delivery to an existing output */

View File

@ -28,10 +28,11 @@ namespace ARDOUR {
class InternalSend : public Send
{
public:
InternalSend (Session&, boost::shared_ptr<MuteMaster>, boost::shared_ptr<Route> send_to);
InternalSend (Session&, boost::shared_ptr<MuteMaster>, boost::shared_ptr<Route> send_to, Delivery::Role role);
InternalSend (Session&, boost::shared_ptr<MuteMaster>, const XMLNode&);
virtual ~InternalSend ();
std::string display_name() const;
bool set_name (const std::string&);
bool visible() const;

View File

@ -53,6 +53,8 @@ public:
PeakMeter(Session& s) : Processor(s, "Meter") {}
PeakMeter(Session&s, const XMLNode& node);
bool visible() const;
void meter();
void reset ();

View File

@ -260,7 +260,7 @@ class Route : public SessionObject, public AutomatableControls
sigc::signal<void,void*> SelectedChanged;
int listen_via (boost::shared_ptr<Route>, bool);
int listen_via (boost::shared_ptr<Route>, Placement p, bool active, bool aux);
void drop_listen (boost::shared_ptr<Route>);
bool feeds (boost::shared_ptr<Route>);

View File

@ -37,12 +37,14 @@ class Amp;
class Send : public Delivery
{
public:
Send (Session&, boost::shared_ptr<MuteMaster>, bool internal = false);
Send (Session&, boost::shared_ptr<MuteMaster>, const XMLNode&, bool internal = false);
Send (Session&, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send);
Send (Session&, boost::shared_ptr<MuteMaster>, const XMLNode&, Delivery::Role r = Delivery::Send);
virtual ~Send ();
uint32_t bit_slot() const { return _bitslot; }
bool visible() const;
boost::shared_ptr<Amp> amp() const { return _amp; }
boost::shared_ptr<PeakMeter> meter() const { return _meter; }

View File

@ -740,8 +740,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
boost::shared_ptr<Route> control_out() const { return _control_out; }
boost::shared_ptr<Route> master_out() const { return _master_out; }
void globally_add_internal_sends (boost::shared_ptr<Route> dest);
void add_internal_sends (boost::shared_ptr<Route> dest, boost::shared_ptr<RouteList> senders);
void globally_add_internal_sends (boost::shared_ptr<Route> dest, Placement p);
void add_internal_sends (boost::shared_ptr<Route> dest, Placement p, boost::shared_ptr<RouteList> senders);
static void set_disable_all_loaded_plugins (bool yn) {
_disable_all_loaded_plugins = yn;

View File

@ -178,10 +178,6 @@ Delivery::increment_output_offset (nframes_t n)
bool
Delivery::visible () const
{
if (_role & Main) {
return false;
}
return true;
}

View File

@ -33,8 +33,8 @@
using namespace PBD;
using namespace ARDOUR;
InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost::shared_ptr<Route> sendto)
: Send (s, mm, true)
InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost::shared_ptr<Route> 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<MuteMaster> 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<MuteMaster> 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;
}

View File

@ -218,3 +218,9 @@ PeakMeter::state (bool full_state)
return node;
}
bool
PeakMeter::visible() const
{
return true;
}

View File

@ -619,22 +619,10 @@ Route::add_processor (boost::shared_ptr<Processor> 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> send (new Send (_session, _mute_master, node));
add_processor (send, iter);
return true;
}
if (node.name() != "Processor") {
return false;
}
catch (failed_constructor &err) {
error << _("Send construction failed") << endmsg;
return false;
}
} else if (node.name() == "Processor") {
try {
if ((prop = node.property ("type")) != 0) {
try {
if ((prop = node.property ("type")) != 0) {
boost::shared_ptr<Processor> processor;
boost::shared_ptr<Processor> 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;
}
}
_meter.reset (new PeakMeter (_session, node));
processor = _meter;
} else if (prop->value() == "amp") {
/* amp always exists */
processor = _amp;
if (processor->set_state (node)) {
if (_meter) {
if (_meter->set_state (node)) {
return false;
} else {
/* never any reason to add it */
return true;
}
}
_meter.reset (new PeakMeter (_session, node));
processor = _meter;
} else if (prop->value() == "amp") {
/* amp always exists */
} else if (prop->value() == "listen" || prop->value() == "deliver") {
/* XXX need to generalize */
} else if (prop->value() == "intsend") {
processor.reset (new InternalSend (_session, _mute_master, node));
} else if (prop->value() == "intreturn") {
if (_intreturn) {
if (_intreturn->set_state (node)) {
return false;
} else {
return true;
}
}
_intreturn.reset (new InternalReturn (_session, node));
processor = _intreturn;
} else if (prop->value() == "main-outs") {
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;
processor = _amp;
if (processor->set_state (node)) {
return false;
} else {
error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg;
/* never any reason to add it */
return true;
}
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;
} else if (prop->value() == "listen" || prop->value() == "deliver") {
/* XXX need to generalize */
} else if (prop->value() == "intsend") {
processor.reset (new InternalSend (_session, _mute_master, node));
} else if (prop->value() == "intreturn") {
if (_intreturn) {
if (_intreturn->set_state (node)) {
return false;
} else {
return true;
}
}
_intreturn.reset (new InternalReturn (_session, node));
processor = _intreturn;
} else if (prop->value() == "main-outs") {
if (_main_outs) {
if (_main_outs->set_state (node)) {
return false;
} else {
return true;
}
++p;
iter = p;
}
return (add_processor (processor, iter) == 0);
} else {
error << _("Processor XML node has no type property") << endmsg;
}
}
_main_outs.reset (new Delivery (_session, _output, _mute_master, node));
processor = _main_outs;
catch (failed_constructor &err) {
warning << _("processor could not be created. Ignored.") << 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();
--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;
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> route, bool active)
Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool active, bool aux)
{
vector<string> ports;
vector<string>::const_iterator i;
@ -1917,7 +1892,7 @@ Route::listen_via (boost::shared_ptr<Route> route, bool active)
boost::shared_ptr<InternalSend> 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> route, bool active)
_control_outs = listener;
}
add_processor (listener, (Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader));
add_processor (listener, placement);
return 0;
}

View File

@ -36,9 +36,8 @@
using namespace ARDOUR;
using namespace PBD;
Send::Send (Session& s, boost::shared_ptr<MuteMaster> 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<MuteMaster> 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<MuteMaster> mm, bool internal)
ProcessorCreated (this); /* EMIT SIGNAL */
}
Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, bool internal)
: Delivery (s, mm, "send", (internal ? Delivery::Listen : Delivery::Send))
Send::Send (Session& s, boost::shared_ptr<MuteMaster> 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;
}

View File

@ -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<Route> dest)
Session::globally_add_internal_sends (boost::shared_ptr<Route> dest, Placement p)
{
boost::shared_ptr<RouteList> r = routes.reader ();
boost::shared_ptr<RouteList> t (new RouteList);
@ -2177,11 +2180,11 @@ Session::globally_add_internal_sends (boost::shared_ptr<Route> dest)
}
}
add_internal_sends (dest, t);
add_internal_sends (dest, p, t);
}
void
Session::add_internal_sends (boost::shared_ptr<Route> dest, boost::shared_ptr<RouteList> senders)
Session::add_internal_sends (boost::shared_ptr<Route> dest, Placement p, boost::shared_ptr<RouteList> senders)
{
if (dest->is_control() || dest->is_master()) {
return;
@ -2197,8 +2200,7 @@ Session::add_internal_sends (boost::shared_ptr<Route> dest, boost::shared_ptr<Ro
continue;
}
cerr << (*i)->name() << " listening via " << dest->name() << endl;
(*i)->listen_via (dest, true);
(*i)->listen_via (dest, p, true, true);
}
}