21 #include <boost/shared_ptr.hpp>
22 #include <boost/algorithm/string.hpp>
24 #include "midi++/mmc.h"
37 #include "control_protocol/control_protocol.h"
115 BundleList::iterator i =
_bundles.begin ();
137 BundleList::iterator i =
_bundles.begin ();
138 while (i !=
_bundles.end() && (*i)->bundle != b) {
173 for (BundleList::const_iterator i =
_bundles.begin(); i !=
_bundles.end(); ++i) {
174 if ((*i)->bundle->offers_port_alone (p)) {
194 for (BundleList::const_iterator i =
_bundles.begin(); i !=
_bundles.end(); ++i) {
195 n += (*i)->bundle->nchannels ();
204 BundleList::const_iterator i =
_bundles.begin ();
205 while (i !=
_bundles.end() && (*i)->bundle != b) {
221 BundleList::iterator i =
_bundles.begin();
224 BundleList::iterator tmp = i;
231 if ((*j)->bundle->nchannels() > (*i)->bundle->nchannels()) {
235 while (k < (*i)->bundle->nchannels().n_total()) {
238 while (l < (*j)->bundle->nchannels().n_total() && (*i)->bundle->channel_ports (k) != (*j)->bundle->channel_ports (l)) {
242 if (l == (*j)->bundle->nchannels().n_total()) {
250 if (k == (*i)->bundle->nchannels().n_total()) {
270 : _signals_suspended (false), _pending_change (false), _pending_bundle_change ((
Bundle::Change) 0)
297 if (io && used_io.find (io) == used_io.end()) {
298 route_ios->push_back (io);
312 std::list<boost::shared_ptr<IO> >
ios;
349 list<RouteIOs> route_ios;
351 for (RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
355 if (inputs && (*i)->is_monitor()) {
364 set<boost::shared_ptr<IO> > used_io;
371 route_ios.push_back (rb);
382 for (list<RouteIOs>::iterator i = route_ios.begin(); i != route_ios.end(); ++i) {
387 if (boost::dynamic_pointer_cast<Track> (i->route)) {
408 for (BundleList::iterator i = b->begin(); i != b->end(); ++i) {
409 if (boost::dynamic_pointer_cast<UserBundle> (*i) && (*i)->ports_are_inputs() == inputs) {
415 if (use_session_bundles) {
416 for (BundleList::iterator i = b->begin(); i != b->end(); ++i) {
417 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0 && (*i)->ports_are_inputs() == inputs) {
445 if ((*i)->protocol) {
446 list<boost::shared_ptr<Bundle> > b = (*i)->protocol->bundles ();
448 if ((*j)->ports_are_inputs() == inputs) {
457 if ((type == DataType::MIDI || type == DataType::NIL)) {
494 std::vector<std::string> extra_system[DataType::num_types];
495 std::vector<std::string> extra_other[DataType::num_types];
497 string lpn (PROGRAM_NAME);
498 boost::to_lower (lpn);
502 vector<string> ports;
503 if (AudioEngine::instance()->get_ports (
"", type, inputs ?
IsInput :
IsOutput, ports) > 0) {
505 for (vector<string>::const_iterator s = ports.begin(); s != ports.end(); ) {
507 std::string
const p = *s;
520 if (p.find (
"Midi-Through") != string::npos) {
530 boost::to_lower (lp);
532 if ((lp.find (
N_(
":monitor")) != string::npos) &&
533 (lp.find (lpn) != string::npos)) {
543 if (t != DataType::NIL) {
547 extra_system[t].push_back (p);
549 extra_other[t].push_back (p);
560 if (!extra_system[*i].
empty()) {
567 if (extra_other[*i].
empty())
continue;
569 std::vector<std::string> nb;
570 for (uint32_t j = 0; j < extra_other[*i].size(); ++j) {
571 std::string nn = extra_other[*i][j];
572 std::string pf = nn.substr (0, nn.find_first_of (
":") + 1);
573 if (pf != cp && !nb.empty()) {
579 nb.push_back(extra_other[*i][j]);
592 if (type != DataType::MIDI) {
609 b->
set_name (pre.substr (0, pre.length() - 1));
612 for (uint32_t j = 0; j < p.size(); ++j) {
613 std::string n = p[j].substr (pre.length());
614 std::string pn = AudioEngine::instance()->get_pretty_name_by_name (p[j]);
628 return n.substr (0, p.length()) == p;
635 if (p.empty() || p[0].find_first_of (s) == std::string::npos) {
640 std::string
const fp = p[0].substr (0, p[0].find_first_of (s) + 1);
644 while (j < p.size()) {
645 if (p[j].substr (0, fp.length()) != fp) {
690 for (PortGroupList::List::const_iterator i =
begin (); i !=
end (); ++i) {
691 std::copy ((*i)->bundles().begin(), (*i)->bundles().end(), std::back_inserter (
_bundles));
702 for (PortGroupList::List::const_iterator i =
begin(); i !=
end(); ++i) {
703 n += (*i)->total_channels ();
731 for (List::iterator i =
_groups.begin(); i !=
_groups.end(); ++i) {
732 (*i)->remove_bundle (b);
782 List::const_iterator i =
_groups.begin ();
PBD::Signal1< void, ARDOUR::Bundle::Change > BundleChanged
void set_port(uint32_t, std::string)
List::const_iterator begin() const
void remove_bundle(boost::shared_ptr< ARDOUR::Bundle >)
void gather(ARDOUR::Session *, ARDOUR::DataType, bool, bool, bool)
void add_bundle_internal(boost::shared_ptr< ARDOUR::Bundle >, boost::shared_ptr< ARDOUR::IO >, bool, Gdk::Color, bool)
PBD::ScopedConnectionList _changed_connections
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
boost::shared_ptr< ARDOUR::Bundle > make_bundle_from_ports(std::vector< std::string > const &, ARDOUR::DataType, bool) const
boost::shared_ptr< MidiPort > midi_clock_input_port() const
boost::shared_ptr< MidiPort > mtc_input_port() const
std::list< BundleRecord * > BundleList
std::list< ControlProtocolInfo * > control_protocol_info
bool operator()(RouteIOs const &a, RouteIOs const &b)
void emit_bundle_changed(ARDOUR::Bundle::Change)
PortGroup::BundleList _bundles
RouteIOs(boost::shared_ptr< Route > r, boost::shared_ptr< IO > i)
void add_group(boost::shared_ptr< PortGroup >)
virtual TimeAxisView * axis_view_from_route(boost::shared_ptr< ARDOUR::Route >) const =0
MIDI::Port * midi_output_port() const
boost::shared_ptr< Auditioner > the_auditioner()
boost::shared_ptr< ARDOUR::IO > io_from_bundle(boost::shared_ptr< ARDOUR::Bundle >) const
PBD::ScopedConnectionList _bundle_changed_connections
List::const_iterator end() const
std::string common_prefix_before(std::vector< std::string > const &, std::string const &) const
BundleList const & bundles() const
PBD::Signal0< void > Changed
boost::shared_ptr< IO > click_io()
uint32_t order_key() const
std::string common_prefix(std::vector< std::string > const &) const
void add_bundle(boost::shared_ptr< ARDOUR::Bundle >, bool allow_dups=false)
void maybe_add_processor_to_list(boost::weak_ptr< ARDOUR::Processor >, std::list< boost::shared_ptr< ARDOUR::IO > > *, bool, std::set< boost::shared_ptr< ARDOUR::IO > > &)
bool port_has_prefix(std::string const &, std::string const &) const
PortGroup::BundleList const & bundles() const
PBD::Signal0< void > Changed
boost::shared_ptr< ARDOUR::IO > io_from_bundle(boost::shared_ptr< ARDOUR::Bundle >) const
ARDOUR::ChanCount total_channels() const
ARDOUR::Bundle::Change _pending_bundle_change
boost::shared_ptr< BundleList > bundles()
PBD::Signal1< void, ARDOUR::Bundle::Change > BundleChanged
ARDOUR::ChanCount total_channels() const
boost::shared_ptr< RouteList > get_routes() const
void add_channel(std::string const &, DataType)
boost::shared_ptr< IO > input()
MIDI::Port * mmc_output_port() const
MIDI::Port * midi_input_port() const
void bundle_changed(ARDOUR::Bundle::Change)
std::list< boost::shared_ptr< IO > > ios
PortGroup(std::string const &n)
static PublicEditor & instance()
PBD::Signal1< void, Change > Changed
boost::shared_ptr< IO > output()
boost::shared_ptr< Route > route
PBD::ScopedConnection changed_connection
boost::shared_ptr< Port > ltc_output_port() const
boost::shared_ptr< ARDOUR::Bundle > only_bundle()
MIDI::Port * mmc_input_port() const
void set_name(std::string const &)
void add_group_if_not_empty(boost::shared_ptr< PortGroup >)
std::string make_port_name_non_relative(const std::string &name) const
BundleRecord(boost::shared_ptr< ARDOUR::Bundle >, boost::shared_ptr< ARDOUR::IO >, Gdk::Color, bool has_colour)
bool has_port(std::string const &) const
bool has_same_ports(boost::shared_ptr< Bundle >) const
std::string string_compose(const std::string &fmt, const T1 &o1)
boost::shared_ptr< MidiPort > midi_clock_output_port() const
boost::shared_ptr< MidiPort > mtc_output_port() const
boost::shared_ptr< Port > ltc_input_port() const
void remove_bundle(boost::shared_ptr< ARDOUR::Bundle >)