}
/** @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 (_matrix->show_only_bundles()) {
return p;
} else {
- return p + bc.channel;
+ return p + bc.bundle->overall_channel_to_type (_matrix->type (), bc.channel);
}
}
} 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, 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;
}