From 92e412661772e6b9c83109b7ee4996f4c040d3f4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 1 Jul 2010 01:14:14 +0000 Subject: Allow port matrix to show both audio and midi ports at the same time, and use that facility for route IO selectors. git-svn-id: svn://localhost/ardour2/branches/3.0@7344 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/port_group.cc | 54 +++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'gtk2_ardour/port_group.cc') diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc index ffa27d783a..7990eded89 100644 --- a/gtk2_ardour/port_group.cc +++ b/gtk2_ardour/port_group.cc @@ -295,7 +295,9 @@ PortGroupList::maybe_add_processor_to_list ( } -/** Gather bundles from around the system and put them in this PortGroupList */ +/** Gather bundles from around the system and put them in this PortGroupList. + * @param type Type of bundles to collect, or NIL for all types. + */ void PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inputs, bool allow_dups) { @@ -371,25 +373,26 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp /* Ardour stuff */ - if (!inputs && type == DataType::AUDIO) { + if (!inputs && (type == DataType::AUDIO || type == DataType::NIL)) { ardour->add_bundle (session->the_auditioner()->output()->bundle()); ardour->add_bundle (session->click_io()->bundle()); } /* Now find all other ports that we haven't thought of yet */ - std::vector extra_system; - std::vector extra_other; + std::vector extra_system[DataType::num_types]; + std::vector extra_other[DataType::num_types]; - const char **ports = session->engine().get_ports ("", type.to_jack_type(), inputs ? - JackPortIsInput : JackPortIsOutput); + const char ** ports = 0; + if (type == DataType::NIL) { + ports = session->engine().get_ports ("", "", inputs ? JackPortIsInput : JackPortIsOutput); + } else { + ports = session->engine().get_ports ("", type.to_jack_type(), inputs ? JackPortIsInput : JackPortIsOutput); + } + if (ports) { int n = 0; - string client_matching_string; - - client_matching_string = session->engine().client_name(); - client_matching_string += ':'; while (ports[n]) { @@ -411,12 +414,18 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp continue; } - if (port_has_prefix (p, "system:") || - port_has_prefix (p, "alsa_pcm") || - port_has_prefix (p, "ardour:")) { - extra_system.push_back (p); - } else { - extra_other.push_back (p); + /* can't use the audio engine for this as we are looking at non-Ardour ports */ + + jack_port_t* jp = jack_port_by_name (session->engine().jack(), p.c_str()); + if (jp) { + DataType t (jack_port_type (jp)); + if (t != DataType::NIL) { + if (port_has_prefix (p, "system:") || port_has_prefix (p, "alsa_pcm") || port_has_prefix (p, "ardour:")) { + extra_system[t].push_back (p); + } else { + extra_other[t].push_back (p); + } + } } } @@ -426,13 +435,16 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp free (ports); } - if (!extra_system.empty()) { - boost::shared_ptr b = make_bundle_from_ports (extra_system, type, inputs); - system->add_bundle (b); + for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) { + if (!extra_system[*i].empty()) { + system->add_bundle (make_bundle_from_ports (extra_system[*i], *i, inputs)); + } } - if (!extra_other.empty()) { - other->add_bundle (make_bundle_from_ports (extra_other, type, inputs)); + for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) { + if (!extra_other[*i].empty()) { + other->add_bundle (make_bundle_from_ports (extra_other[*i], *i, inputs)); + } } if (!allow_dups) { -- cgit v1.2.3