ChanCount
Bundle::nchannels () const
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
ChanCount c;
for (vector<Channel>::const_iterator i = _channel.begin(); i != _channel.end(); ++i) {
{
assert (c < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[c].ports;
}
assert (portname.find_first_of (':') != string::npos);
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel[ch].ports.push_back (portname);
}
bool changed = false;
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
PortList& pl = _channel[ch].ports;
PortList::iterator i = find (pl.begin(), pl.end(), portname);
assert (portname.find_first_of (':') != string::npos);
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel[ch].ports.clear ();
_channel[ch].ports.push_back (portname);
}
Bundle::add_channel (std::string const & n, DataType t)
{
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.push_back (Channel (n, t));
}
Bundle::add_channel (std::string const & n, DataType t, PortList p)
{
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.push_back (Channel (n, t, p));
}
Bundle::add_channel (std::string const & n, DataType t, std::string const & p)
{
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.push_back (Channel (n, t, p));
}
{
assert (ch < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
return (std::find (_channel[ch].ports.begin (), _channel[ch].ports.end (), portname) != _channel[ch].ports.end ());
}
{
assert (ch < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.erase (_channel.begin () + ch);
+
+ lm.release();
+ emit_changed (ConfigurationChanged);
}
/** Remove all channels */
void
Bundle::remove_channels ()
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.clear ();
+
+ lm.release();
+ emit_changed (ConfigurationChanged);
}
/** @param p Port name.
bool
Bundle::offers_port (std::string p) const
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
for (std::vector<Channel>::const_iterator i = _channel.begin(); i != _channel.end(); ++i) {
for (PortList::const_iterator j = i->ports.begin(); j != i->ports.end(); ++j) {
bool
Bundle::offers_port_alone (std::string p) const
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
for (std::vector<Channel>::const_iterator i = _channel.begin(); i != _channel.end(); ++i) {
if (i->ports.size() == 1 && i->ports[0] == p) {
{
assert (ch < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[ch].name;
}
assert (ch < nchannels().n_total());
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel[ch].name = n;
}
Bundle::remove_ports_from_channels ()
{
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
for (uint32_t c = 0; c < _channel.size(); ++c) {
_channel[c].ports.clear ();
}
assert (ch < nchannels().n_total());
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel[ch].ports.clear ();
}
return true;
}
-/** This must not be called in code executed as a response to a JACK event,
- * as it uses jack_port_get_all_connections().
+/** This must not be called in code executed as a response to a backend event,
+ * as it uses the backend port_get_all_connections().
* @return true if any of this bundle's channels are connected to anything.
*/
bool
Bundle::connected_to_anything (AudioEngine& engine)
{
+ PortManager& pm (engine);
+
for (uint32_t i = 0; i < nchannels().n_total(); ++i) {
Bundle::PortList const & ports = channel_ports (i);
for (uint32_t j = 0; j < ports.size(); ++j) {
- /* ports[j] may not be an Ardour port, so use JACK directly
+
+ /* ports[j] may not be an Ardour port, so use the port manager directly
rather than doing it with Port.
*/
- jack_port_t* jp = jack_port_by_name (engine.jack(), ports[j].c_str());
- if (jp) {
- const char ** c = jack_port_get_all_connections (engine.jack(), jp);
- if (c) {
- jack_free (c);
- return true;
- }
+
+ if (pm.connected (ports[j])) {
+ return true;
}
}
}
{
assert (c < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[c].type;
}
return c;
}
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
vector<Channel>::const_iterator i = _channel.begin ();
return c;
}
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
uint32_t s = 0;