Make Bundle::disconnect() more robust
Instead of asserting or crashing if the number of channels of both bundles don't match, just try to disconnect as much as possible.
This commit is contained in:
parent
6d0b009995
commit
41c5913b91
@ -361,19 +361,26 @@ Bundle::connect (boost::shared_ptr<Bundle> other, AudioEngine & engine,
|
|||||||
void
|
void
|
||||||
Bundle::disconnect (boost::shared_ptr<Bundle> other, AudioEngine & engine)
|
Bundle::disconnect (boost::shared_ptr<Bundle> other, AudioEngine & engine)
|
||||||
{
|
{
|
||||||
uint32_t const N = n_total();
|
ChanCount our_count = nchannels();
|
||||||
assert (N == other->n_total());
|
ChanCount other_count = other->nchannels();
|
||||||
|
|
||||||
|
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
|
||||||
|
uint32_t N = min(our_count.n(*t), other_count.n(*t));
|
||||||
for (uint32_t i = 0; i < N; ++i) {
|
for (uint32_t i = 0; i < N; ++i) {
|
||||||
Bundle::PortList const & our_ports = channel_ports (i);
|
Bundle::PortList const & our_ports =
|
||||||
Bundle::PortList const & other_ports = other->channel_ports (i);
|
channel_ports (type_channel_to_overall(*t, i));
|
||||||
|
Bundle::PortList const & other_ports =
|
||||||
|
other->channel_ports (other->type_channel_to_overall(*t, i));
|
||||||
|
|
||||||
for (Bundle::PortList::const_iterator j = our_ports.begin(); j != our_ports.end(); ++j) {
|
for (Bundle::PortList::const_iterator j = our_ports.begin();
|
||||||
for (Bundle::PortList::const_iterator k = other_ports.begin(); k != other_ports.end(); ++k) {
|
j != our_ports.end(); ++j) {
|
||||||
|
for (Bundle::PortList::const_iterator k = other_ports.begin();
|
||||||
|
k != other_ports.end(); ++k) {
|
||||||
engine.disconnect (*j, *k);
|
engine.disconnect (*j, *k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Remove all ports from all channels */
|
/** Remove all ports from all channels */
|
||||||
|
Loading…
Reference in New Issue
Block a user