summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-06-30 02:59:13 +0000
committerCarl Hetherington <carl@carlh.net>2010-06-30 02:59:13 +0000
commit5f67a72c341a96872d9cd3d1de357662295d14b0 (patch)
tree69ac5fad51fc894c0af153121822f479358c57be /gtk2_ardour
parent8efaca01efcdb1c7606d3f2aa18e875fd7a26244 (diff)
Basic tweaks to make the bundles and the port matrix accept that MIDI tracks may have audio IO, and vice versa. Allows connection of instrument tracks using the global port matrix.
git-svn-id: svn://localhost/ardour2/branches/3.0@7335 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/bundle_manager.cc44
-rw-r--r--gtk2_ardour/bundle_manager.h2
-rw-r--r--gtk2_ardour/global_port_matrix.cc2
-rw-r--r--gtk2_ardour/io_selector.cc2
-rw-r--r--gtk2_ardour/mixer_strip.cc10
-rw-r--r--gtk2_ardour/port_group.cc82
-rw-r--r--gtk2_ardour/port_group.h10
-rw-r--r--gtk2_ardour/port_matrix.cc50
-rw-r--r--gtk2_ardour/port_matrix_body.cc7
-rw-r--r--gtk2_ardour/port_matrix_column_labels.cc26
-rw-r--r--gtk2_ardour/port_matrix_component.cc6
-rw-r--r--gtk2_ardour/port_matrix_grid.cc32
-rw-r--r--gtk2_ardour/port_matrix_row_labels.cc25
-rw-r--r--gtk2_ardour/session_option_editor.cc2
14 files changed, 146 insertions, 154 deletions
diff --git a/gtk2_ardour/bundle_manager.cc b/gtk2_ardour/bundle_manager.cc
index ba00cce9d0..66e985e808 100644
--- a/gtk2_ardour/bundle_manager.cc
+++ b/gtk2_ardour/bundle_manager.cc
@@ -37,7 +37,7 @@ using namespace std;
using namespace ARDOUR;
BundleEditorMatrix::BundleEditorMatrix (Gtk::Window* parent, Session* session, boost::shared_ptr<Bundle> bundle)
- : PortMatrix (parent, session, bundle->type())
+ : PortMatrix (parent, session, DataType::NIL)
, _bundle (bundle)
{
_port_group = boost::shared_ptr<PortGroup> (new PortGroup (""));
@@ -60,7 +60,7 @@ BundleEditorMatrix::setup_ports (int dim)
otherwise in some cases the basic system IO ports may be hidden, making
the bundle editor useless */
- _ports[OTHER].gather (_session, _bundle->ports_are_inputs(), true);
+ _ports[OTHER].gather (_session, DataType::NIL, _bundle->ports_are_inputs(), true);
_ports[OTHER].remove_bundle (_bundle);
_ports[OTHER].resume_signals ();
}
@@ -118,7 +118,8 @@ BundleEditorMatrix::add_channel (boost::shared_ptr<Bundle> b)
return;
}
- _bundle->add_channel (d.get_name());
+ /* XXX: allow user to specify type */
+ _bundle->add_channel (d.get_name(), DataType::AUDIO);
setup_ports (OURS);
} else {
@@ -212,28 +213,6 @@ BundleEditor::BundleEditor (Session* session, boost::shared_ptr<UserBundle> bund
_input_or_output.signal_changed().connect (sigc::mem_fun (*this, &BundleEditor::input_or_output_changed));
- /* Type (audio or MIDI) */
- a = new Gtk::Alignment (1, 0.5, 0, 1);
- a->add (*Gtk::manage (new Gtk::Label (_("Type:"))));
- t->attach (*Gtk::manage (a), 0, 1, 2, 3, Gtk::FILL, Gtk::FILL);
- a = new Gtk::Alignment (0, 0.5, 0, 1);
- a->add (_type);
- t->attach (*Gtk::manage (a), 1, 2, 2, 3);
-
- _type.append_text (_("Audio"));
- _type.append_text (_("MIDI"));
-
- switch (bundle->type ()) {
- case DataType::AUDIO:
- _type.set_active_text (_("Audio"));
- break;
- case DataType::MIDI:
- _type.set_active_text (_("MIDI"));
- break;
- }
-
- _type.signal_changed().connect (sigc::mem_fun (*this, &BundleEditor::type_changed));
-
get_vbox()->pack_start (*Gtk::manage (t), false, false);
get_vbox()->pack_start (_matrix);
get_vbox()->set_spacing (4);
@@ -271,18 +250,6 @@ BundleEditor::input_or_output_changed ()
}
void
-BundleEditor::type_changed ()
-{
- _bundle->remove_ports_from_channels ();
-
- DataType const t = _type.get_active_text() == _("Audio") ?
- DataType::AUDIO : DataType::MIDI;
-
- _bundle->set_type (t);
- _matrix.set_type (t);
-}
-
-void
BundleEditor::on_map ()
{
_matrix.setup_all_ports ();
@@ -360,7 +327,8 @@ BundleManager::new_clicked ()
boost::shared_ptr<UserBundle> b (new UserBundle (_("Bundle")));
/* Start off with a single channel */
- b->add_channel ("1");
+ /* XXX: allow user to specify type */
+ b->add_channel ("1", DataType::AUDIO);
_session->add_bundle (b);
add_bundle (b);
diff --git a/gtk2_ardour/bundle_manager.h b/gtk2_ardour/bundle_manager.h
index c2c30d47bb..0bad5b2108 100644
--- a/gtk2_ardour/bundle_manager.h
+++ b/gtk2_ardour/bundle_manager.h
@@ -72,14 +72,12 @@ class BundleEditor : public ArdourDialog
private:
void name_changed ();
void input_or_output_changed ();
- void type_changed ();
void on_show ();
BundleEditorMatrix _matrix;
boost::shared_ptr<ARDOUR::UserBundle> _bundle;
Gtk::Entry _name;
Gtk::ComboBoxText _input_or_output;
- Gtk::ComboBoxText _type;
};
class BundleManager : public ArdourDialog
diff --git a/gtk2_ardour/global_port_matrix.cc b/gtk2_ardour/global_port_matrix.cc
index 510d3b3ce3..49e2673263 100644
--- a/gtk2_ardour/global_port_matrix.cc
+++ b/gtk2_ardour/global_port_matrix.cc
@@ -42,7 +42,7 @@ void
GlobalPortMatrix::setup_ports (int dim)
{
_ports[dim].suspend_signals ();
- _ports[dim].gather (_session, dim == IN, false);
+ _ports[dim].gather (_session, type(), dim == IN, false);
_ports[dim].resume_signals ();
}
diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc
index 913fa6dafe..cc5ae58224 100644
--- a/gtk2_ardour/io_selector.cc
+++ b/gtk2_ardour/io_selector.cc
@@ -76,7 +76,7 @@ IOSelector::setup_ports (int dim)
if (dim == _other) {
- _ports[_other].gather (_session, _find_inputs_for_io_outputs, false);
+ _ports[_other].gather (_session, type(), _find_inputs_for_io_outputs, false);
} else {
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index a7cb17b0db..48f44cadf4 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -868,10 +868,7 @@ MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR:
{
using namespace Menu_Helpers;
- if (b->ports_are_outputs() == false ||
- route()->input()->default_type() != b->type() ||
- b->nchannels() != _route->n_inputs().get (b->type ())) {
-
+ if (b->ports_are_outputs() == false || b->nchannels() != _route->n_inputs()) {
return;
}
@@ -905,10 +902,7 @@ MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR
{
using namespace Menu_Helpers;
- if (b->ports_are_inputs() == false ||
- route()->output()->default_type() != b->type() ||
- b->nchannels() != _route->n_outputs().get (b->type ())) {
-
+ if (b->ports_are_inputs() == false || b->nchannels() != _route->n_outputs()) {
return;
}
diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc
index a010b3c184..ffa27d783a 100644
--- a/gtk2_ardour/port_group.cc
+++ b/gtk2_ardour/port_group.cc
@@ -181,10 +181,10 @@ PortGroup::only_bundle ()
}
-uint32_t
+ChanCount
PortGroup::total_channels () const
{
- uint32_t n = 0;
+ ChanCount n;
for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
n += (*i)->bundle->nchannels ();
}
@@ -225,14 +225,14 @@ PortGroup::remove_duplicates ()
/* this bundle is larger */
uint32_t k = 0;
- while (k < (*i)->bundle->nchannels()) {
+ while (k < (*i)->bundle->nchannels().n_total()) {
/* see if this channel on *i has an equivalent on *j */
uint32_t l = 0;
- while (l < (*j)->bundle->nchannels() && (*i)->bundle->channel_ports (k) != (*j)->bundle->channel_ports (l)) {
+ while (l < (*j)->bundle->nchannels().n_total() && (*i)->bundle->channel_ports (k) != (*j)->bundle->channel_ports (l)) {
++l;
}
- if (l == (*j)->bundle->nchannels()) {
+ if (l == (*j)->bundle->nchannels().n_total()) {
/* it does not */
break;
}
@@ -240,7 +240,7 @@ PortGroup::remove_duplicates ()
++k;
}
- if (k == (*i)->bundle->nchannels ()) {
+ if (k == (*i)->bundle->nchannels().n_total()) {
/* all channels on *i are represented by the larger bundle *j, so remove *i */
remove = true;
break;
@@ -260,7 +260,7 @@ PortGroup::remove_duplicates ()
/** PortGroupList constructor.
*/
PortGroupList::PortGroupList ()
- : _type (DataType::AUDIO), _signals_suspended (false), _pending_change (false), _pending_bundle_change ((Bundle::Change) 0)
+ : _signals_suspended (false), _pending_change (false), _pending_bundle_change ((Bundle::Change) 0)
{
}
@@ -271,13 +271,6 @@ PortGroupList::~PortGroupList()
}
void
-PortGroupList::set_type (DataType t)
-{
- _type = t;
- clear ();
-}
-
-void
PortGroupList::maybe_add_processor_to_list (
boost::weak_ptr<Processor> wp, list<boost::shared_ptr<Bundle> >* route_bundles, bool inputs, set<boost::shared_ptr<IO> >& used_io
)
@@ -304,7 +297,7 @@ PortGroupList::maybe_add_processor_to_list (
/** Gather bundles from around the system and put them in this PortGroupList */
void
-PortGroupList::gather (ARDOUR::Session* session, bool inputs, bool allow_dups)
+PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inputs, bool allow_dups)
{
clear ();
@@ -342,33 +335,18 @@ PortGroupList::gather (ARDOUR::Session* session, bool inputs, bool allow_dups)
/* Work out which group to put these bundles in */
boost::shared_ptr<PortGroup> g;
- if (_type == DataType::AUDIO) {
-
- if (boost::dynamic_pointer_cast<AudioTrack> (*i)) {
- g = track;
- } else if (!boost::dynamic_pointer_cast<MidiTrack>(*i)) {
- g = bus;
- }
-
-
- } else if (_type == DataType::MIDI) {
-
- if (boost::dynamic_pointer_cast<MidiTrack> (*i)) {
- g = track;
- }
-
- /* No MIDI busses yet */
+ if (boost::dynamic_pointer_cast<Track> (*i)) {
+ g = track;
+ } else {
+ g = bus;
}
- if (g) {
-
- TimeAxisView* tv = PublicEditor::instance().axis_view_from_route (*i);
- for (list<boost::shared_ptr<Bundle> >::iterator i = route_bundles.begin(); i != route_bundles.end(); ++i) {
- if (tv) {
- g->add_bundle (*i, io, tv->color ());
- } else {
- g->add_bundle (*i, io);
- }
+ TimeAxisView* tv = PublicEditor::instance().axis_view_from_route (*i);
+ for (list<boost::shared_ptr<Bundle> >::iterator i = route_bundles.begin(); i != route_bundles.end(); ++i) {
+ if (tv) {
+ g->add_bundle (*i, io, tv->color ());
+ } else {
+ g->add_bundle (*i, io);
}
}
}
@@ -380,20 +358,20 @@ PortGroupList::gather (ARDOUR::Session* session, bool inputs, bool allow_dups)
boost::shared_ptr<BundleList> b = session->bundles ();
for (BundleList::iterator i = b->begin(); i != b->end(); ++i) {
- if (boost::dynamic_pointer_cast<UserBundle> (*i) && (*i)->ports_are_inputs() == inputs && (*i)->type() == _type) {
+ if (boost::dynamic_pointer_cast<UserBundle> (*i) && (*i)->ports_are_inputs() == inputs) {
system->add_bundle (*i, allow_dups);
}
}
for (BundleList::iterator i = b->begin(); i != b->end(); ++i) {
- if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0 && (*i)->ports_are_inputs() == inputs && (*i)->type() == _type) {
+ if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0 && (*i)->ports_are_inputs() == inputs) {
system->add_bundle (*i, allow_dups);
}
}
/* Ardour stuff */
- if (!inputs && _type == DataType::AUDIO) {
+ if (!inputs && type == DataType::AUDIO) {
ardour->add_bundle (session->the_auditioner()->output()->bundle());
ardour->add_bundle (session->click_io()->bundle());
}
@@ -403,7 +381,7 @@ PortGroupList::gather (ARDOUR::Session* session, bool inputs, bool allow_dups)
std::vector<std::string> extra_system;
std::vector<std::string> extra_other;
- const char **ports = session->engine().get_ports ("", _type.to_jack_type(), inputs ?
+ const char **ports = session->engine().get_ports ("", type.to_jack_type(), inputs ?
JackPortIsInput : JackPortIsOutput);
if (ports) {
@@ -449,12 +427,12 @@ PortGroupList::gather (ARDOUR::Session* session, bool inputs, bool allow_dups)
}
if (!extra_system.empty()) {
- boost::shared_ptr<Bundle> b = make_bundle_from_ports (extra_system, inputs);
+ boost::shared_ptr<Bundle> b = make_bundle_from_ports (extra_system, type, inputs);
system->add_bundle (b);
}
if (!extra_other.empty()) {
- other->add_bundle (make_bundle_from_ports (extra_other, inputs));
+ other->add_bundle (make_bundle_from_ports (extra_other, type, inputs));
}
if (!allow_dups) {
@@ -471,9 +449,9 @@ PortGroupList::gather (ARDOUR::Session* session, bool inputs, bool allow_dups)
}
boost::shared_ptr<Bundle>
-PortGroupList::make_bundle_from_ports (std::vector<std::string> const & p, bool inputs) const
+PortGroupList::make_bundle_from_ports (std::vector<std::string> const & p, ARDOUR::DataType type, bool inputs) const
{
- boost::shared_ptr<Bundle> b (new Bundle ("", _type, inputs));
+ boost::shared_ptr<Bundle> b (new Bundle ("", inputs));
std::string const pre = common_prefix (p);
if (!pre.empty()) {
@@ -481,7 +459,7 @@ PortGroupList::make_bundle_from_ports (std::vector<std::string> const & p, bool
}
for (uint32_t j = 0; j < p.size(); ++j) {
- b->add_channel (p[j].substr (pre.length()));
+ b->add_channel (p[j].substr (pre.length()), type);
b->set_port (j, p[j]);
}
@@ -560,10 +538,10 @@ PortGroupList::bundles () const
return _bundles;
}
-uint32_t
+ChanCount
PortGroupList::total_channels () const
{
- uint32_t n = 0;
+ ChanCount n;
for (PortGroupList::List::const_iterator i = begin(); i != end(); ++i) {
n += (*i)->total_channels ();
@@ -661,7 +639,7 @@ bool
PortGroupList::empty () const
{
List::const_iterator i = _groups.begin ();
- while (i != _groups.end() && (*i)->total_channels() == 0) {
+ while (i != _groups.end() && (*i)->total_channels() == ChanCount::ZERO) {
++i;
}
diff --git a/gtk2_ardour/port_group.h b/gtk2_ardour/port_group.h
index 17d1963e19..f8955337a2 100644
--- a/gtk2_ardour/port_group.h
+++ b/gtk2_ardour/port_group.h
@@ -58,7 +58,7 @@ public:
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
boost::shared_ptr<ARDOUR::Bundle> only_bundle ();
void clear ();
- uint32_t total_channels () const;
+ ARDOUR::ChanCount total_channels () const;
boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;
void remove_duplicates ();
@@ -108,12 +108,11 @@ class PortGroupList : public sigc::trackable
void add_group (boost::shared_ptr<PortGroup>);
void add_group_if_not_empty (boost::shared_ptr<PortGroup>);
- void set_type (ARDOUR::DataType);
- void gather (ARDOUR::Session *, bool, bool);
+ void gather (ARDOUR::Session *, ARDOUR::DataType, bool, bool);
PortGroup::BundleList const & bundles () const;
void clear ();
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
- uint32_t total_channels () const;
+ ARDOUR::ChanCount total_channels () const;
uint32_t size () const {
return _groups.size();
}
@@ -144,12 +143,11 @@ class PortGroupList : public sigc::trackable
std::string common_prefix_before (std::vector<std::string> const &, std::string const &) const;
void emit_changed ();
void emit_bundle_changed (ARDOUR::Bundle::Change);
- boost::shared_ptr<ARDOUR::Bundle> make_bundle_from_ports (std::vector<std::string> const &, bool) const;
+ boost::shared_ptr<ARDOUR::Bundle> make_bundle_from_ports (std::vector<std::string> const &, ARDOUR::DataType, bool) const;
void maybe_add_processor_to_list (
boost::weak_ptr<ARDOUR::Processor>, std::list<boost::shared_ptr<ARDOUR::Bundle> > *, bool, std::set<boost::shared_ptr<ARDOUR::IO> > &
);
- ARDOUR::DataType _type;
mutable PortGroup::BundleList _bundles;
List _groups;
PBD::ScopedConnectionList _bundle_changed_connections;
diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc
index 73e937e840..dc7730c823 100644
--- a/gtk2_ardour/port_matrix.cc
+++ b/gtk2_ardour/port_matrix.cc
@@ -77,10 +77,6 @@ PortMatrix::PortMatrix (Window* parent, Session* session, DataType type)
_hnotebook.property_tab_border() = 4;
_hnotebook.set_name (X_("PortMatrixLabel"));
- for (int i = 0; i < 2; ++i) {
- _ports[i].set_type (type);
- }
-
_vlabel.set_use_markup ();
_vlabel.set_alignment (1, 1);
_vlabel.set_padding (4, 16);
@@ -217,8 +213,6 @@ void
PortMatrix::set_type (DataType t)
{
_type = t;
- _ports[0].set_type (_type);
- _ports[1].set_type (_type);
setup_all_ports ();
}
@@ -261,9 +255,13 @@ PortMatrix::disassociate_all ()
PortGroup::BundleList b = _ports[1].bundles ();
for (PortGroup::BundleList::iterator i = a.begin(); i != a.end(); ++i) {
- for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) {
for (PortGroup::BundleList::iterator k = b.begin(); k != b.end(); ++k) {
- for (uint32_t l = 0; l < (*k)->bundle->nchannels(); ++l) {
+ for (uint32_t l = 0; l < (*k)->bundle->nchannels().n_total(); ++l) {
+
+ if ((*i)->bundle->channel_type(j) != _type || (*k)->bundle->channel_type(l) != _type) {
+ continue;
+ }
BundleChannel c[2] = {
BundleChannel ((*i)->bundle, j),
@@ -287,8 +285,8 @@ void
PortMatrix::select_arrangement ()
{
uint32_t const N[2] = {
- _ports[0].total_channels (),
- _ports[1].total_channels ()
+ _ports[0].total_channels().get(_type),
+ _ports[1].total_channels().get(_type)
};
/* The list with the most channels goes on left or right, so that the most channel
@@ -426,13 +424,15 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::remove_all_channels), w))
);
- for (uint32_t i = 0; i < bc[dim].bundle->nchannels(); ++i) {
- add_remove_option (sub, w, i);
+ for (uint32_t i = 0; i < bc[dim].bundle->nchannels().n_total(); ++i) {
+ if (bc[dim].bundle->channel_type(i) == _type) {
+ add_remove_option (sub, w, i);
+ }
}
}
}
- if (_show_only_bundles || bc[dim].bundle->nchannels() <= 1) {
+ if (_show_only_bundles || bc[dim].bundle->nchannels().get(_type) <= 1) {
snprintf (buf, sizeof (buf), _("%s all"), disassociation_verb().c_str());
sub.push_back (
MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::disassociate_all_on_channel), w, bc[dim].channel, dim))
@@ -448,8 +448,10 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::disassociate_all_on_bundle), w, dim))
);
- for (uint32_t i = 0; i < bc[dim].bundle->nchannels(); ++i) {
- add_disassociate_option (sub, w, dim, i);
+ for (uint32_t i = 0; i < bc[dim].bundle->nchannels().n_total(); ++i) {
+ if (bc[dim].bundle->channel_type(i) == _type) {
+ add_disassociate_option (sub, w, dim, i);
+ }
}
}
}
@@ -505,8 +507,10 @@ PortMatrix::disassociate_all_on_bundle (boost::weak_ptr<Bundle> bundle, int dim)
return;
}
- for (uint32_t i = 0; i < sb->nchannels(); ++i) {
- disassociate_all_on_channel (bundle, i, dim);
+ for (uint32_t i = 0; i < sb->nchannels().n_total(); ++i) {
+ if (sb->channel_type(i) == _type) {
+ disassociate_all_on_channel (bundle, i, dim);
+ }
}
}
@@ -521,7 +525,11 @@ PortMatrix::disassociate_all_on_channel (boost::weak_ptr<Bundle> bundle, uint32_
PortGroup::BundleList a = _ports[1-dim].bundles ();
for (PortGroup::BundleList::iterator i = a.begin(); i != a.end(); ++i) {
- for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) {
+
+ if ((*i)->bundle->channel_type(j) != _type) {
+ continue;
+ }
BundleChannel c[2];
c[dim] = BundleChannel (sb, channel);
@@ -662,8 +670,10 @@ PortMatrix::remove_all_channels (boost::weak_ptr<Bundle> w)
return;
}
- for (uint32_t i = 0; i < b->nchannels(); ++i) {
- remove_channel (ARDOUR::BundleChannel (b, i));
+ for (uint32_t i = 0; i < b->nchannels().n_total(); ++i) {
+ if (b->channel_type(i) == _type) {
+ remove_channel (ARDOUR::BundleChannel (b, i));
+ }
}
}
diff --git a/gtk2_ardour/port_matrix_body.cc b/gtk2_ardour/port_matrix_body.cc
index 6da2ab87b5..df92c51e5e 100644
--- a/gtk2_ardour/port_matrix_body.cc
+++ b/gtk2_ardour/port_matrix_body.cc
@@ -467,7 +467,12 @@ PortMatrixBody::highlight_associated_channels (int dim, ARDOUR::BundleChannel h)
PortGroup::BundleList const b = _matrix->visible_ports(1 - dim)->bundles ();
for (PortGroup::BundleList::const_iterator i = b.begin(); i != b.end(); ++i) {
- for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) {
+
+ if ((*i)->bundle->channel_type(j) != _matrix->type()) {
+ continue;
+ }
+
bc[1 - dim] = ARDOUR::BundleChannel ((*i)->bundle, j);
if (_matrix->get_state (bc) == PortMatrixNode::ASSOCIATED) {
if (dim == _matrix->column_index()) {
diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc
index 339767f27d..fa1989f914 100644
--- a/gtk2_ardour/port_matrix_column_labels.cc
+++ b/gtk2_ardour/port_matrix_column_labels.cc
@@ -62,7 +62,11 @@ PortMatrixColumnLabels::compute_dimensions ()
_longest_bundle_name = ext.width;
}
- for (uint32_t k = 0; k < (*j)->bundle->nchannels (); ++k) {
+ for (uint32_t k = 0; k < (*j)->bundle->nchannels().n_total(); ++k) {
+
+ if ((*j)->bundle->channel_type(k) != _matrix->type()) {
+ continue;
+ }
cairo_text_extents (
cr,
@@ -135,7 +139,7 @@ PortMatrixColumnLabels::render (cairo_t* cr)
if (_matrix->show_only_bundles()) {
x += grid_spacing();
} else {
- x += (*i)->bundle->nchannels () * grid_spacing();
+ x += (*i)->bundle->nchannels().get(_matrix->type()) * grid_spacing();
}
++N;
@@ -149,7 +153,12 @@ PortMatrixColumnLabels::render (cairo_t* cr)
for (PortGroup::BundleList::const_iterator i = bundles.begin (); i != bundles.end(); ++i) {
- for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) {
+
+ if ((*i)->bundle->channel_type(j) != _matrix->type()) {
+ continue;
+ }
+
Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N);
render_channel_name (cr, background_colour (), c, x, 0, ARDOUR::BundleChannel ((*i)->bundle, j));
x += grid_spacing();
@@ -254,7 +263,7 @@ PortMatrixColumnLabels::render_bundle_name (
if (_matrix->show_only_bundles()) {
w = grid_spacing ();
} else {
- w = b->nchannels() * grid_spacing();
+ w = b->nchannels().get(_matrix->type()) * grid_spacing();
}
double x_ = xoff;
@@ -352,7 +361,7 @@ PortMatrixColumnLabels::render_channel_name (
);
}
- if (bc.bundle->nchannels() > 1) {
+ if (bc.bundle->nchannels().get(_matrix->type()) > 1) {
/* only plot the name if the bundle has more than one channel;
the name of a single channel is assumed to be redundant */
@@ -478,7 +487,12 @@ PortMatrixColumnLabels::motion (double x, double y)
list<PortMatrixNode> n;
- for (uint32_t i = 0; i < w.bundle->nchannels(); ++i) {
+ for (uint32_t i = 0; i < w.bundle->nchannels().n_total(); ++i) {
+
+ if (w.bundle->channel_type(i) != _matrix->type()) {
+ continue;
+ }
+
ARDOUR::BundleChannel const bc (w.bundle, i);
n.push_back (PortMatrixNode (ARDOUR::BundleChannel (), bc));
}
diff --git a/gtk2_ardour/port_matrix_component.cc b/gtk2_ardour/port_matrix_component.cc
index 440376d1fa..720acce862 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<const PortGroup> g) const
s = bundles.size();
} else {
for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
- s += (*i)->bundle->nchannels();
+ s += (*i)->bundle->nchannels().get (_matrix->type());
}
}
@@ -169,7 +169,7 @@ PortMatrixComponent::channel_to_position (ARDOUR::BundleChannel bc, boost::share
if (_matrix->show_only_bundles()) {
p += 1;
} else {
- p += (*i)->bundle->nchannels ();
+ p += (*i)->bundle->nchannels().get (_matrix->type());
}
}
@@ -195,7 +195,7 @@ PortMatrixComponent::position_to_channel (double p, double, boost::shared_ptr<co
} else {
- uint32_t const s = (*j)->bundle->nchannels ();
+ uint32_t const s = (*j)->bundle->nchannels().get (_matrix->type());
if (p < s) {
return ARDOUR::BundleChannel ((*j)->bundle, p);
} else {
diff --git a/gtk2_ardour/port_matrix_grid.cc b/gtk2_ardour/port_matrix_grid.cc
index fdfe45b224..572b278f79 100644
--- a/gtk2_ardour/port_matrix_grid.cc
+++ b/gtk2_ardour/port_matrix_grid.cc
@@ -81,7 +81,7 @@ PortMatrixGrid::render (cairo_t* cr)
if (!_matrix->show_only_bundles()) {
cairo_set_line_width (cr, thin_grid_line_width());
- for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels().get(_matrix->type()); ++j) {
x += grid_spacing ();
cairo_move_to (cr, x, 0);
cairo_line_to (cr, x, _height);
@@ -111,7 +111,7 @@ PortMatrixGrid::render (cairo_t* cr)
if (!_matrix->show_only_bundles()) {
cairo_set_line_width (cr, thin_grid_line_width());
- for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels().get(_matrix->type()); ++j) {
y += grid_spacing ();
cairo_move_to (cr, 0, y);
cairo_line_to (cr, _width, y);
@@ -169,10 +169,14 @@ PortMatrixGrid::render (cairo_t* cr)
for (PortGroup::BundleList::const_iterator j = row_bundles.begin(); j != row_bundles.end(); ++j) {
x = bx;
- for (uint32_t k = 0; k < (*i)->bundle->nchannels (); ++k) {
+ for (uint32_t k = 0; k < (*i)->bundle->nchannels().n_total(); ++k) {
y = by;
- for (uint32_t l = 0; l < (*j)->bundle->nchannels (); ++l) {
+ for (uint32_t l = 0; l < (*j)->bundle->nchannels().n_total(); ++l) {
+
+ if ((*i)->bundle->channel_type(k) != _matrix->type() || (*j)->bundle->channel_type(l) != _matrix->type()) {
+ continue;
+ }
ARDOUR::BundleChannel c[2];
c[_matrix->column_index()] = ARDOUR::BundleChannel ((*i)->bundle, k);
@@ -198,10 +202,10 @@ PortMatrixGrid::render (cairo_t* cr)
x += grid_spacing();
}
- by += (*j)->bundle->nchannels () * grid_spacing();
+ by += (*j)->bundle->nchannels().get(_matrix->type()) * grid_spacing();
}
- bx += (*i)->bundle->nchannels () * grid_spacing();
+ bx += (*i)->bundle->nchannels().get(_matrix->type()) * grid_spacing();
}
}
}
@@ -277,9 +281,13 @@ PortMatrixGrid::get_association (PortMatrixNode node) const
bool have_diagonal_association = false;
bool have_diagonal_not_association = false;
- for (uint32_t i = 0; i < node.row.bundle->nchannels (); ++i) {
+ for (uint32_t i = 0; i < node.row.bundle->nchannels().n_total(); ++i) {
+
+ for (uint32_t j = 0; j < node.column.bundle->nchannels().n_total(); ++j) {
- for (uint32_t j = 0; j < node.column.bundle->nchannels (); ++j) {
+ if (node.row.bundle->channel_type(i) != _matrix->type() || node.column.bundle->channel_type(j) != _matrix->type()) {
+ continue;
+ }
ARDOUR::BundleChannel c[2];
c[_matrix->column_index()] = ARDOUR::BundleChannel (node.row.bundle, i);
@@ -334,9 +342,13 @@ PortMatrixGrid::set_association (PortMatrixNode node, bool s)
{
if (_matrix->show_only_bundles()) {
- for (uint32_t i = 0; i < node.column.bundle->nchannels(); ++i) {
- for (uint32_t j = 0; j < node.row.bundle->nchannels(); ++j) {
+ for (uint32_t i = 0; i < node.column.bundle->nchannels().n_total(); ++i) {
+ for (uint32_t j = 0; j < node.row.bundle->nchannels().n_total(); ++j) {
+ if (node.column.bundle->channel_type(i) != _matrix->type() || node.row.bundle->channel_type(j) != _matrix->type()) {
+ continue;
+ }
+
ARDOUR::BundleChannel c[2];
c[_matrix->column_index()] = ARDOUR::BundleChannel (node.column.bundle, i);
c[_matrix->row_index()] = ARDOUR::BundleChannel (node.row.bundle, j);
diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc
index 57e972acd4..30317f5619 100644
--- a/gtk2_ardour/port_matrix_row_labels.cc
+++ b/gtk2_ardour/port_matrix_row_labels.cc
@@ -54,7 +54,12 @@ PortMatrixRowLabels::compute_dimensions ()
PortGroup::BundleList const r = (*i)->bundles ();
for (PortGroup::BundleList::const_iterator j = r.begin(); j != r.end(); ++j) {
- for (uint32_t k = 0; k < (*j)->bundle->nchannels(); ++k) {
+ for (uint32_t k = 0; k < (*j)->bundle->nchannels().n_total(); ++k) {
+
+ if ((*j)->bundle->channel_type(k) != _matrix->type()) {
+ continue;
+ }
+
cairo_text_extents_t ext;
cairo_text_extents (cr, (*j)->bundle->channel_name(k).c_str(), &ext);
if (ext.width > _longest_port_name) {
@@ -110,7 +115,12 @@ PortMatrixRowLabels::render (cairo_t* cr)
render_bundle_name (cr, background_colour (), (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N), 0, y, (*i)->bundle);
if (!_matrix->show_only_bundles()) {
- for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+ for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) {
+
+ if ((*i)->bundle->channel_type(j) != _matrix->type()) {
+ continue;
+ }
+
Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (M);
render_channel_name (cr, background_colour (), c, 0, y, ARDOUR::BundleChannel ((*i)->bundle, j));
y += grid_spacing();
@@ -205,7 +215,7 @@ PortMatrixRowLabels::render_bundle_name (
{
double const x = bundle_name_x ();
- int const n = _matrix->show_only_bundles() ? 1 : b->nchannels();
+ int const n = _matrix->show_only_bundles() ? 1 : b->nchannels().get(_matrix->type());
set_source_rgb (cr, bg_colour);
cairo_rectangle (cr, xoff + x, yoff, _longest_bundle_name + name_pad() * 2, grid_spacing() * n);
cairo_fill_preserve (cr);
@@ -238,7 +248,7 @@ PortMatrixRowLabels::render_channel_name (
cairo_text_extents (cr, bc.bundle->channel_name(bc.channel).c_str(), &ext);
double const off = (grid_spacing() - ext.height) / 2;
- if (bc.bundle->nchannels() > 1) {
+ if (bc.bundle->nchannels().get(_matrix->type()) > 1) {
/* only plot the name if the bundle has more than one channel;
the name of a single channel is assumed to be redundant */
@@ -323,7 +333,12 @@ PortMatrixRowLabels::motion (double x, double y)
list<PortMatrixNode> n;
- for (uint32_t i = 0; i < w.bundle->nchannels(); ++i) {
+ for (uint32_t i = 0; i < w.bundle->nchannels().n_total(); ++i) {
+
+ if (w.bundle->channel_type(i) != _matrix->type()) {
+ continue;
+ }
+
ARDOUR::BundleChannel const bc (w.bundle, i);
n.push_back (PortMatrixNode (bc, ARDOUR::BundleChannel ()));
}
diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc
index 1afc079aaf..06ad58d7e0 100644
--- a/gtk2_ardour/session_option_editor.cc
+++ b/gtk2_ardour/session_option_editor.cc
@@ -32,7 +32,7 @@ public:
_port_group->add_bundle (_session->click_io()->bundle());
_port_group->add_bundle (_session->the_auditioner()->output()->bundle());
} else {
- _ports[OTHER].gather (_session, true, false);
+ _ports[OTHER].gather (_session, DataType::AUDIO, true, false);
}
}