add copyright comments
[ardour.git] / libs / ardour / port_insert.cc
index 70f88e904f5c25996705aa00e774024baefe2988..c13927449ad9df8e68120c3552bfd66e3cb13297 100644 (file)
 
 #include <string>
 
-
-#include "pbd/failed_constructor.h"
 #include "pbd/xml++.h"
 
-#include "ardour/audioengine.h"
 #include "ardour/audio_port.h"
-#include "ardour/buffer_set.h"
+#include "ardour/audioengine.h"
 #include "ardour/delivery.h"
+#include "ardour/io.h"
 #include "ardour/mtdm.h"
-#include "ardour/plugin.h"
-#include "ardour/port.h"
 #include "ardour/port_insert.h"
-#include "ardour/route.h"
 #include "ardour/session.h"
 #include "ardour/types.h"
 
@@ -49,7 +44,7 @@ PortInsert::name_and_id_new_insert (Session& s, uint32_t& bitslot)
 }
 
 PortInsert::PortInsert (Session& s, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster> mm)
-       : IOProcessor (s, true, true, name_and_id_new_insert (s, _bitslot), "")
+       : IOProcessor (s, true, true, name_and_id_new_insert (s, _bitslot), "", DataType::AUDIO, true)
        , _out (new Delivery (s, _output, pannable, mm, _name, Delivery::Insert))
 {
         _mtdm = 0;
@@ -58,17 +53,6 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<Pannable> pannable, boost:
         _measured_latency = 0;
 }
 
-PortInsert::PortInsert (Session& s, const std::string& name, uint32_t bslot, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster> mm)
-       : IOProcessor (s, true, true, name, "")
-       , _out (new Delivery (s, _output, pannable, mm, _name, Delivery::Insert))
-       , _bitslot (bslot)
-{
-        _mtdm = 0;
-        _latency_detect = false;
-        _latency_flush_frames = false;
-        _measured_latency = 0;
-}
-
 PortInsert::~PortInsert ()
 {
         _session.unmark_insert_id (_bitslot);
@@ -78,11 +62,8 @@ PortInsert::~PortInsert ()
 void
 PortInsert::start_latency_detection ()
 {
-        if (_mtdm != 0) {
-                delete _mtdm;
-        }
-
-        _mtdm = new MTDM;
+       delete _mtdm;
+        _mtdm = new MTDM (_session.frame_rate());
         _latency_flush_frames = false;
         _latency_detect = true;
         _measured_latency = 0;
@@ -134,8 +115,9 @@ PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
                         Sample* out = outbuf.data();
 
                         _mtdm->process (nframes, in, out);
-
+                       
                         outbuf.set_is_silent (false);
+                        outbuf.set_written (true);
                 }
 
                 return;
@@ -315,15 +297,3 @@ PortInsert::deactivate ()
 
        _out->deactivate ();
 }
-
-/** Set up the XML description of a send so that we will not
- *  reset its name or bitslot during ::set_state()
- *  @param state XML insert state.
- */
-
-void
-PortInsert::make_unique (XMLNode &state)
-{
-       state.add_property ("ignore-bitslot", "1");
-       state.add_property ("ignore-name", "1");
-}