use XML state to store processors in mixer (strips) and fixup crash caused by missing...
[ardour.git] / libs / ardour / ardour / processor.h
index 7d126e8e0c60f0ce25ab398ec22b39880b92364b..bf9dfe0430945a1f80c3f3e740a3181b74daf8f2 100644 (file)
@@ -33,7 +33,7 @@
 #include <ardour/plugin_state.h>
 #include <ardour/buffer_set.h>
 #include <ardour/automatable.h>
-
+#include <ardour/latent.h>
 
 class XMLNode;
 
@@ -43,7 +43,7 @@ class Session;
 
 /* A mixer strip element - plugin, send, meter, etc.
  */
-class Processor : public Automatable
+class Processor : public Automatable, public Latent
 {
   public:
        static const string state_node_name;
@@ -66,13 +66,16 @@ class Processor : public Automatable
        bool get_next_ab_is_active () const { return _next_ab_is_active; }
        void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; }
        
-       virtual nframes_t latency() { return 0; }
+       virtual nframes_t signal_latency() const { return 0; }
        
        virtual void transport_stopped (nframes_t frame) {}
        
        virtual void set_block_size (nframes_t nframes) {}
 
-       virtual void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) = 0;
+       virtual void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { assert(is_in_place()); }
+       
+       virtual void run_out_of_place (BufferSet& input, BufferSet& output, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { assert(is_out_of_place()); }
+       
        virtual void silence (nframes_t nframes, nframes_t offset) {}
        
        virtual void activate () { _active = true; ActiveChanged.emit(); }
@@ -80,7 +83,15 @@ class Processor : public Automatable
        
        virtual bool configure_io (ChanCount in, ChanCount out) { _configured_input = in; return (_configured = true); }
 
-       /* Act as a pass through, if not overridden */
+       /* Derived classes should override these, or processor appears as an in-place pass-through */
+
+       /** In-place processors implement run_in_place and modify thee input buffer parameter */
+       virtual bool is_in_place () const { return true; }
+
+       /* Out-Of-Place processors implement run_out_of_place, don't modify the input parameter
+        * and write to their output parameter */
+       virtual bool is_out_of_place () const { return false; }
+
        virtual bool      can_support_input_configuration (ChanCount in) const { return true; }
        virtual ChanCount output_for_input_configuration (ChanCount in) const { return in; }
        virtual ChanCount output_streams() const { return _configured_input; }