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
This commit is contained in:
parent
420d5d6592
commit
b37bc5e5b2
@ -156,10 +156,12 @@ PortMatrixColumnLabels::render (cairo_t* cr)
|
||||
|
||||
for (uint32_t j = 0; j < C; ++j) {
|
||||
Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N);
|
||||
|
||||
ARDOUR::BundleChannel bc (
|
||||
(*i)->bundle,
|
||||
(*i)->bundle->type_channel_to_overall (_matrix->type (), j)
|
||||
);
|
||||
|
||||
render_channel_name (cr, background_colour (), c, x, 0, bc);
|
||||
x += grid_spacing();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -101,6 +101,7 @@ class Bundle : public PBD::ScopedConnectionList
|
||||
bool connected_to (boost::shared_ptr<Bundle>, AudioEngine &);
|
||||
bool has_same_ports (boost::shared_ptr<Bundle>) const;
|
||||
uint32_t type_channel_to_overall (DataType, uint32_t) const;
|
||||
uint32_t overall_channel_to_type (DataType, uint32_t) const;
|
||||
|
||||
void set_name (std::string const &);
|
||||
|
||||
|
@ -528,11 +528,17 @@ Bundle::operator== (Bundle const & other)
|
||||
*
|
||||
* If t == MIDI and c == 0, then we would return 2, as 2 is the index of the
|
||||
* 0th MIDI channel.
|
||||
*
|
||||
* If t == NIL, we just return c.
|
||||
*/
|
||||
|
||||
uint32_t
|
||||
Bundle::type_channel_to_overall (DataType t, uint32_t c) const
|
||||
{
|
||||
if (t == DataType::NIL) {
|
||||
return c;
|
||||
}
|
||||
|
||||
Glib::Mutex::Lock lm (_channel_mutex);
|
||||
|
||||
vector<Channel>::const_iterator i = _channel.begin ();
|
||||
@ -558,3 +564,26 @@ Bundle::type_channel_to_overall (DataType t, uint32_t c) const
|
||||
/* NOTREACHED */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Perform the reverse of type_channel_to_overall */
|
||||
uint32_t
|
||||
Bundle::overall_channel_to_type (DataType t, uint32_t c) const
|
||||
{
|
||||
if (t == DataType::NIL) {
|
||||
return c;
|
||||
}
|
||||
|
||||
Glib::Mutex::Lock lm (_channel_mutex);
|
||||
|
||||
uint32_t s = 0;
|
||||
|
||||
vector<Channel>::const_iterator i = _channel.begin ();
|
||||
for (uint32_t j = 0; j < c; ++j) {
|
||||
if (i->type == t) {
|
||||
++s;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user