more work on RID and editor/mixer order matching; when a track/bus is hidden in the...
[ardour.git] / libs / ardour / io.cc
index 93ab043308d1c4b89ddef72a1eae82de25c7e5f0..01a4a64a389554e35da4f721b2f3c4497eb94a27 100644 (file)
 
 #include "ardour/audioengine.h"
 #include "ardour/buffer.h"
+#include "ardour/buffer_set.h"
 #include "ardour/debug.h"
 #include "ardour/io.h"
-#include "ardour/route.h"
 #include "ardour/port.h"
-#include "ardour/audio_port.h"
-#include "ardour/midi_port.h"
+#include "ardour/route.h"
 #include "ardour/session.h"
-#include "ardour/cycle_timer.h"
-#include "ardour/buffer_set.h"
-#include "ardour/meter.h"
-#include "ardour/amp.h"
 #include "ardour/user_bundle.h"
 
 #include "i18n.h"
@@ -63,10 +58,11 @@ PBD::Signal1<void,ChanCount> IO::PortCountChanged;
 /** @param default_type The type of port that will be created by ensure_io
  * and friends if no type is explicitly requested (to avoid breakage).
  */
-IO::IO (Session& s, const string& name, Direction dir, DataType default_type)
+IO::IO (Session& s, const string& name, Direction dir, DataType default_type, bool sendish)
        : SessionObject (s, name)
        , _direction (dir)
        , _default_type (default_type)
+       , _sendish (sendish)
 {
        _active = true;
        Port::PostDisconnect.connect_same_thread (*this, boost::bind (&IO::disconnect_check, this, _1, _2));
@@ -74,10 +70,11 @@ IO::IO (Session& s, const string& name, Direction dir, DataType default_type)
        setup_bundle ();
 }
 
-IO::IO (Session& s, const XMLNode& node, DataType dt)
+IO::IO (Session& s, const XMLNode& node, DataType dt, bool sendish)
        : SessionObject(s, "unnamed io")
        , _direction (Input)
        , _default_type (dt)
+       , _sendish (sendish)
 {
        _active = true;
        pending_state_node = 0;
@@ -256,8 +253,8 @@ IO::remove_port (boost::shared_ptr<Port> port, void* src)
        ChanCount after = before;
        after.set (port->type(), after.get (port->type()) - 1);
 
-       bool const r = PortCountChanging (after); /* EMIT SIGNAL */
-       if (r) {
+       boost::optional<bool> const r = PortCountChanging (after); /* EMIT SIGNAL */
+       if (r.get_value_or (false)) {
                return -1;
        }
 
@@ -614,8 +611,6 @@ IO::set_state (const XMLNode& node, int version)
                return -1;
        }
 
-       cerr << "IO::set state, connecting legal ? " << connecting_legal << endl;
-
        if (connecting_legal) {
 
                if (make_connections (node, version, false)) {
@@ -1354,10 +1349,18 @@ IO::build_legal_port_name (DataType type)
           use the (new) translated name.
        */
 
-       if (_direction == Input) {
-               suffix += X_("_in");
+       if (_sendish) {
+               if (_direction == Input) {
+                       suffix += X_("_return");
+               } else {
+                       suffix += X_("_send");
+               }
        } else {
-               suffix += X_("_out");
+               if (_direction == Input) {
+                       suffix += X_("_in");
+               } else {
+                       suffix += X_("_out");
+               }
        }
 
        // allow up to 4 digits for the output port number, plus the slash, suffix and extra space