Special-case VCA at 0 (-inf dB), force gain slaves to -inf dB
[ardour.git] / libs / ardour / ardour / io.h
index e318258e1928ac661779b23ab71674a63b740d75..ae3865168e8f28bc2f8a260600606ecbb6f8dd83 100644 (file)
 #include <string>
 #include <vector>
 #include <cmath>
-#include <jack/jack.h>
 
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
 
 #include "pbd/fastlog.h"
 #include "pbd/undo.h"
 #include "pbd/statefuldestructible.h"
 #include "pbd/controllable.h"
+#include "pbd/enum_convert.h"
 
 #include "ardour/ardour.h"
 #include "ardour/automation_control.h"
@@ -40,6 +40,7 @@
 #include "ardour/latent.h"
 #include "ardour/port_set.h"
 #include "ardour/session_object.h"
+#include "ardour/libardour_visibility.h"
 #include "ardour/types.h"
 #include "ardour/utils.h"
 #include "ardour/buffer_set.h"
@@ -64,7 +65,7 @@ class UserBundle;
  * An IO can contain ports of varying types, making routes/inserts/etc with
  * varied combinations of types (eg MIDI and audio) possible.
  */
-class IO : public SessionObject, public Latent
+class LIBARDOUR_API IO : public SessionObject, public Latent
 {
   public:
        static const std::string state_node_name;
@@ -74,8 +75,8 @@ class IO : public SessionObject, public Latent
                Output
        };
 
-       IO (Session&, const std::string& name, Direction, DataType default_type = DataType::AUDIO);
-       IO (Session&, const XMLNode&, DataType default_type = DataType::AUDIO);
+       IO (Session&, const std::string& name, Direction, DataType default_type = DataType::AUDIO, bool sendish = false);
+       IO (Session&, const XMLNode&, DataType default_type = DataType::AUDIO, bool sendish = false);
 
        virtual ~IO();
 
@@ -88,13 +89,15 @@ class IO : public SessionObject, public Latent
        void set_active(bool yn) { _active = yn; }
 
        bool set_name (const std::string& str);
+       void set_pretty_name (const std::string& str);
+       std::string pretty_name () const { return _pretty_name_prefix; }
 
        virtual void silence (framecnt_t);
        void increment_port_buffer_offset (pframes_t offset);
 
        int ensure_io (ChanCount cnt, bool clear, void *src);
 
-       int connect_ports_to_bundle (boost::shared_ptr<Bundle>, void *);
+       int connect_ports_to_bundle (boost::shared_ptr<Bundle>, bool exclusive, void *);
        int disconnect_ports_from_bundle (boost::shared_ptr<Bundle>, void *);
 
        BundleList bundles_connected ();
@@ -102,9 +105,9 @@ class IO : public SessionObject, public Latent
        boost::shared_ptr<Bundle> bundle () { return _bundle; }
 
        int add_port (std::string connection, void *src, DataType type = DataType::NIL);
-       int remove_port (Port *, void *src);
-       int connect (Port *our_port, std::string other_port, void *src);
-       int disconnect (Port *our_port, std::string other_port, void *src);
+       int remove_port (boost::shared_ptr<Port>, void *src);
+       int connect (boost::shared_ptr<Port> our_port, std::string other_port, void *src);
+       int disconnect (boost::shared_ptr<Port> our_port, std::string other_port, void *src);
        int disconnect (void *src);
        bool connected_to (boost::shared_ptr<const IO>) const;
        bool connected_to (const std::string&) const;
@@ -117,20 +120,20 @@ class IO : public SessionObject, public Latent
        PortSet& ports() { return _ports; }
        const PortSet& ports() const { return _ports; }
 
-       bool has_port (Port *) const;
+       bool has_port (boost::shared_ptr<Port>) const;
 
-       Port *nth (uint32_t n) const {
+       boost::shared_ptr<Port> nth (uint32_t n) const {
                if (n < _ports.num_ports()) {
                        return _ports.port(n);
                } else {
-                       return 0;
+                       return boost::shared_ptr<Port> ();
                }
        }
 
-       Port* port_by_name (const std::string& str) const;
+       boost::shared_ptr<Port> port_by_name (const std::string& str) const;
 
-       AudioPort* audio(uint32_t n) const;
-       MidiPort*  midi(uint32_t n) const;
+       boost::shared_ptr<AudioPort> audio(uint32_t n) const;
+       boost::shared_ptr<MidiPort>  midi(uint32_t n) const;
 
        const ChanCount& n_ports ()  const { return _ports.count(); }
 
@@ -144,6 +147,7 @@ class IO : public SessionObject, public Latent
        XMLNode& get_state (void);
        int set_state (const XMLNode&, int version);
        int set_state_2X (const XMLNode&, int, bool);
+       static void prepare_for_reset (XMLNode&, const std::string&);
 
        class BoolCombiner {
        public:
@@ -151,7 +155,7 @@ class IO : public SessionObject, public Latent
                typedef bool result_type;
 
                template <typename Iter>
-               bool operator() (Iter first, Iter last) const {
+               result_type operator() (Iter first, Iter last) const {
                        bool r = false;
                        while (first != last) {
                                if (*first) {
@@ -191,7 +195,7 @@ class IO : public SessionObject, public Latent
        /* three utility functions - this just seems to be simplest place to put them */
 
        void collect_input (BufferSet& bufs, pframes_t nframes, ChanCount offset);
-       void process_input (boost::shared_ptr<Processor>, framepos_t start_frame, framepos_t end_frame, pframes_t nframes);
+       void process_input (boost::shared_ptr<Processor>, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes);
        void copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, framecnt_t offset);
 
        /* AudioTrack::deprecated_use_diskstream_connections() needs these */
@@ -199,13 +203,14 @@ class IO : public SessionObject, public Latent
        int set_ports (const std::string& str);
 
   private:
-       mutable Glib::Mutex io_lock;
+       mutable Glib::Threads::Mutex io_lock;
 
   protected:
        PortSet   _ports;
        Direction _direction;
        DataType _default_type;
        bool     _active;
+       bool     _sendish;
 
   private:
        int connecting_became_legal ();
@@ -246,9 +251,16 @@ class IO : public SessionObject, public Latent
        void setup_bundle ();
        std::string bundle_channel_name (uint32_t, uint32_t, DataType) const;
 
+       void apply_pretty_name ();
+       std::string _pretty_name_prefix;
        BufferSet _buffers;
+       void disconnect_check (boost::shared_ptr<ARDOUR::Port>, boost::shared_ptr<ARDOUR::Port>);
 };
 
 } // namespace ARDOUR
 
+namespace PBD {
+       DEFINE_ENUM_CONVERT (ARDOUR::IO::Direction)
+}
+
 #endif /*__ardour_io_h__ */