mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
use temporary sends for sidechain inputs
This commit is contained in:
parent
8f14f422e0
commit
8fc19d6c67
4 changed files with 133 additions and 33 deletions
|
|
@ -350,6 +350,8 @@
|
||||||
<ColorAlias name="processor prefader: led active" alias="color 37"/>
|
<ColorAlias name="processor prefader: led active" alias="color 37"/>
|
||||||
<ColorAlias name="processor stub: fill" alias="color 46"/>
|
<ColorAlias name="processor stub: fill" alias="color 46"/>
|
||||||
<ColorAlias name="processor stub: fill active" alias="color 46"/>
|
<ColorAlias name="processor stub: fill active" alias="color 46"/>
|
||||||
|
<ColorAlias name="processor sidechain: fill" alias="color 68"/>
|
||||||
|
<ColorAlias name="processor sidechain: led active" alias="color 37"/>
|
||||||
<ColorAlias name="pinrouting custom: led active" alias="color 86"/>
|
<ColorAlias name="pinrouting custom: led active" alias="color 86"/>
|
||||||
<ColorAlias name="pinrouting sidechain: led active" alias="color 50"/>
|
<ColorAlias name="pinrouting sidechain: led active" alias="color 50"/>
|
||||||
<ColorAlias name="punch button: fill" alias="color 20"/>
|
<ColorAlias name="punch button: fill" alias="color 20"/>
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,13 @@
|
||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
#include "gtkmm2ext/rgb_macros.h"
|
#include "gtkmm2ext/rgb_macros.h"
|
||||||
|
|
||||||
|
#include "ardour/amp.h"
|
||||||
#include "ardour/audioengine.h"
|
#include "ardour/audioengine.h"
|
||||||
|
#include "ardour/pannable.h"
|
||||||
#include "ardour/plugin.h"
|
#include "ardour/plugin.h"
|
||||||
#include "ardour/port.h"
|
#include "ardour/port.h"
|
||||||
#include "ardour/profile.h"
|
#include "ardour/profile.h"
|
||||||
|
#include "ardour/send.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
|
|
||||||
#include "plugin_pin_dialog.h"
|
#include "plugin_pin_dialog.h"
|
||||||
|
|
@ -493,47 +496,74 @@ PluginPinDialog::refill_output_presets ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
PluginPinDialog::port_label (const std::string& portname, bool strip)
|
||||||
|
{
|
||||||
|
// compare to MixerStrip::update_io_button()
|
||||||
|
string lpn (PROGRAM_NAME);
|
||||||
|
boost::to_lower (lpn);
|
||||||
|
std::string program_port_prefix = lpn + ":"; // e.g. "ardour:"
|
||||||
|
|
||||||
|
std::string label (portname);
|
||||||
|
if (label.find ("system:capture_") == 0) {
|
||||||
|
label = AudioEngine::instance ()->get_pretty_name_by_name (label);
|
||||||
|
if (label.empty ()) {
|
||||||
|
label = portname.substr (15);
|
||||||
|
}
|
||||||
|
} else if (label.find ("system:midi_capture_") == 0) {
|
||||||
|
label = AudioEngine::instance ()->get_pretty_name_by_name (label);
|
||||||
|
if (label.empty ()) {
|
||||||
|
// "system:midi_capture_123" -> "123"
|
||||||
|
label = "M " + portname.substr (20);
|
||||||
|
}
|
||||||
|
} else if (label.find (program_port_prefix) == 0) {
|
||||||
|
label = label.substr (program_port_prefix.size ());
|
||||||
|
if (strip) {
|
||||||
|
string::size_type slash = label.find ("/");
|
||||||
|
if (slash != string::npos) {
|
||||||
|
label = label.substr (0, slash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
PluginPinDialog::add_port_to_table (boost::shared_ptr<Port> p, uint32_t r, bool can_remove)
|
PluginPinDialog::add_port_to_table (boost::shared_ptr<Port> p, uint32_t r, bool can_remove)
|
||||||
{
|
{
|
||||||
std::string lbl;
|
std::string lbl;
|
||||||
std::string tip = p->name ();
|
std::string tip = p->name ();
|
||||||
std::vector<std::string> cns;
|
std::vector<std::string> cns;
|
||||||
|
bool single_source = true;
|
||||||
p->get_connections (cns);
|
p->get_connections (cns);
|
||||||
|
|
||||||
// TODO proper labels, see MixerStrip::update_io_button()
|
for (std::vector<std::string>::const_iterator i = cns.begin (); i != cns.end (); ++i) {
|
||||||
|
if (lbl.empty ()) {
|
||||||
|
lbl = port_label (*i, true);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (port_label (*i, true) != lbl) {
|
||||||
|
lbl = "...";
|
||||||
|
single_source = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cns.size () == 0) {
|
if (cns.size () == 0) {
|
||||||
lbl = "-";
|
lbl = "-";
|
||||||
} else if (cns.size () > 1) {
|
single_source = false;
|
||||||
lbl = "...";
|
} else if (cns.size () == 1) {
|
||||||
tip += " <- ";
|
tip += " <- ";
|
||||||
|
lbl = port_label (cns[0], false);
|
||||||
} else {
|
} else {
|
||||||
string lpn (PROGRAM_NAME);
|
|
||||||
boost::to_lower (lpn);
|
|
||||||
std::string program_port_prefix = lpn + ":"; // e.g. "ardour:"
|
|
||||||
|
|
||||||
lbl = cns[0];
|
|
||||||
tip += " <- ";
|
tip += " <- ";
|
||||||
if (lbl.find ("system:capture_") == 0) {
|
|
||||||
lbl = AudioEngine::instance ()->get_pretty_name_by_name (lbl);
|
|
||||||
if (lbl.empty ()) {
|
|
||||||
lbl = cns[0].substr (15);
|
|
||||||
}
|
|
||||||
} else if (lbl.find ("system:midi_capture_") == 0) {
|
|
||||||
lbl = AudioEngine::instance ()->get_pretty_name_by_name (lbl);
|
|
||||||
if (lbl.empty ()) {
|
|
||||||
// "system:midi_capture_123" -> "123"
|
|
||||||
lbl = "M " + cns[0].substr (20);
|
|
||||||
}
|
|
||||||
} else if (lbl.find (program_port_prefix) == 0) {
|
|
||||||
lbl = lbl.substr (program_port_prefix.size ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
replace_all (lbl, "_", " ");
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator i = cns.begin (); i != cns.end (); ++i) {
|
for (std::vector<std::string>::const_iterator i = cns.begin (); i != cns.end (); ++i) {
|
||||||
tip += *i;
|
tip += *i;
|
||||||
tip += " ";
|
tip += " ";
|
||||||
}
|
}
|
||||||
replace_all (lbl, "_", " ");
|
|
||||||
|
|
||||||
ArdourButton *pb = manage (new ArdourButton (lbl));
|
ArdourButton *pb = manage (new ArdourButton (lbl));
|
||||||
pb->set_text_ellipsize (Pango::ELLIPSIZE_MIDDLE);
|
pb->set_text_ellipsize (Pango::ELLIPSIZE_MIDDLE);
|
||||||
|
|
@ -554,7 +584,7 @@ PluginPinDialog::add_port_to_table (boost::shared_ptr<Port> p, uint32_t r, bool
|
||||||
|
|
||||||
uint32_t rv = 1;
|
uint32_t rv = 1;
|
||||||
|
|
||||||
if (cns.size () == 1 && _session) {
|
if (single_source && _session) {
|
||||||
/* check if it's an Ardour Send feeding.. */
|
/* check if it's an Ardour Send feeding.. */
|
||||||
boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
|
boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
|
||||||
for (ARDOUR::RouteList::const_iterator i = routes->begin (); i != routes->end (); ++i) {
|
for (ARDOUR::RouteList::const_iterator i = routes->begin (); i != routes->end (); ++i) {
|
||||||
|
|
@ -1598,6 +1628,44 @@ PluginPinDialog::connect_port (boost::weak_ptr<ARDOUR::Port> wp0, boost::weak_pt
|
||||||
p0->connect (p1->name ());
|
p0->connect (p1->name ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginPinDialog::add_send_from (boost::weak_ptr<ARDOUR::Port> wp, boost::weak_ptr<ARDOUR::Route> wr)
|
||||||
|
{
|
||||||
|
if (_session && _session->actively_recording ()) { return; }
|
||||||
|
boost::shared_ptr<Port> p = wp.lock ();
|
||||||
|
boost::shared_ptr<Route> r = wr.lock ();
|
||||||
|
boost::shared_ptr<IO> io = _pi->sidechain_input ();
|
||||||
|
if (!p || !r || !io || !_session) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<Pannable> sendpan (new Pannable (*_session));
|
||||||
|
boost::shared_ptr<Send> send (new Send (*_session, sendpan, r->mute_master ()));
|
||||||
|
const ChanCount& outs (r->amp ()->input_streams ());
|
||||||
|
try {
|
||||||
|
Glib::Threads::Mutex::Lock lm (AudioEngine::instance ()->process_lock ());
|
||||||
|
send->output()->ensure_io (outs, false, this);
|
||||||
|
} catch (AudioEngine::PortRegistrationFailure& err) {
|
||||||
|
error << string_compose (_("Cannot set up new send: %1"), err.what ()) << endmsg;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ignore_updates = true;
|
||||||
|
|
||||||
|
p->disconnect_all ();
|
||||||
|
|
||||||
|
DataType dt = p->type ();
|
||||||
|
PortSet& ps (send->output ()->ports ());
|
||||||
|
for (PortSet::iterator i = ps.begin (dt); i != ps.end (dt); ++i) {
|
||||||
|
p->connect (&(**i));
|
||||||
|
}
|
||||||
|
|
||||||
|
send->set_remove_on_disconnect (true);
|
||||||
|
r->add_processor (send, PreFader);
|
||||||
|
_ignore_updates = false;
|
||||||
|
queue_idle_update ();
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PluginPinDialog::sc_input_release (GdkEventButton *ev)
|
PluginPinDialog::sc_input_release (GdkEventButton *ev)
|
||||||
{
|
{
|
||||||
|
|
@ -1673,20 +1741,40 @@ PluginPinDialog::maybe_add_route_to_input_menu (boost::shared_ptr<Route> r, Data
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuList& citems = input_menu.items ();
|
MenuList& citems = input_menu.items ();
|
||||||
const IOVector& iov (r->all_outputs ());
|
|
||||||
|
|
||||||
for (IOVector::const_iterator o = iov.begin (); o != iov.end (); ++o) {
|
/*check if there's already a send.. */
|
||||||
boost::shared_ptr<IO> op = o->lock ();
|
bool already_present = false;
|
||||||
if (!op) {
|
uint32_t nth = 0;
|
||||||
|
boost::shared_ptr<Processor> proc;
|
||||||
|
/* Note: nth_send () takes a processor read-lock */
|
||||||
|
while ((proc = r->nth_send (nth))) {
|
||||||
|
boost::shared_ptr<IOProcessor> send = boost::dynamic_pointer_cast<IOProcessor> (proc);
|
||||||
|
if (!send || !send->output ()) {
|
||||||
|
++nth;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PortSet& p (op->ports ());
|
if (send->output ()->connected_to (_pi->sidechain_input ())) {
|
||||||
|
// only if (send->remove_on_disconnect ()) ??
|
||||||
|
already_present = true;
|
||||||
|
++nth;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#if 1 // add existing sends that are not connected
|
||||||
|
PortSet& p (send->output ()->ports ());
|
||||||
for (PortSet::iterator i = p.begin (dt); i != p.end (dt); ++i) {
|
for (PortSet::iterator i = p.begin (dt); i != p.end (dt); ++i) {
|
||||||
std::string n = i->name ();
|
std::string n = i->name ();
|
||||||
replace_all (n, "_", " ");
|
replace_all (n, "_", " ");
|
||||||
citems.push_back (MenuElem (n, sigc::bind (sigc::mem_fun (*this, &PluginPinDialog::connect_port), wp, boost::weak_ptr<Port> (*i))));
|
citems.push_back (MenuElem (n, sigc::bind (sigc::mem_fun (*this, &PluginPinDialog::connect_port), wp, boost::weak_ptr<Port> (*i))));
|
||||||
++added;
|
++added;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
++nth;
|
||||||
|
}
|
||||||
|
/* we're going to create the new send pre-fader, so check the route amp's data type. */
|
||||||
|
const ChanCount& rc (r->amp ()->input_streams ());
|
||||||
|
if (!already_present && rc.get (dt) > 0) {
|
||||||
|
citems.push_back (MenuElem (r->name (), sigc::bind (sigc::mem_fun (*this, &PluginPinDialog::add_send_from), wp, boost::weak_ptr<Route> (r))));
|
||||||
|
++added;
|
||||||
}
|
}
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,9 @@ private:
|
||||||
void draw_connection (cairo_t*, double, double, double, double, bool, bool, bool dashed = false);
|
void draw_connection (cairo_t*, double, double, double, double, bool, bool, bool dashed = false);
|
||||||
void draw_connection (cairo_t*, const CtrlWidget&, const CtrlWidget&, bool dashed = false);
|
void draw_connection (cairo_t*, const CtrlWidget&, const CtrlWidget&, bool dashed = false);
|
||||||
const CtrlWidget& get_io_ctrl (CtrlType ct, ARDOUR::DataType dt, uint32_t id, uint32_t ip = 0) const;
|
const CtrlWidget& get_io_ctrl (CtrlType ct, ARDOUR::DataType dt, uint32_t id, uint32_t ip = 0) const;
|
||||||
|
|
||||||
static void edge_coordinates (const CtrlWidget& w, double &x, double &y);
|
static void edge_coordinates (const CtrlWidget& w, double &x, double &y);
|
||||||
|
static std::string port_label (const std::string&, bool);
|
||||||
|
|
||||||
void reset_mapping ();
|
void reset_mapping ();
|
||||||
void reset_configuration ();
|
void reset_configuration ();
|
||||||
|
|
@ -145,6 +147,7 @@ private:
|
||||||
void remove_port (boost::weak_ptr<ARDOUR::Port>);
|
void remove_port (boost::weak_ptr<ARDOUR::Port>);
|
||||||
void disconnect_port (boost::weak_ptr<ARDOUR::Port>);
|
void disconnect_port (boost::weak_ptr<ARDOUR::Port>);
|
||||||
void connect_port (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
|
void connect_port (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
|
||||||
|
void add_send_from (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Route>);
|
||||||
uint32_t add_port_to_table (boost::shared_ptr<ARDOUR::Port>, uint32_t, bool);
|
uint32_t add_port_to_table (boost::shared_ptr<ARDOUR::Port>, uint32_t, bool);
|
||||||
uint32_t maybe_add_route_to_input_menu (boost::shared_ptr<ARDOUR::Route>, ARDOUR::DataType, boost::weak_ptr<ARDOUR::Port>);
|
uint32_t maybe_add_route_to_input_menu (boost::shared_ptr<ARDOUR::Route>, ARDOUR::DataType, boost::weak_ptr<ARDOUR::Port>);
|
||||||
void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
|
void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
|
||||||
|
|
|
||||||
|
|
@ -381,6 +381,13 @@ ProcessorEntry::setup_visuals ()
|
||||||
_button.set_name ("processor stub");
|
_button.set_name ("processor stub");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
boost::shared_ptr<Send> send;
|
||||||
|
if ((send = boost::dynamic_pointer_cast<Send> (_processor))) {
|
||||||
|
if (send->remove_on_disconnect ()) {
|
||||||
|
_button.set_name ("processor sidechain");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (_position) {
|
switch (_position) {
|
||||||
case PreFader:
|
case PreFader:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue