s = bundles.size();
} else {
for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
- s += (*i)->bundle->nchannels().get (_matrix->type());
+ s += _matrix->count_of_our_type_min_1 ((*i)->bundle->nchannels());
}
}
}
/** @param bc Channel.
- * @param groups List of groups.
+ * @param group Group.
* @return Position of bc in groups in grid units, taking show_only_bundles into account.
*/
uint32_t
if ((*i)->bundle == bc.bundle) {
/* found the bundle */
-
+
if (_matrix->show_only_bundles()) {
return p;
} else {
- return p + bc.channel;
+ return p + bc.bundle->overall_channel_to_type (_matrix->type (), bc.channel);
}
-
+
}
/* move past this bundle */
-
+
if (_matrix->show_only_bundles()) {
p += 1;
} else {
- p += (*i)->bundle->nchannels().get (_matrix->type());
+ p += _matrix->count_of_our_type_min_1 ((*i)->bundle->nchannels());
}
}
PortMatrixComponent::position_to_channel (double p, double, boost::shared_ptr<const PortGroup> group) const
{
p /= grid_spacing ();
-
+
PortGroup::BundleList const & bundles = group->bundles ();
for (PortGroup::BundleList::const_iterator j = bundles.begin(); j != bundles.end(); ++j) {
if (_matrix->show_only_bundles()) {
-
+
if (p < 1) {
return ARDOUR::BundleChannel ((*j)->bundle, -1);
} else {
p -= 1;
}
-
+
} else {
-
- uint32_t const s = (*j)->bundle->nchannels().get (_matrix->type());
+
+ ARDOUR::ChanCount const N = (*j)->bundle->nchannels ();
+
+ uint32_t const s = _matrix->count_of_our_type_min_1 (N);
if (p < s) {
- return ARDOUR::BundleChannel ((*j)->bundle, p);
+ if (p < _matrix->count_of_our_type (N)) {
+ return ARDOUR::BundleChannel ((*j)->bundle, (*j)->bundle->type_channel_to_overall (_matrix->type (), p));
+ } else {
+ return ARDOUR::BundleChannel (boost::shared_ptr<ARDOUR::Bundle> (), -1);
+ }
} else {
p -= s;
}
-
+
}
-
+
}
-
+
return ARDOUR::BundleChannel (boost::shared_ptr<ARDOUR::Bundle> (), -1);
}