Exact beat - provide audio->music mapping for region split.
[ardour.git] / libs / ardour / ardour / bundle.h
index 39c58ed318111d8a4c27067d9403ec2a429ea077..ef2247f12b84338e609fa594f44e605853fac933 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <string>
 #include <vector>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
 #include <boost/shared_ptr.hpp>
 
 #include "pbd/signals.h"
@@ -40,7 +40,7 @@ class AudioEngine;
  *  `Channel' is a rather overloaded term but I can't think of a better
  *  one right now.
  */
-class Bundle : public PBD::ScopedConnectionList
+class LIBARDOUR_API Bundle : public PBD::ScopedConnectionList
 {
   public:
 
@@ -51,6 +51,10 @@ class Bundle : public PBD::ScopedConnectionList
 
        struct Channel {
                Channel (std::string n, DataType t) : name (n), type (t) {}
+               Channel (std::string n, DataType t, PortList p) : name (n), type (t), ports (p) {}
+               Channel (std::string n, DataType t, std::string const & p) : name (n), type (t) {
+                       ports.push_back (p);
+               }
 
                bool operator== (Channel const &o) const {
                        return name == o.name && type == o.type && ports == o.ports;
@@ -76,6 +80,8 @@ class Bundle : public PBD::ScopedConnectionList
        PortList const & channel_ports (uint32_t) const;
 
        void add_channel (std::string const &, DataType);
+       void add_channel (std::string const &, DataType, std::string const &);
+       void add_channel (std::string const &, DataType, PortList);
        std::string channel_name (uint32_t) const;
        DataType channel_type (uint32_t) const;
        void set_channel_name (uint32_t, std::string const &);
@@ -85,7 +91,7 @@ class Bundle : public PBD::ScopedConnectionList
        void remove_ports_from_channel (uint32_t);
        void remove_ports_from_channels ();
        bool port_attached_to_channel (uint32_t, std::string);
-       bool uses_port (std::string) const;
+       bool offers_port (std::string) const;
        bool offers_port_alone (std::string) const;
        void remove_channel (uint32_t);
        void remove_channels ();
@@ -93,7 +99,10 @@ class Bundle : public PBD::ScopedConnectionList
        void connect (boost::shared_ptr<Bundle>, AudioEngine &);
        void disconnect (boost::shared_ptr<Bundle>, AudioEngine &);
        bool connected_to (boost::shared_ptr<Bundle>, AudioEngine &);
+       bool connected_to_anything (AudioEngine &);
        bool has_same_ports (boost::shared_ptr<Bundle>) const;
+       uint32_t type_channel_to_overall (DataType, uint32_t) const;
+       uint32_t overall_channel_to_type (DataType, uint32_t) const;
 
        void set_name (std::string const &);
 
@@ -108,6 +117,8 @@ class Bundle : public PBD::ScopedConnectionList
        void suspend_signals ();
        void resume_signals ();
 
+       bool operator== (Bundle const & other);
+
        /** Things that might change about this bundle */
        enum Change {
                NameChanged = 0x1, ///< the bundle name or a channel name has changed
@@ -123,7 +134,7 @@ class Bundle : public PBD::ScopedConnectionList
 
        /// mutex for _channel_ports and _channel_names
        /// XXX: is this necessary?
-       mutable Glib::Mutex _channel_mutex;
+       mutable Glib::Threads::Mutex _channel_mutex;
        std::vector<Channel> _channel;
 
   private:
@@ -138,10 +149,9 @@ class Bundle : public PBD::ScopedConnectionList
        Change _pending_change;
 };
 
-
-
-struct BundleChannel
+class LIBARDOUR_API BundleChannel
 {
+public:
        BundleChannel () : channel (-1) {}
 
        BundleChannel (boost::shared_ptr<Bundle> b, int c)
@@ -161,4 +171,6 @@ struct BundleChannel
 
 }
 
+std::ostream & operator<< (std::ostream & o, ARDOUR::Bundle const &);
+
 #endif /* __ardour_bundle_h__ */