a-fluidsynth: implement LV2_BANKPATCH__notify
[ardour.git] / gtk2_ardour / port_group.cc
index 084514363a3bd90ff0d5af2b51f5fb66be9fa942..63291498e12d1d868b5876bcb6cff1ce2b7b8935 100644 (file)
@@ -351,11 +351,11 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
 
        for (RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
 
-                /* we never show the monitor bus inputs */
+               /* we never show the monitor bus inputs */
 
-                if (inputs && (*i)->is_monitor()) {
-                        continue;
-                }
+               if (inputs && (*i)->is_monitor()) {
+                       continue;
+               }
 
                /* keep track of IOs that we have taken bundles from,
                   so that we can avoid taking the same IO from both
@@ -378,7 +378,7 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
        /* Now put the bundles that belong to these sorted RouteIOs into the PortGroup. */
 
        for (list<RouteIOs>::iterator i = route_ios.begin(); i != route_ios.end(); ++i) {
-               TimeAxisView* tv = PublicEditor::instance().axis_view_from_stripable (i->route);
+               TimeAxisView* tv = PublicEditor::instance().time_axis_view_from_stripable (i->route);
 
                /* Work out which group to put these IOs' bundles in */
                boost::shared_ptr<PortGroup> g;
@@ -473,9 +473,6 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
                        sync->add_channel (
                                _("MTC in"), DataType::MIDI, ae->make_port_name_non_relative (session->mtc_input_port()->name())
                                );
-                       sync->add_channel (
-                               _("MIDI control in"), DataType::MIDI, ae->make_port_name_non_relative (session->midi_input_port()->name())
-                               );
                        sync->add_channel (
                                _("MIDI clock in"), DataType::MIDI, ae->make_port_name_non_relative (session->midi_clock_input_port()->name())
                                );
@@ -486,9 +483,6 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
                        sync->add_channel (
                                _("MTC out"), DataType::MIDI, ae->make_port_name_non_relative (session->mtc_output_port()->name())
                                );
-                       sync->add_channel (
-                               _("MIDI control out"), DataType::MIDI, ae->make_port_name_non_relative (session->midi_output_port()->name())
-                               );
                        sync->add_channel (
                                _("MIDI clock out"), DataType::MIDI, ae->make_port_name_non_relative (session->midi_clock_output_port()->name())
                                );
@@ -506,10 +500,10 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
        std::vector<std::string> extra_program[DataType::num_types];
        std::vector<std::string> extra_other[DataType::num_types];
 
-        string lpn (PROGRAM_NAME);
-        boost::to_lower (lpn);
-        string lpnc = lpn;
-        lpnc += ':';
+       string lpn (PROGRAM_NAME);
+       boost::to_lower (lpn);
+       string lpnc = lpn;
+       lpnc += ':';
 
        vector<string> ports;
        if (type == DataType::NIL) {
@@ -535,28 +529,31 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
                            !program->has_port(p) &&
                            !other->has_port(p)) {
 
-                                /* special hack: ignore MIDI ports labelled Midi-Through. these
-                                   are basically useless and mess things up for default
-                                   connections.
-                                */
+                               /* special hack: ignore MIDI ports labelled Midi-Through. these
+                                  are basically useless and mess things up for default
+                                  connections.
+                               */
 
-                                if (p.find ("Midi-Through") != string::npos) {
-                                        ++s;
-                                        continue;
-                                }
+                               if (p.find ("Midi-Through") != string::npos || p.find ("Midi Through") != string::npos) {
+                                       ++s;
+                                       continue;
+                               }
+
+                               /* special hack: ignore our monitor inputs (which show up here because
+                                  we excluded them earlier.
+                               */
 
-                                /* special hack: ignore our monitor inputs (which show up here because
-                                   we excluded them earlier.
-                                */
+                               string lp = p;
+                               string monitor = _("Monitor");
 
-                                string lp = p;
-                                boost::to_lower (lp);
+                               boost::to_lower (lp);
+                               boost::to_lower (monitor);
 
-                                if ((lp.find (N_(":monitor")) != string::npos) &&
-                                    (lp.find (lpn) != string::npos)) {
-                                        ++s;
-                                        continue;
-                                }
+                               if ((lp.find (monitor) != string::npos) &&
+                                   (lp.find (lpn) != string::npos)) {
+                                       ++s;
+                                       continue;
+                               }
 
                                /* can't use the audio engine for this as we
                                 * are looking at ports not owned by the
@@ -565,25 +562,35 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
                                 */
 
                                PortEngine::PortHandle ph = AudioEngine::instance()->port_engine().get_port_by_name (p);
-                               if (ph) {
-                                       DataType t (AudioEngine::instance()->port_engine().port_data_type (ph));
-                                       if (t != DataType::NIL) {
-                                               if (port_has_prefix (p, N_("system:")) ||
-                                                   port_has_prefix (p, N_("alsa_pcm:")) ||
-                                                   port_has_prefix (p, N_("alsa_midi:"))) {
-                                                       extra_system[t].push_back (p);
-                                               } else if (port_has_prefix (p, lpnc)) {
-                                                       /* Hide scene ports from non-Tracks Live builds */
-                                                       if (!ARDOUR::Profile->get_trx()) {
-                                                               if (p.find (_("Scene ")) != string::npos) {
-                                                                       ++s;
-                                                                       continue;
-                                                               }
+
+                               if (!ph) {
+                                       continue;
+                               }
+
+                               DataType t (AudioEngine::instance()->port_engine().port_data_type (ph));
+
+                               if (t != DataType::NIL) {
+
+                                       if (port_has_prefix (p, X_("system:")) ||
+                                           port_has_prefix (p, X_("alsa_pcm:")) ||
+                                           port_has_prefix (p, X_("alsa_midi:"))) {
+                                               extra_system[t].push_back (p);
+
+                                       } else if (port_has_prefix (p, lpnc)) {
+
+                                               /* we own this port (named after the program) */
+
+                                               /* Hide scene ports from non-Tracks Live builds */
+                                               if (!ARDOUR::Profile->get_trx()) {
+                                                       if (p.find (_("Scene ")) != string::npos) {
+                                                               ++s;
+                                                               continue;
                                                        }
-                                                       extra_program[t].push_back (p);
-                                               } else {
-                                                       extra_other[t].push_back (p);
                                                }
+
+                                               extra_program[t].push_back (p);
+                                       } else {
+                                               extra_other[t].push_back (p);
                                        }
                                }
                        }
@@ -601,9 +608,8 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
 
        for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
                if (!extra_program[*i].empty()) {
-                       /* remove program name prefix from port name and use rest as bundle name */
-                       std::string bundle_name = extra_program[*i].front().substr (lpnc.length());
-                       boost::shared_ptr<Bundle> b = make_bundle_from_ports (extra_program[*i], *i, inputs, bundle_name);
+                       /* used program name as bundle name */
+                       boost::shared_ptr<Bundle> b = make_bundle_from_ports (extra_program[*i], *i, inputs, lpn);
                        program->add_bundle (b);
                }
        }