X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fport_matrix_component.cc;h=5e11527d299fefc4f4369d7021905a0541320979;hb=fdf63ace6a655f772a46e73719de14f9dd6fb940;hp=166488bef0bc256b632e2a50dfaa997e35c10941;hpb=07a58ffd62f834780eb5dada7c1713e31c2e425a;p=ardour.git diff --git a/gtk2_ardour/port_matrix_component.cc b/gtk2_ardour/port_matrix_component.cc index 166488bef0..5e11527d29 100644 --- a/gtk2_ardour/port_matrix_component.cc +++ b/gtk2_ardour/port_matrix_component.cc @@ -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 @@ -159,7 +159,7 @@ PortMatrixComponent::channel_to_position (ARDOUR::BundleChannel bc, boost::share if (_matrix->show_only_bundles()) { return p; } else { - return p + bc.channel; + return p + bc.bundle->overall_channel_to_type (_matrix->type (), bc.channel); } } @@ -195,9 +195,15 @@ PortMatrixComponent::position_to_channel (double p, double, boost::shared_ptrcount_of_our_type_min_1 ((*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; }