diff options
author | Carl Hetherington <carl@carlh.net> | 2011-11-08 14:15:28 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-11-08 14:15:28 +0000 |
commit | b37bc5e5b2d597c472a603747ed139cc74107013 (patch) | |
tree | b78cf5fe7835be197940e52e679e15f5a43a1616 /gtk2_ardour/port_matrix_component.cc | |
parent | 420d5d659219088b4eb9d41035997a020adf2afa (diff) |
Fix a few SNAFUs in the port matrix related to multi-type bundles (#4454).
git-svn-id: svn://localhost/ardour2/branches/3.0@10494 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/port_matrix_component.cc')
-rw-r--r-- | gtk2_ardour/port_matrix_component.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk2_ardour/port_matrix_component.cc b/gtk2_ardour/port_matrix_component.cc index 2637a26d22..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<const PortGroup> 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_ptr<co } else { - uint32_t const s = _matrix->count_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, (*j)->bundle->type_channel_to_overall (_matrix->type (), 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; } |