Merge branch 'master' into windows
[ardour.git] / gtk2_ardour / port_group.cc
index 863c29f2437af8abd70f0a306db0e128c0819777..531a5cf2c4b8e42e2c4bd6ca9030003091af5afb 100644 (file)
 #include "midi++/manager.h"
 #include "midi++/mmc.h"
 
-#include "ardour/audio_track.h"
 #include "ardour/audioengine.h"
+#include "ardour/auditioner.h"
 #include "ardour/bundle.h"
-#include "ardour/user_bundle.h"
+#include "ardour/control_protocol_manager.h"
 #include "ardour/io_processor.h"
-#include "ardour/midi_track.h"
-#include "ardour/port.h"
 #include "ardour/session.h"
-#include "ardour/auditioner.h"
-#include "ardour/control_protocol_manager.h"
+#include "ardour/user_bundle.h"
+#include "ardour/port.h"
 #include "control_protocol/control_protocol.h"
 
 #include "gui_thread.h"
@@ -315,7 +313,7 @@ struct RouteIOs {
 class RouteIOsComparator {
 public:
        bool operator() (RouteIOs const & a, RouteIOs const & b) {
-               return a.route->order_key (X_("editor")) < b.route->order_key (X_("editor"));
+               return a.route->order_key (EditorSort) < b.route->order_key (EditorSort);
        }
 };
 
@@ -425,6 +423,17 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
        if (!inputs) {
                ardour->add_bundle (session->the_auditioner()->output()->bundle());
                ardour->add_bundle (session->click_io()->bundle());
+               /* Note: the LTC ports do not have the usual ":audio_out 1" postfix, so
+                *  ardour->add_bundle (session->ltc_output_io()->bundle());
+                *  won't work
+                */
+               boost::shared_ptr<Bundle> ltc (new Bundle (_("LTC Out"), inputs));
+               ltc->add_channel (_("LTC Out"), DataType::AUDIO, session->engine().make_port_name_non_relative (session->ltc_output_port()->name()));
+               ardour->add_bundle (ltc);
+       } else {
+               boost::shared_ptr<Bundle> ltc (new Bundle (_("LTC In"), inputs));
+               ltc->add_channel (_("LTC In"), DataType::AUDIO, session->engine().make_port_name_non_relative (session->ltc_input_port()->name()));
+               ardour->add_bundle (ltc);
        }
 
        /* Ardour's surfaces */
@@ -448,6 +457,7 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
                boost::shared_ptr<Bundle> sync (new Bundle (_("Sync"), inputs));
                MIDI::MachineControl* mmc = midi_manager->mmc ();
                AudioEngine& ae = session->engine ();
+
                if (inputs) {
                        sync->add_channel (
                                _("MTC in"), DataType::MIDI, ae.make_port_name_non_relative (midi_manager->mtc_input_port()->name())
@@ -564,8 +574,22 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
        }
 
        for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
-               if (!extra_other[*i].empty()) {
-                       boost::shared_ptr<Bundle> b = make_bundle_from_ports (extra_other[*i], *i, inputs);
+               if (extra_other[*i].empty()) continue;
+               std::string cp;
+               std::vector<std::string> nb;
+               for (uint32_t j = 0; j < extra_other[*i].size(); ++j) {
+                       std::string nn = extra_other[*i][j];
+                       std::string pf = nn.substr (0, nn.find_first_of (":") + 1);
+                       if (pf != cp && !nb.empty()) {
+                               boost::shared_ptr<Bundle> b = make_bundle_from_ports (nb, *i, inputs);
+                               other->add_bundle (b);
+                               nb.clear();
+                       }
+                       cp = pf;
+                       nb.push_back(extra_other[*i][j]);
+               }
+               if (!nb.empty()) {
+                       boost::shared_ptr<Bundle> b = make_bundle_from_ports (nb, *i, inputs);
                        other->add_bundle (b);
                }
        }