return c;
}
+uint32_t
+Bundle::n_total () const
+{
+ /* Simpler and far more efficient than nchannels.n_total() */
+ return _channel.size();
+}
+
Bundle::PortList const &
Bundle::channel_ports (uint32_t c) const
{
- assert (c < nchannels().n_total());
+ assert (c < n_total());
Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[c].ports;
void
Bundle::add_port_to_channel (uint32_t ch, string portname)
{
- assert (ch < nchannels().n_total());
+ assert (ch < n_total());
assert (portname.find_first_of (':') != string::npos);
{
void
Bundle::remove_port_from_channel (uint32_t ch, string portname)
{
- assert (ch < nchannels().n_total());
+ assert (ch < n_total());
bool changed = false;
void
Bundle::set_port (uint32_t ch, string portname)
{
- assert (ch < nchannels().n_total());
+ assert (ch < n_total());
assert (portname.find_first_of (':') != string::npos);
{
bool
Bundle::port_attached_to_channel (uint32_t ch, std::string portname)
{
- assert (ch < nchannels().n_total());
+ assert (ch < n_total());
Glib::Threads::Mutex::Lock lm (_channel_mutex);
return (std::find (_channel[ch].ports.begin (), _channel[ch].ports.end (), portname) != _channel[ch].ports.end ());
void
Bundle::remove_channel (uint32_t ch)
{
- assert (ch < nchannels().n_total());
+ assert (ch < n_total());
Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.erase (_channel.begin () + ch);
std::string
Bundle::channel_name (uint32_t ch) const
{
- assert (ch < nchannels().n_total());
+ assert (ch < n_total());
Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[ch].name;
void
Bundle::set_channel_name (uint32_t ch, std::string const & n)
{
- assert (ch < nchannels().n_total());
+ assert (ch < n_total());
{
Glib::Threads::Mutex::Lock lm (_channel_mutex);
void
Bundle::add_channels_from_bundle (boost::shared_ptr<Bundle> other)
{
- uint32_t const ch = nchannels().n_total();
+ uint32_t const ch = n_total();
- for (uint32_t i = 0; i < other->nchannels().n_total(); ++i) {
+ for (uint32_t i = 0; i < other->n_total(); ++i) {
std::stringstream s;
s << other->name() << " " << other->channel_name(i);
void
Bundle::connect (boost::shared_ptr<Bundle> other, AudioEngine & engine)
{
- uint32_t const N = nchannels().n_total();
- assert (N == other->nchannels().n_total());
+ uint32_t const N = n_total();
+ assert (N == other->n_total());
for (uint32_t i = 0; i < N; ++i) {
Bundle::PortList const & our_ports = channel_ports (i);
void
Bundle::disconnect (boost::shared_ptr<Bundle> other, AudioEngine & engine)
{
- uint32_t const N = nchannels().n_total();
- assert (N == other->nchannels().n_total());
+ uint32_t const N = n_total();
+ assert (N == other->n_total());
for (uint32_t i = 0; i < N; ++i) {
Bundle::PortList const & our_ports = channel_ports (i);
{
{
Glib::Threads::Mutex::Lock lm (_channel_mutex);
- for (uint32_t c = 0; c < _channel.size(); ++c) {
+ for (uint32_t c = 0; c < n_total(); ++c) {
_channel[c].ports.clear ();
}
void
Bundle::remove_ports_from_channel (uint32_t ch)
{
- assert (ch < nchannels().n_total());
+ assert (ch < n_total());
{
Glib::Threads::Mutex::Lock lm (_channel_mutex);
return false;
}
- for (uint32_t i = 0; i < nchannels().n_total(); ++i) {
+ for (uint32_t i = 0; i < n_total(); ++i) {
Bundle::PortList const & A = channel_ports (i);
Bundle::PortList const & B = other->channel_ports (i);
{
PortManager& pm (engine);
- for (uint32_t i = 0; i < nchannels().n_total(); ++i) {
+ for (uint32_t i = 0; i < n_total(); ++i) {
Bundle::PortList const & ports = channel_ports (i);
for (uint32_t j = 0; j < ports.size(); ++j) {
bool
Bundle::has_same_ports (boost::shared_ptr<Bundle> b) const
{
- uint32_t const N = nchannels().n_total();
+ uint32_t const N = n_total();
- if (b->nchannels().n_total() != N) {
+ if (b->n_total() != N) {
return false;
}
DataType
Bundle::channel_type (uint32_t c) const
{
- assert (c < nchannels().n_total());
+ assert (c < n_total());
Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[c].type;
operator<< (ostream& os, Bundle const & b)
{
os << "BUNDLE " << b.nchannels() << " channels: ";
- for (uint32_t i = 0; i < b.nchannels().n_total(); ++i) {
+ for (uint32_t i = 0; i < b.n_total(); ++i) {
os << "( ";
Bundle::PortList const & pl = b.channel_ports (i);
for (Bundle::PortList::const_iterator j = pl.begin(); j != pl.end(); ++j) {