Merged with trunk R846
[ardour.git] / libs / ardour / ardour / audioengine.h
index 50bf7dddcceb2b68eb35df0d63d135608ed56f56..db814bbb5fce39f93a09047eda03149a23d5b4d8 100644 (file)
 
 #include <glibmm/thread.h>
 
+#include <pbd/rcu.h>
+
 #include <ardour/ardour.h>
 #include <jack/jack.h>
 #include <jack/transport.h>
+#include <ardour/types.h>
+#include <ardour/data_type.h>
 
 namespace ARDOUR {
 
@@ -104,34 +108,35 @@ class AudioEngine : public sigc::trackable
                virtual const char *what() const throw() { return "could not connect to engine backend"; }
        };
 
-       Port *register_audio_input_port (const std::string& portname);
-       Port *register_audio_output_port (const std::string& portname);
-       int   unregister_port (Port *);
+       Port *register_input_port (DataType type, const std::string& portname);
+       Port *register_output_port (DataType type, const std::string& portname);
+       int   unregister_port (Port &);
        
        int connect (const std::string& source, const std::string& destination);
        int disconnect (const std::string& source, const std::string& destination);
-       int disconnect (Port *);
+       int disconnect (Port &);
        
        const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags);
 
        uint32_t n_physical_outputs () const;
        uint32_t n_physical_inputs () const;
 
-       std::string get_nth_physical_output (uint32_t n) {
-               return get_nth_physical (n, JackPortIsInput);
+       void get_physical_outputs (std::vector<std::string>&);
+       void get_physical_inputs (std::vector<std::string>&);
+
+       std::string get_nth_physical_output (DataType type, uint32_t n) {
+               return get_nth_physical (type, n, JackPortIsInput);
        }
 
-       std::string get_nth_physical_input (uint32_t n) {
-               return get_nth_physical (n, JackPortIsOutput);
+       std::string get_nth_physical_input (DataType type, uint32_t n) {
+               return get_nth_physical (type, n, JackPortIsOutput);
        }
 
        jack_nframes_t get_port_total_latency (const Port&);
        void update_total_latencies ();
 
-       /* the caller may not delete the object pointed to by 
-          the return value
+       /** Caller may not delete the object pointed to by the return value
        */
-
        Port *get_port_by_name (const std::string& name, bool keep = true);
 
        enum TransportState {
@@ -187,7 +192,6 @@ class AudioEngine : public sigc::trackable
        ARDOUR::Session      *session;
        jack_client_t       *_jack;
        std::string           jack_client_name;
-       Glib::Mutex           port_lock;
        Glib::Mutex           _process_lock;
        Glib::Mutex           session_remove_lock;
     Glib::Cond            session_removed;
@@ -206,7 +210,7 @@ class AudioEngine : public sigc::trackable
        int                  _usecs_per_cycle;
 
        typedef std::set<Port*> Ports;
-       Ports ports;
+       SerializedRCUManager<Ports> ports;
 
        int    process_callback (jack_nframes_t nframes);
        void   remove_all_ports ();
@@ -215,9 +219,9 @@ class AudioEngine : public sigc::trackable
        typedef std::list<PortConnection> PortConnections;
 
        PortConnections port_connections;
-       void   remove_connections_for (Port*);
+       void   remove_connections_for (Port&);
 
-       std::string get_nth_physical (uint32_t which, int flags);
+       std::string get_nth_physical (DataType type, uint32_t n, int flags);
 
        static int  _xrun_callback (void *arg);
        static int  _graph_order_callback (void *arg);
@@ -243,6 +247,6 @@ class AudioEngine : public sigc::trackable
     mutable gint     m_meter_exit;
 };
 
-}; /* namespace ARDOUR */
+} // namespace ARDOUR
 
 #endif /* __ardour_audioengine_h__ */