mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
Allow ardour to manipulate connections between two JACK ports that don't belong to us.
git-svn-id: svn://localhost/ardour2/branches/3.0@6100 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
ce8bd8948e
commit
95e4f7558b
5 changed files with 36 additions and 37 deletions
|
|
@ -69,9 +69,14 @@ GlobalPortMatrix::set_state (ARDOUR::BundleChannel c[2], bool s)
|
||||||
} else {
|
} else {
|
||||||
q->disconnect (*i);
|
q->disconnect (*i);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* two non-Ardour ports */
|
||||||
|
if (s) {
|
||||||
|
jack_connect (_session.engine().jack (), j->c_str(), i->c_str());
|
||||||
|
} else {
|
||||||
|
jack_disconnect (_session.engine().jack (), j->c_str(), i->c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we don't handle connections between two non-Ardour ports */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +89,7 @@ GlobalPortMatrix::get_state (ARDOUR::BundleChannel c[2]) const
|
||||||
if (in_ports.empty() || out_ports.empty()) {
|
if (in_ports.empty() || out_ports.empty()) {
|
||||||
/* we're looking at a bundle with no parts associated with this channel,
|
/* we're looking at a bundle with no parts associated with this channel,
|
||||||
so nothing to connect */
|
so nothing to connect */
|
||||||
return PortMatrixNode::UNKNOWN;
|
return PortMatrixNode::NOT_ASSOCIATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ARDOUR::Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
|
for (ARDOUR::Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
|
||||||
|
|
@ -93,9 +98,31 @@ GlobalPortMatrix::get_state (ARDOUR::BundleChannel c[2]) const
|
||||||
ARDOUR::Port* p = _session.engine().get_port_by_name (*i);
|
ARDOUR::Port* p = _session.engine().get_port_by_name (*i);
|
||||||
ARDOUR::Port* q = _session.engine().get_port_by_name (*j);
|
ARDOUR::Port* q = _session.engine().get_port_by_name (*j);
|
||||||
|
|
||||||
/* we don't know the state of connections between two non-Ardour ports */
|
|
||||||
if (!p && !q) {
|
if (!p && !q) {
|
||||||
return PortMatrixNode::UNKNOWN;
|
/* two non-Ardour ports; things are slightly more involved */
|
||||||
|
/* XXX: is this the easiest way to do this? */
|
||||||
|
/* XXX: isn't this very inefficient? */
|
||||||
|
|
||||||
|
jack_client_t* jack = _session.engine().jack ();
|
||||||
|
jack_port_t* jp = jack_port_by_name (jack, i->c_str());
|
||||||
|
if (jp == 0) {
|
||||||
|
return PortMatrixNode::NOT_ASSOCIATED;
|
||||||
|
}
|
||||||
|
|
||||||
|
char const ** c = jack_port_get_all_connections (jack, jp);
|
||||||
|
|
||||||
|
char const ** p = c;
|
||||||
|
|
||||||
|
while (p && *p != 0) {
|
||||||
|
if (strcmp (*p, j->c_str()) == 0) {
|
||||||
|
free (c);
|
||||||
|
return PortMatrixNode::ASSOCIATED;
|
||||||
|
}
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
|
||||||
|
free (c);
|
||||||
|
return PortMatrixNode::NOT_ASSOCIATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p && p->connected_to (*j) == false) {
|
if (p && p->connected_to (*j) == false) {
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ IOSelector::get_state (ARDOUR::BundleChannel c[2]) const
|
||||||
if (our_ports.empty() || other_ports.empty()) {
|
if (our_ports.empty() || other_ports.empty()) {
|
||||||
/* we're looking at a bundle with no parts associated with this channel,
|
/* we're looking at a bundle with no parts associated with this channel,
|
||||||
so nothing to connect */
|
so nothing to connect */
|
||||||
return PortMatrixNode::UNKNOWN;
|
return PortMatrixNode::NOT_ASSOCIATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
|
for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
|
||||||
|
|
|
||||||
|
|
@ -166,9 +166,6 @@ PortMatrixGrid::render_group_pair (cairo_t* cr, boost::shared_ptr<const PortGrou
|
||||||
ARDOUR::BundleChannel (j->bundle, 0)
|
ARDOUR::BundleChannel (j->bundle, 0)
|
||||||
));
|
));
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case PortMatrixNode::UNKNOWN:
|
|
||||||
draw_unknown_indicator (cr, bx, by);
|
|
||||||
break;
|
|
||||||
case PortMatrixNode::ASSOCIATED:
|
case PortMatrixNode::ASSOCIATED:
|
||||||
draw_association_indicator (cr, bx, by);
|
draw_association_indicator (cr, bx, by);
|
||||||
break;
|
break;
|
||||||
|
|
@ -210,10 +207,6 @@ PortMatrixGrid::render_group_pair (cairo_t* cr, boost::shared_ptr<const PortGrou
|
||||||
draw_association_indicator (cr, tx, ty);
|
draw_association_indicator (cr, tx, ty);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PortMatrixNode::UNKNOWN:
|
|
||||||
draw_unknown_indicator (cr, tx, ty);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PortMatrixNode::NOT_ASSOCIATED:
|
case PortMatrixNode::NOT_ASSOCIATED:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -266,20 +259,6 @@ PortMatrixGrid::draw_empty_square (cairo_t* cr, uint32_t x, uint32_t y)
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
PortMatrixGrid::draw_unknown_indicator (cairo_t* cr, uint32_t x, uint32_t y)
|
|
||||||
{
|
|
||||||
set_source_rgba (cr, unknown_colour(), 0.5);
|
|
||||||
cairo_rectangle (
|
|
||||||
cr,
|
|
||||||
x + thick_grid_line_width(),
|
|
||||||
y + thick_grid_line_width(),
|
|
||||||
grid_spacing() - 2 * thick_grid_line_width(),
|
|
||||||
grid_spacing() - 2 * thick_grid_line_width()
|
|
||||||
);
|
|
||||||
cairo_fill (cr);
|
|
||||||
}
|
|
||||||
|
|
||||||
PortMatrixNode
|
PortMatrixNode
|
||||||
PortMatrixGrid::position_to_node (uint32_t x, uint32_t y) const
|
PortMatrixGrid::position_to_node (uint32_t x, uint32_t y) const
|
||||||
{
|
{
|
||||||
|
|
@ -340,10 +319,6 @@ PortMatrixGrid::get_association (PortMatrixNode node) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PortMatrixNode::UNKNOWN:
|
|
||||||
have_unknown = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PortMatrixNode::NOT_ASSOCIATED:
|
case PortMatrixNode::NOT_ASSOCIATED:
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
have_diagonal_not_association = true;
|
have_diagonal_not_association = true;
|
||||||
|
|
@ -356,9 +331,7 @@ PortMatrixGrid::get_association (PortMatrixNode node) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_unknown) {
|
if (have_diagonal_association && !have_off_diagonal_association && !have_diagonal_not_association) {
|
||||||
return PortMatrixNode::UNKNOWN;
|
|
||||||
} else if (have_diagonal_association && !have_off_diagonal_association && !have_diagonal_not_association) {
|
|
||||||
return PortMatrixNode::ASSOCIATED;
|
return PortMatrixNode::ASSOCIATED;
|
||||||
} else if (!have_diagonal_association && !have_off_diagonal_association) {
|
} else if (!have_diagonal_association && !have_off_diagonal_association) {
|
||||||
return PortMatrixNode::NOT_ASSOCIATED;
|
return PortMatrixNode::NOT_ASSOCIATED;
|
||||||
|
|
@ -375,7 +348,8 @@ PortMatrixGrid::get_association (PortMatrixNode node) const
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PortMatrixNode::UNKNOWN;
|
/* NOTREACHED */
|
||||||
|
return PortMatrixNode::NOT_ASSOCIATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ private:
|
||||||
void queue_draw_for (PortMatrixNode const &);
|
void queue_draw_for (PortMatrixNode const &);
|
||||||
void draw_association_indicator (cairo_t *, uint32_t, uint32_t, double p = 1);
|
void draw_association_indicator (cairo_t *, uint32_t, uint32_t, double p = 1);
|
||||||
void draw_empty_square (cairo_t *, uint32_t, uint32_t);
|
void draw_empty_square (cairo_t *, uint32_t, uint32_t);
|
||||||
void draw_unknown_indicator (cairo_t *, uint32_t, uint32_t);
|
|
||||||
std::list<PortMatrixNode> nodes_on_line (int, int, int, int) const;
|
std::list<PortMatrixNode> nodes_on_line (int, int, int, int) const;
|
||||||
PortMatrixNode::State get_association (PortMatrixNode) const;
|
PortMatrixNode::State get_association (PortMatrixNode) const;
|
||||||
void set_association (PortMatrixNode, bool);
|
void set_association (PortMatrixNode, bool);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ struct PortMatrixNode
|
||||||
enum State {
|
enum State {
|
||||||
ASSOCIATED, ///< the ports are associated
|
ASSOCIATED, ///< the ports are associated
|
||||||
NOT_ASSOCIATED, ///< the ports are not associated
|
NOT_ASSOCIATED, ///< the ports are not associated
|
||||||
UNKNOWN, ///< we don't know anything about these two ports' relationship
|
|
||||||
PARTIAL ///< used when we are examining bundles; the bundles are partially associated
|
PARTIAL ///< used when we are examining bundles; the bundles are partially associated
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue