do not crash when loading old history files with MIDI edits; add all notes in region...
[ardour.git] / libs / ardour / port.cc
index 676a6a0e4ff2e3ad0367e10edec25e786fd8220d..4b4f0a939ad5d55da3c66cfa7014b76800bd4ea4 100644 (file)
 
 */
 
+#ifdef WAF_BUILD
+#include "libardour-config.h"
+#endif
+
 #include "ardour/port.h"
 #include "ardour/audioengine.h"
-#include "ardour/i18n.h"
 #include "pbd/failed_constructor.h"
 #include "pbd/error.h"
 #include "pbd/compose.h"
 #include <stdexcept>
 
+#include "i18n.h"
+
 using namespace std;
 using namespace ARDOUR;
 
 AudioEngine* Port::_engine = 0;
+nframes_t Port::_port_offset = 0;
+nframes_t Port::_buffer_size = 0;
 
 /** @param n Port short name */
 Port::Port (std::string const & n, DataType t, Flags f)
@@ -207,6 +214,7 @@ Port::total_latency () const
 int
 Port::reestablish ()
 {
+       cerr << "RE-REGISTER: " << _name.c_str() << endl;
        _jack_port = jack_port_register (_engine->jack(), _name.c_str(), type().to_jack_type(), _flags, 0);
 
        if (_jack_port == 0) {
@@ -234,15 +242,18 @@ Port::reconnect ()
        return 0;
 }
 
-/** @param n Short name */
+/** @param n Short port name (no JACK client name) */
 int
 Port::set_name (std::string const & n)
 {
-       assert (_name.find_first_of (':') == std::string::npos);
+       if (n == _name) {
+               return 0;
+       }
 
        int const r = jack_port_set_name (_jack_port, n.c_str());
+
        if (r == 0) {
-               _name = n;
+               _name = n; 
        }
 
        return r;
@@ -259,3 +270,4 @@ Port::set_latency (nframes_t n)
 {
        jack_port_set_latency (_jack_port, n);
 }
+