X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fport_matrix_component.cc;h=5e11527d299fefc4f4369d7021905a0541320979;hb=b6c3e5537269e53bb145300e7724e8b89dfb74d6;hp=b2425dcef45ddd9e768dd1154bf57b518e70a9c1;hpb=92e412661772e6b9c83109b7ee4996f4c040d3f4;p=ardour.git diff --git a/gtk2_ardour/port_matrix_component.cc b/gtk2_ardour/port_matrix_component.cc index b2425dcef4..5e11527d29 100644 --- a/gtk2_ardour/port_matrix_component.cc +++ b/gtk2_ardour/port_matrix_component.cc @@ -132,7 +132,7 @@ PortMatrixComponent::group_size (boost::shared_ptr g) const s = bundles.size(); } else { for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) { - s += _matrix->count_of_our_type ((*i)->bundle->nchannels()); + s += _matrix->count_of_our_type_min_1 ((*i)->bundle->nchannels()); } } @@ -140,7 +140,7 @@ PortMatrixComponent::group_size (boost::shared_ptr g) const } /** @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 @@ -155,21 +155,21 @@ PortMatrixComponent::channel_to_position (ARDOUR::BundleChannel bc, boost::share 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 += _matrix->count_of_our_type ((*i)->bundle->nchannels()); + p += _matrix->count_of_our_type_min_1 ((*i)->bundle->nchannels()); } } @@ -181,30 +181,36 @@ ARDOUR::BundleChannel PortMatrixComponent::position_to_channel (double p, double, boost::shared_ptr 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 = _matrix->count_of_our_type ((*j)->bundle->nchannels()); + + 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 (), -1); + } } else { p -= s; } - + } - + } - + return ARDOUR::BundleChannel (boost::shared_ptr (), -1); }