X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fbundle.h;h=369b12ec9ba68c02581026cfa2690df9769efc34;hb=2a6dcddcc513fa3ebc1aad4b2e5fede62277aba5;hp=1af7a3bad0e979bf07ae1fc0442317e9667ba7d3;hpb=dbb0b9ca4f82ea8e3829cfeb009b9746c3d6f0dc;p=ardour.git diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h index 1af7a3bad0..369b12ec9b 100644 --- a/libs/ardour/ardour/bundle.h +++ b/libs/ardour/ardour/bundle.h @@ -23,21 +23,24 @@ #include #include #include -#include #include + +#include "pbd/signals.h" + #include "ardour/data_type.h" +#include "ardour/chan_count.h" namespace ARDOUR { class AudioEngine; /** A set of `channels', each of which is associated with 0 or more ports. - * Each channel has a name which can be anything useful. + * Each channel has a name which can be anything useful, and a data type. * Intended for grouping things like, for example, a buss' outputs. * `Channel' is a rather overloaded term but I can't think of a better * one right now. */ -class Bundle : public sigc::trackable +class Bundle : public PBD::ScopedConnectionList { public: @@ -47,33 +50,40 @@ class Bundle : public sigc::trackable typedef std::vector PortList; struct Channel { - Channel (std::string n) : name (n) {} + 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 && ports == o.ports; + return name == o.name && type == o.type && ports == o.ports; } std::string name; + DataType type; PortList ports; }; Bundle (bool i = true); Bundle (std::string const &, bool i = true); - Bundle (std::string const &, DataType, bool i = true); Bundle (boost::shared_ptr); virtual ~Bundle() {} /** @return Number of channels that this Bundle has */ - uint32_t nchannels () const; + ChanCount nchannels () const; /** @param Channel index. * @return Ports associated with this channel. */ PortList const & channel_ports (uint32_t) const; - void add_channel (std::string 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 &); void add_port_to_channel (uint32_t, std::string); void set_port (uint32_t, std::string); @@ -81,7 +91,7 @@ class Bundle : public sigc::trackable 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 (); @@ -96,11 +106,6 @@ class Bundle : public sigc::trackable /** @return Bundle name */ std::string name () const { return _name; } - void set_type (DataType); - - /** @return Type of the ports in this Bundle. */ - DataType type () const { return _type; } - void set_ports_are_inputs (); void set_ports_are_outputs (); bool ports_are_inputs () const { return _ports_are_inputs; } @@ -118,7 +123,7 @@ class Bundle : public sigc::trackable DirectionChanged = 0x10 ///< the direction (whether ports are inputs or outputs) has changed }; - sigc::signal Changed; + PBD::Signal1 Changed; protected: @@ -133,7 +138,6 @@ class Bundle : public sigc::trackable void emit_changed (Change); std::string _name; - DataType _type; bool _ports_are_inputs; bool _signals_suspended; @@ -144,9 +148,9 @@ class Bundle : public sigc::trackable struct BundleChannel { - BundleChannel () : channel (0) {} + BundleChannel () : channel (-1) {} - BundleChannel (boost::shared_ptr b, uint32_t c) + BundleChannel (boost::shared_ptr b, int c) : bundle (b), channel (c) {} bool operator== (BundleChannel const& other) const { @@ -158,7 +162,7 @@ struct BundleChannel } boost::shared_ptr bundle; - uint32_t channel; + int channel; ///< channel index, or -1 for "all" }; }