summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-01-14 23:54:46 +0000
committerCarl Hetherington <carl@carlh.net>2009-01-14 23:54:46 +0000
commitbed58e9f372a6c2671e9f072c19a4c77d06c4292 (patch)
tree7e146669f680c6275f92687b8434fafef4689ded /libs
parentad9913538e903359de700432459f559794f2e80d (diff)
Make Bundles work a bit better. A few include optimisations.
git-svn-id: svn://localhost/ardour2/branches/3.0@4408 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/SConscript2
-rw-r--r--libs/ardour/ardour/auto_bundle.h4
-rw-r--r--libs/ardour/ardour/bundle.h82
-rw-r--r--libs/ardour/ardour/io.h23
-rw-r--r--libs/ardour/ardour/session.h3
-rw-r--r--libs/ardour/ardour/user_bundle.h28
-rw-r--r--libs/ardour/audioengine.cc3
-rw-r--r--libs/ardour/audiosource.cc1
-rw-r--r--libs/ardour/bundle.cc229
-rw-r--r--libs/ardour/io.cc101
-rw-r--r--libs/ardour/ladspa_plugin.cc1
-rw-r--r--libs/ardour/meter.cc2
-rw-r--r--libs/ardour/panner.cc1
-rw-r--r--libs/ardour/session.cc26
-rw-r--r--libs/ardour/session_state.cc2
-rw-r--r--libs/ardour/user_bundle.cc121
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.h2
17 files changed, 201 insertions, 430 deletions
diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript
index ac66d95b6f..58db70c6a6 100644
--- a/libs/ardour/SConscript
+++ b/libs/ardour/SConscript
@@ -48,7 +48,6 @@ audioregion.cc
audio_region_importer.cc
audiosource.cc
auditioner.cc
-auto_bundle.cc
automatable.cc
automation.cc
automation_control.cc
@@ -58,6 +57,7 @@ base_midi_port.cc
broadcast_info.cc
buffer.cc
buffer_set.cc
+bundle.cc
chan_count.cc
configuration.cc
control_protocol_manager.cc
diff --git a/libs/ardour/ardour/auto_bundle.h b/libs/ardour/ardour/auto_bundle.h
index 9df26a449b..e3899069de 100644
--- a/libs/ardour/ardour/auto_bundle.h
+++ b/libs/ardour/ardour/auto_bundle.h
@@ -39,10 +39,6 @@ class AutoBundle : public Bundle {
void set_port (uint32_t, std::string const &);
private:
- /// mutex for _ports;
- /// XXX: is this necessary?
- mutable Glib::Mutex _ports_mutex;
- std::vector<PortList> _ports;
};
}
diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h
index 46ba13152e..1b029dc2b4 100644
--- a/libs/ardour/ardour/bundle.h
+++ b/libs/ardour/ardour/bundle.h
@@ -22,42 +22,69 @@
#include <string>
#include <sigc++/signal.h>
-
#include "ardour/data_type.h"
-#include "ardour/chan_count.h"
namespace ARDOUR {
-
-typedef std::vector<std::string> PortList;
-/**
- * A set of `channels', each of which is associated with 0 or more JACK ports.
+/** A set of `channels', each of which is associated with 0 or more ports.
+ * 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 {
+class Bundle : public sigc::trackable {
public:
- Bundle () : _type (DataType::AUDIO) {}
- Bundle (bool i) : _type (DataType::AUDIO), _ports_are_inputs (i) {}
+
+ /// List of ports associated with a channel. We can't use a
+ /// PortSet because we might want to involve non-Ardour ports
+ /// (ie those without a Port object)
+ typedef std::vector<std::string> PortList;
+
+ /** Construct an audio bundle.
+ * @param i true if ports are inputs, otherwise false.
+ */
+ Bundle (bool i = true) : _type (DataType::AUDIO), _ports_are_inputs (i) {}
+
+ /** Construct an audio bundle.
+ * @param n Name.
+ * @param i true if ports are inputs, otherwise false.
+ */
Bundle (std::string const & n, bool i = true) : _name (n), _type (DataType::AUDIO), _ports_are_inputs (i) {}
virtual ~Bundle() {}
- /**
- * @return Number of channels that this Bundle has.
- */
- virtual ChanCount nchannels () const = 0;
- virtual const PortList& channel_ports (uint32_t) const = 0;
+ /** @return Number of channels that this Bundle has */
+ uint32_t nchannels () const;
+ /** @param Channel index.
+ * @return Ports associated with this channel.
+ */
+ PortList const & channel_ports (uint32_t) const;
+
+ void add_channel ();
+ void add_port_to_channel (uint32_t, std::string);
+ void set_port (uint32_t, std::string);
+ void remove_port_from_channel (uint32_t, std::string);
+ void set_nchannels (uint32_t);
+ bool port_attached_to_channel (uint32_t, std::string);
+ void remove_channel (uint32_t);
+
+ /** Set the name.
+ * @param n New name.
+ */
void set_name (std::string const & n) {
_name = n;
NameChanged ();
}
-
- std::string name () const { return _name; }
- sigc::signal<void> NameChanged;
+ /** @return Bundle name */
+ std::string name () const { return _name; }
+ /** Set the type of the ports in this Bundle.
+ * @param t New type.
+ */
void set_type (DataType t) { _type = t; }
+
+ /** @return Type of the ports in this Bundle. */
DataType type () const { return _type; }
void set_ports_are_inputs () { _ports_are_inputs = true; }
@@ -65,7 +92,26 @@ class Bundle {
bool ports_are_inputs () const { return _ports_are_inputs; }
bool ports_are_outputs () const { return !_ports_are_inputs; }
+ bool operator== (Bundle const &) const;
+
+ /** Emitted when the name changes */
+ sigc::signal<void> NameChanged;
+ /** The number of channels has changed */
+ sigc::signal<void> ConfigurationChanged;
+ /** The port list associated with one of our channels has changed */
+ sigc::signal<void, int> PortsChanged;
+
+ protected:
+
+ /// mutex for _ports;
+ /// XXX: is this necessary?
+ mutable Glib::Mutex _ports_mutex;
+ std::vector<PortList> _ports;
+
private:
+ int set_channels (std::string const &);
+ int parse_io_string (std::string const &, std::vector<std::string> &);
+
std::string _name;
ARDOUR::DataType _type;
bool _ports_are_inputs;
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 69473b5747..a738519d57 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -42,7 +42,6 @@
#include <ardour/chan_count.h>
#include <ardour/latent.h>
#include <ardour/automation_control.h>
-#include <ardour/user_bundle.h>
using std::string;
using std::vector;
@@ -54,7 +53,7 @@ namespace ARDOUR {
class Session;
class AudioEngine;
class Bundle;
-class AutoBundle;
+class UserBundle;
class Panner;
class PeakMeter;
class Port;
@@ -131,8 +130,8 @@ class IO : public SessionObject, public AutomatableControls, public Latent
std::vector<boost::shared_ptr<Bundle> > bundles_connected_to_inputs ();
std::vector<boost::shared_ptr<Bundle> > bundles_connected_to_outputs ();
- boost::shared_ptr<AutoBundle> bundle_for_inputs () { return _bundle_for_inputs; }
- boost::shared_ptr<AutoBundle> bundle_for_outputs () { return _bundle_for_outputs; }
+ boost::shared_ptr<Bundle> bundle_for_inputs () { return _bundle_for_inputs; }
+ boost::shared_ptr<Bundle> bundle_for_outputs () { return _bundle_for_outputs; }
int add_input_port (string source, void *src, DataType type = DataType::NIL);
int add_output_port (string destination, void *src, DataType type = DataType::NIL);
@@ -334,17 +333,15 @@ class IO : public SessionObject, public AutomatableControls, public Latent
ChanCount _output_minimum; ///< minimum number of output channels (0 for no minimum)
ChanCount _output_maximum; ///< maximum number of output channels (ChanCount::INFINITE for no maximum)
- boost::shared_ptr<AutoBundle> _bundle_for_inputs; ///< a bundle representing our inputs
- boost::shared_ptr<AutoBundle> _bundle_for_outputs; ///< a bundle representing our outputs
+ boost::shared_ptr<Bundle> _bundle_for_inputs; ///< a bundle representing our inputs
+ boost::shared_ptr<Bundle> _bundle_for_outputs; ///< a bundle representing our outputs
struct UserBundleInfo {
UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b);
boost::shared_ptr<UserBundle> bundle;
- sigc::connection configuration_will_change;
- sigc::connection configuration_has_changed;
- sigc::connection ports_will_change;
- sigc::connection ports_have_changed;
+ sigc::connection configuration_changed;
+ sigc::connection ports_changed;
};
std::vector<UserBundleInfo> _bundles_connected_to_outputs; ///< user bundles connected to our outputs
@@ -364,10 +361,8 @@ class IO : public SessionObject, public AutomatableControls, public Latent
void check_bundles_connected_to_outputs ();
void check_bundles (std::vector<UserBundleInfo>&, const PortSet&);
- void bundle_configuration_will_change ();
- void bundle_configuration_has_changed ();
- void bundle_ports_will_change (int);
- void bundle_ports_have_changed (int);
+ void bundle_configuration_changed ();
+ void bundle_ports_changed (int);
int create_ports (const XMLNode&);
int make_connections (const XMLNode&);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 8b45dad958..2c173a9766 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -53,7 +53,7 @@
#include <ardour/configuration.h>
#include <ardour/location.h>
#include <ardour/gain.h>
-#include <ardour/io.h>
+#include <ardour/chan_count.h>
#include <ardour/smpte.h>
@@ -80,6 +80,7 @@ class AuxInput;
class Source;
class AudioSource;
class BufferSet;
+class IO;
class Diskstream;
class AudioDiskstream;
diff --git a/libs/ardour/ardour/user_bundle.h b/libs/ardour/ardour/user_bundle.h
index c33ddeaed9..6d197450c3 100644
--- a/libs/ardour/ardour/user_bundle.h
+++ b/libs/ardour/ardour/user_bundle.h
@@ -35,36 +35,10 @@ class UserBundle : public Bundle, public PBD::Stateful {
UserBundle (std::string const &);
UserBundle (XMLNode const &, bool);
- ChanCount nchannels () const;
- const ARDOUR::PortList& channel_ports (uint32_t) const;
-
- void add_channel ();
- void set_channels (uint32_t);
- void remove_channel (uint32_t);
- void add_port_to_channel (uint32_t, std::string const &);
- void remove_port_from_channel (uint32_t, std::string const &);
- bool port_attached_to_channel (uint32_t, std::string const &) const;
XMLNode& get_state ();
-
- /// The number of channels is about to change
- sigc::signal<void> ConfigurationWillChange;
- /// The number of channels has changed
- sigc::signal<void> ConfigurationHasChanged;
- /// The port set associated with one of our channels is about to change
- /// Parameter is the channel number
- sigc::signal<void, int> PortsWillChange;
- /// The port set associated with one of our channels has changed
- /// Parameter is the channel number
- sigc::signal<void, int> PortsHaveChanged;
private:
-
- int set_state (const XMLNode &);
-
- /// mutex for _ports;
- /// XXX: is this necessary?
- mutable Glib::Mutex _ports_mutex;
- std::vector<PortList> _ports;
+ int set_state (XMLNode const &);
};
}
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 2c9ce67917..0c36db6b01 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -36,10 +36,13 @@
#include <ardour/port.h>
#include <ardour/jack_audio_port.h>
#include <ardour/jack_midi_port.h>
+#include <ardour/midi_port.h>
#include <ardour/audio_port.h>
#include <ardour/session.h>
#include <ardour/cycle_timer.h>
#include <ardour/utils.h>
+#include <ardour/event_type_map.h>
+#include <ardour/io.h>
#ifdef VST_SUPPORT
#include <fst.h>
#endif
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index b8366e0ac0..8d710b247a 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -41,6 +41,7 @@
#include <ardour/cycle_timer.h>
#include <ardour/session.h>
#include <ardour/transient_detector.h>
+#include <ardour/runtime_functions.h>
#include "i18n.h"
diff --git a/libs/ardour/bundle.cc b/libs/ardour/bundle.cc
index 0d8c36a84f..bdad9d364d 100644
--- a/libs/ardour/bundle.cc
+++ b/libs/ardour/bundle.cc
@@ -29,72 +29,53 @@
using namespace ARDOUR;
using namespace PBD;
-/** Construct a Bundle from an XML node.
- * @param node XML node.
- */
-Bundle::Bundle (const XMLNode& node)
+uint32_t
+Bundle::nchannels () const
{
- if (set_state (node)) {
- throw failed_constructor();
- }
+ Glib::Mutex::Lock lm (_ports_mutex);
+ return _ports.size ();
}
-/** Construct an InputBundle from an XML node.
- * @param node XML node.
- */
-InputBundle::InputBundle (const XMLNode& node)
- : Bundle (node)
+Bundle::PortList const &
+Bundle::channel_ports (uint32_t c) const
{
-
-}
+ assert (c < nchannels());
-/** Construct an OutputBundle from an XML node.
- * @param node XML node.
- */
-OutputBundle::OutputBundle (const XMLNode& node)
- : Bundle (node)
-{
-
+ Glib::Mutex::Lock lm (_ports_mutex);
+ return _ports[c];
}
-/** Set the name.
- * @param name New name.
+/** Add an association between one of our channels and a port.
+ * @param ch Channel index.
+ * @param portname port name to associate with.
*/
void
-Bundle::set_name (string name, void *src)
+Bundle::add_port_to_channel (uint32_t ch, string portname)
{
- _name = name;
- NameChanged (src);
-}
+ assert (ch < nchannels());
-/** Add an association between one of our channels and a JACK port.
- * @param ch Channel index.
- * @param portname JACK port name to associate with.
- */
-void
-Bundle::add_port_to_channel (int ch, string portname)
-{
{
- Glib::Mutex::Lock lm (channels_lock);
- _channels[ch].push_back (portname);
+ Glib::Mutex::Lock lm (_ports_mutex);
+ _ports[ch].push_back (portname);
}
PortsChanged (ch); /* EMIT SIGNAL */
}
-/** Disassociate a JACK port from one of our channels.
- * @param ch Channel index.
- * @param portname JACK port name to disassociate from.
+/** Disassociate a port from one of our channels.
+ * @param ch Channel index.
+ * @param portname port name to disassociate from.
*/
-
void
-Bundle::remove_port_from_channel (int ch, string portname)
+Bundle::remove_port_from_channel (uint32_t ch, string portname)
{
+ assert (ch < nchannels());
+
bool changed = false;
{
- Glib::Mutex::Lock lm (channels_lock);
- PortList& pl = _channels[ch];
+ Glib::Mutex::Lock lm (_ports_mutex);
+ PortList& pl = _ports[ch];
PortList::iterator i = find (pl.begin(), pl.end(), portname);
if (i != pl.end()) {
@@ -108,24 +89,13 @@ Bundle::remove_port_from_channel (int ch, string portname)
}
}
-/**
- * @param ch Channel index.
- * @return List of JACK ports that this channel is connected to.
- */
-const Bundle::PortList&
-Bundle::channel_ports (int ch) const
-{
- Glib::Mutex::Lock lm (channels_lock);
- return _channels[ch];
-}
-
/** operator== for Bundles; they are equal if their channels are the same.
* @param other Bundle to compare with this one.
*/
bool
Bundle::operator== (const Bundle& other) const
{
- return other._channels == _channels;
+ return other._ports == _ports;
}
@@ -134,149 +104,58 @@ Bundle::operator== (const Bundle& other) const
*/
void
-Bundle::set_nchannels (int n)
+Bundle::set_nchannels (uint32_t n)
{
{
- Glib::Mutex::Lock lm (channels_lock);
- _channels.clear ();
- for (int i = 0; i < n; ++i) {
- _channels.push_back (PortList());
+ Glib::Mutex::Lock lm (_ports_mutex);
+ _ports.clear ();
+ for (uint32_t i = 0; i < n; ++i) {
+ _ports.push_back (PortList());
}
}
ConfigurationChanged (); /* EMIT SIGNAL */
}
-XMLNode&
-Bundle::get_state ()
+void
+Bundle::set_port (uint32_t ch, string portname)
{
- XMLNode *node;
- string str;
-
- if (dynamic_cast<InputBundle *> (this)) {
- node = new XMLNode ("InputConnection");
- } else {
- node = new XMLNode ("OutputConnection");
- }
+ assert (ch < nchannels());
- node->add_property ("name", _name);
-
- for (vector<PortList>::iterator i = _channels.begin(); i != _channels.end(); ++i) {
-
- str += '{';
-
- for (vector<string>::iterator ii = (*i).begin(); ii != (*i).end(); ++ii) {
- if (ii != (*i).begin()) {
- str += ',';
- }
- str += *ii;
- }
- str += '}';
+ {
+ Glib::Mutex::Lock lm (_ports_mutex);
+ _ports[ch].clear ();
+ _ports[ch].push_back (portname);
}
- node->add_property ("connections", str);
-
- return *node;
+ PortsChanged (ch); /* EMIT SIGNAL */
}
-int
-Bundle::set_state (const XMLNode& node)
+void
+Bundle::add_channel ()
{
- const XMLProperty *prop;
-
- if ((prop = node.property ("name")) == 0) {
- error << _("Node for Connection has no \"name\" property") << endmsg;
- return -1;
- }
-
- _name = prop->value();
- _dynamic = false;
-
- if ((prop = node.property ("connections")) == 0) {
- error << _("Node for Connection has no \"connections\" property") << endmsg;
- return -1;
+ {
+ Glib::Mutex::Lock lm (_ports_mutex);
+ _ports.push_back (PortList ());
}
-
- set_channels (prop->value());
- return 0;
+ ConfigurationChanged (); /* EMIT SIGNAL */
}
-/** Set up channels from an XML property string.
- * @param str String.
- * @return 0 on success, -1 on error.
- */
-int
-Bundle::set_channels (const string& str)
+bool
+Bundle::port_attached_to_channel (uint32_t ch, std::string portname)
{
- vector<string> ports;
- int i;
- int n;
- int nchannels;
+ assert (ch < nchannels());
- if ((nchannels = count (str.begin(), str.end(), '{')) == 0) {
- return 0;
- }
-
- set_nchannels (nchannels);
-
- string::size_type start, end, ostart;
-
- ostart = 0;
- start = 0;
- end = 0;
- i = 0;
-
- while ((start = str.find_first_of ('{', ostart)) != string::npos) {
- start += 1;
-
- if ((end = str.find_first_of ('}', start)) == string::npos) {
- error << string_compose(_("IO: badly formed string in XML node for inputs \"%1\""), str) << endmsg;
- return -1;
- }
-
- if ((n = parse_io_string (str.substr (start, end - start), ports)) < 0) {
- error << string_compose(_("bad input string in XML node \"%1\""), str) << endmsg;
-
- return -1;
-
- } else if (n > 0) {
-
- for (int x = 0; x < n; ++x) {
- add_port_to_channel (i, ports[x]);
- }
- }
-
- ostart = end+1;
- i++;
- }
-
- return 0;
+ Glib::Mutex::Lock lm (_ports_mutex);
+ return (std::find (_ports[ch].begin (), _ports[ch].end (), portname) != _ports[ch].end ());
}
-int
-Bundle::parse_io_string (const string& str, vector<string>& ports)
+void
+Bundle::remove_channel (uint32_t ch)
{
- string::size_type pos, opos;
-
- if (str.length() == 0) {
- return 0;
- }
+ assert (ch < nchannels ());
- pos = 0;
- opos = 0;
-
- ports.clear ();
-
- while ((pos = str.find_first_of (',', opos)) != string::npos) {
- ports.push_back (str.substr (opos, pos - opos));
- opos = pos + 1;
- }
-
- if (opos < str.length()) {
- ports.push_back (str.substr(opos));
- }
-
- return ports.size();
+ Glib::Mutex::Lock lm (_ports_mutex);
+ _ports.erase (_ports.begin () + ch);
}
-
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 66023f1f4d..ed1064f0e8 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -37,13 +37,13 @@
#include <ardour/port.h>
#include <ardour/audio_port.h>
#include <ardour/midi_port.h>
-#include <ardour/auto_bundle.h>
#include <ardour/session.h>
#include <ardour/cycle_timer.h>
#include <ardour/panner.h>
#include <ardour/buffer_set.h>
#include <ardour/meter.h>
#include <ardour/amp.h>
+#include <ardour/user_bundle.h>
#include "i18n.h"
@@ -360,18 +360,17 @@ IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports)
for (std::vector<UserBundleInfo>::iterator i = list.begin(); i != list.end(); ++i) {
- ChanCount const N = i->bundle->nchannels ();
+ uint32_t const N = i->bundle->nchannels ();
- if (ports.num_ports (default_type()) < N.get (default_type())) {
+ if (ports.num_ports (default_type()) < N) {
continue;
}
bool ok = true;
- uint32_t n = N.get (default_type());
- for (uint32_t j = 0; j < n; ++j) {
+ for (uint32_t j = 0; j < N; ++j) {
/* Every port on bundle channel j must be connected to our input j */
- PortList const pl = i->bundle->channel_ports (j);
+ Bundle::PortList const pl = i->bundle->channel_ports (j);
for (uint32_t k = 0; k < pl.size(); ++k) {
if (ports.port(j)->connected_to (pl[k]) == false) {
ok = false;
@@ -387,10 +386,8 @@ IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports)
if (ok) {
new_list.push_back (*i);
} else {
- i->configuration_will_change.disconnect ();
- i->configuration_has_changed.disconnect ();
- i->ports_will_change.disconnect ();
- i->ports_have_changed.disconnect ();
+ i->configuration_changed.disconnect ();
+ i->ports_changed.disconnect ();
}
}
@@ -1681,8 +1678,8 @@ int
IO::create_ports (const XMLNode& node)
{
XMLProperty const * prop;
- ChanCount num_inputs;
- ChanCount num_outputs;
+ uint32_t num_inputs = 0;
+ uint32_t num_outputs = 0;
if ((prop = node.property ("input-connection")) != 0) {
@@ -1696,7 +1693,7 @@ IO::create_ports (const XMLNode& node)
} else if ((prop = node.property ("inputs")) != 0) {
- num_inputs.set (default_type(), count (prop->value().begin(), prop->value().end(), '{'));
+ num_inputs = count (prop->value().begin(), prop->value().end(), '{');
}
if ((prop = node.property ("output-connection")) != 0) {
@@ -1711,12 +1708,15 @@ IO::create_ports (const XMLNode& node)
} else if ((prop = node.property ("outputs")) != 0) {
- num_outputs.set (default_type(), count (prop->value().begin(), prop->value().end(), '{'));
+ num_outputs = count (prop->value().begin(), prop->value().end(), '{');
}
no_panner_reset = true;
- if (ensure_io (num_inputs, num_outputs, true, this)) {
+ if (ensure_io (ChanCount (_default_type, num_inputs),
+ ChanCount (_default_type, num_outputs),
+ true, this)) {
+
error << string_compose(_("%1: cannot create I/O ports"), _name) << endmsg;
return -1;
}
@@ -2065,13 +2065,12 @@ IO::connect_input_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
/* Connect to the bundle, not worrying about any connections
that are already made. */
- ChanCount const channels = c->nchannels ();
- uint32_t cnt = channels.get (default_type());
+ uint32_t cnt = c->nchannels ();
for (uint32_t n = 0; n < cnt; ++n) {
- const PortList& pl = c->channel_ports (n);
+ const Bundle::PortList& pl = c->channel_ports (n);
- for (PortList::const_iterator i = pl.begin(); i != pl.end(); ++i) {
+ for (Bundle::PortList::const_iterator i = pl.begin(); i != pl.end(); ++i) {
if (!_inputs.port(n)->connected_to (*i)) {
@@ -2115,14 +2114,13 @@ IO::connect_output_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
/* Connect to the bundle, not worrying about any connections
that are already made. */
- ChanCount const channels = c->nchannels ();
- uint32_t cnt = channels.get (default_type());
+ uint32_t cnt = c->nchannels ();
for (uint32_t n = 0; n < cnt; ++n) {
- const PortList& pl = c->channel_ports (n);
+ const Bundle::PortList& pl = c->channel_ports (n);
- for (PortList::const_iterator i = pl.begin(); i != pl.end(); ++i) {
+ for (Bundle::PortList::const_iterator i = pl.begin(); i != pl.end(); ++i) {
if (!_outputs.port(n)->connected_to (*i)) {
@@ -2199,28 +2197,14 @@ IO::reset_panners ()
}
void
-IO::bundle_configuration_will_change ()
-{
- //XXX
-// connect_input_ports_to_bundle (_input_bundle, this);
-}
-
-void
-IO::bundle_configuration_has_changed ()
+IO::bundle_configuration_changed ()
{
//XXX
// connect_input_ports_to_bundle (_input_bundle, this);
}
void
-IO::bundle_ports_will_change (int ignored)
-{
-//XXX
-// connect_output_ports_to_bundle (_output_bundle, this);
-}
-
-void
-IO::bundle_ports_have_changed (int ignored)
+IO::bundle_ports_changed (int ignored)
{
//XXX
// connect_output_ports_to_bundle (_output_bundle, this);
@@ -2611,7 +2595,7 @@ IO::setup_bundles_for_inputs_and_outputs ()
snprintf(buf, sizeof (buf), _("%s in"), _name.c_str());
_bundle_for_inputs->set_name (buf);
uint32_t const ni = inputs().num_ports();
- _bundle_for_inputs->set_channels (ni);
+ _bundle_for_inputs->set_nchannels (ni);
for (uint32_t i = 0; i < ni; ++i) {
_bundle_for_inputs->set_port (i, inputs().port(i)->name());
}
@@ -2619,7 +2603,7 @@ IO::setup_bundles_for_inputs_and_outputs ()
snprintf(buf, sizeof (buf), _("%s out"), _name.c_str());
_bundle_for_outputs->set_name (buf);
uint32_t const no = outputs().num_ports();
- _bundle_for_outputs->set_channels (no);
+ _bundle_for_outputs->set_nchannels (no);
for (uint32_t i = 0; i < no; ++i) {
_bundle_for_outputs->set_port (i, outputs().port(i)->name());
}
@@ -2633,8 +2617,8 @@ IO::setup_bundles_for_inputs_and_outputs ()
void
IO::create_bundles_for_inputs_and_outputs ()
{
- _bundle_for_inputs = boost::shared_ptr<AutoBundle> (new AutoBundle (true));
- _bundle_for_outputs = boost::shared_ptr<AutoBundle> (new AutoBundle (false));
+ _bundle_for_inputs = boost::shared_ptr<Bundle> (new Bundle (true));
+ _bundle_for_outputs = boost::shared_ptr<Bundle> (new Bundle (false));
setup_bundles_for_inputs_and_outputs ();
}
@@ -2645,19 +2629,17 @@ IO::create_bundles_for_inputs_and_outputs ()
void
IO::maybe_add_input_bundle_to_list (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> >* bundles)
{
- boost::shared_ptr<AutoBundle> ab = boost::dynamic_pointer_cast<AutoBundle, Bundle> (b);
-
- if (ab == 0 || ab->ports_are_outputs() == false) {
+ if (b->ports_are_outputs() == false) {
return;
}
- if (ab->nchannels().get (default_type()) != n_inputs().n_total ()) {
+ if (b->nchannels() != n_inputs().n_total ()) {
return;
}
for (uint32_t i = 0; i < n_inputs().n_total (); ++i) {
- PortList const & pl = b->channel_ports (i);
+ Bundle::PortList const & pl = b->channel_ports (i);
if (pl.empty()) {
return;
@@ -2682,7 +2664,7 @@ IO::bundles_connected_to_inputs ()
bundles.push_back (i->bundle);
}
- /* Auto bundles */
+ /* Normal bundles */
_session.foreach_bundle (
sigc::bind (sigc::mem_fun (*this, &IO::maybe_add_input_bundle_to_list), &bundles)
);
@@ -2698,18 +2680,17 @@ IO::bundles_connected_to_inputs ()
void
IO::maybe_add_output_bundle_to_list (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> >* bundles)
{
- boost::shared_ptr<AutoBundle> ab = boost::dynamic_pointer_cast<AutoBundle, Bundle> (b);
- if (ab == 0 || ab->ports_are_inputs() == false) {
+ if (b->ports_are_inputs() == false) {
return;
}
- if (ab->nchannels ().get (default_type()) != n_outputs().n_total ()) {
+ if (b->nchannels () != n_outputs().n_total ()) {
return;
}
for (uint32_t i = 0; i < n_outputs().n_total (); ++i) {
- PortList const & pl = b->channel_ports (i);
+ Bundle::PortList const & pl = b->channel_ports (i);
if (pl.empty()) {
return;
@@ -2747,17 +2728,11 @@ IO::bundles_connected_to_outputs ()
IO::UserBundleInfo::UserBundleInfo (IO* io, boost::shared_ptr<UserBundle> b)
{
bundle = b;
- configuration_will_change = b->ConfigurationWillChange.connect (
- sigc::mem_fun (*io, &IO::bundle_configuration_will_change)
- );
- configuration_has_changed = b->ConfigurationHasChanged.connect (
- sigc::mem_fun (*io, &IO::bundle_configuration_has_changed)
- );
- ports_will_change = b->PortsWillChange.connect (
- sigc::mem_fun (*io, &IO::bundle_ports_will_change)
+ configuration_changed = b->ConfigurationChanged.connect (
+ sigc::mem_fun (*io, &IO::bundle_configuration_changed)
);
- ports_have_changed = b->PortsHaveChanged.connect (
- sigc::mem_fun (*io, &IO::bundle_ports_have_changed)
+ ports_changed = b->PortsChanged.connect (
+ sigc::mem_fun (*io, &IO::bundle_ports_changed)
);
}
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 07bb5ceada..ea8b431481 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -43,6 +43,7 @@
#include <ardour/audioengine.h>
#include <ardour/ladspa_plugin.h>
#include <ardour/buffer_set.h>
+#include <ardour/audio_buffer.h>
#include <pbd/stl_delete.h>
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index 5b3b2e5f9e..ebfefeee36 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -23,6 +23,8 @@
#include <ardour/peak.h>
#include <ardour/dB.h>
#include <ardour/session.h>
+#include <ardour/audio_buffer.h>
+#include <ardour/midi_buffer.h>
namespace ARDOUR {
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 65034aa212..c5e28321bf 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -40,6 +40,7 @@
#include <ardour/session.h>
#include <ardour/panner.h>
#include <ardour/utils.h>
+#include <ardour/audio_buffer.h>
#include <ardour/runtime_functions.h>
#include <ardour/buffer_set.h>
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 8efef136d1..67ea01b8bf 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -64,7 +64,6 @@
#include <ardour/processor.h>
#include <ardour/plugin_insert.h>
#include <ardour/port_insert.h>
-#include <ardour/auto_bundle.h>
#include <ardour/slave.h>
#include <ardour/tempo.h>
#include <ardour/audio_track.h>
@@ -82,6 +81,7 @@
#include <ardour/session_directory.h>
#include <ardour/tape_file_matcher.h>
#include <ardour/analyser.h>
+#include <ardour/bundle.h>
#ifdef HAVE_LIBLO
#include <ardour/osc.h>
@@ -601,8 +601,8 @@ Session::when_engine_running ()
char buf[32];
snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1);
- shared_ptr<AutoBundle> c (new AutoBundle (buf, true));
- c->set_channels (1);
+ shared_ptr<Bundle> c (new Bundle (buf, true));
+ c->set_nchannels (1);
c->set_port (0, _engine.get_nth_physical_output (DataType::AUDIO, np));
add_bundle (c);
@@ -612,8 +612,8 @@ Session::when_engine_running ()
char buf[32];
snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1);
- shared_ptr<AutoBundle> c (new AutoBundle (buf, false));
- c->set_channels (1);
+ shared_ptr<Bundle> c (new Bundle (buf, false));
+ c->set_nchannels (1);
c->set_port (0, _engine.get_nth_physical_input (DataType::AUDIO, np));
add_bundle (c);
@@ -625,8 +625,8 @@ Session::when_engine_running ()
char buf[32];
snprintf (buf, sizeof (buf), _("out %" PRIu32 "+%" PRIu32), np+1, np+2);
- shared_ptr<AutoBundle> c (new AutoBundle (buf, true));
- c->set_channels (2);
+ shared_ptr<Bundle> c (new Bundle (buf, true));
+ c->set_nchannels (2);
c->set_port (0, _engine.get_nth_physical_output (DataType::AUDIO, np));
c->set_port (1, _engine.get_nth_physical_output (DataType::AUDIO, np + 1));
@@ -637,8 +637,8 @@ Session::when_engine_running ()
char buf[32];
snprintf (buf, sizeof (buf), _("in %" PRIu32 "+%" PRIu32), np+1, np+2);
- shared_ptr<AutoBundle> c (new AutoBundle (buf, false));
- c->set_channels (2);
+ shared_ptr<Bundle> c (new Bundle (buf, false));
+ c->set_nchannels (2);
c->set_port (0, _engine.get_nth_physical_input (DataType::AUDIO, np));
c->set_port (1, _engine.get_nth_physical_input (DataType::AUDIO, np + 1));
@@ -686,14 +686,6 @@ Session::when_engine_running ()
_master_out->allow_pan_reset ();
}
-
- shared_ptr<AutoBundle> c (new AutoBundle (_("Master Out"), true));
-
- c->set_channels (_master_out->n_inputs().n_total());
- for (uint32_t n = 0; n < _master_out->n_inputs ().n_total(); ++n) {
- c->set_port (n, _master_out->input(n)->name());
- }
- add_bundle (c);
}
BootMessage (_("Setup signal flow and plugins"));
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0fcd1c95a9..6c6ce18c8b 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -81,7 +81,7 @@
#include <ardour/io_processor.h>
#include <ardour/send.h>
#include <ardour/processor.h>
-#include <ardour/bundle.h>
+#include <ardour/user_bundle.h>
#include <ardour/slave.h>
#include <ardour/tempo.h>
#include <ardour/audio_track.h>
diff --git a/libs/ardour/user_bundle.cc b/libs/ardour/user_bundle.cc
index b9d115bc40..d53bf8b155 100644
--- a/libs/ardour/user_bundle.cc
+++ b/libs/ardour/user_bundle.cc
@@ -23,105 +23,6 @@ ARDOUR::UserBundle::UserBundle (XMLNode const & x, bool i)
}
}
-ARDOUR::ChanCount
-ARDOUR::UserBundle::nchannels () const
-{
- Glib::Mutex::Lock lm (_ports_mutex);
- return ChanCount (type(), _ports.size ());
-}
-
-const ARDOUR::PortList&
-ARDOUR::UserBundle::channel_ports (uint32_t n) const
-{
- assert (n < nchannels ().get (type()));
-
- Glib::Mutex::Lock lm (_ports_mutex);
- return _ports[n];
-}
-
-void
-ARDOUR::UserBundle::add_port_to_channel (uint32_t c, std::string const & p)
-{
- assert (c < nchannels ().get (type()));
-
- PortsWillChange (c);
-
- {
- Glib::Mutex::Lock lm (_ports_mutex);
- _ports[c].push_back (p);
- }
-
- PortsHaveChanged (c);
-}
-
-void
-ARDOUR::UserBundle::remove_port_from_channel (uint32_t c, std::string const & p)
-{
- assert (c < nchannels ().get (type()));
-
- PortsWillChange (c);
-
- {
- Glib::Mutex::Lock lm (_ports_mutex);
- PortList::iterator i = std::find (_ports[c].begin(), _ports[c].end(), p);
- if (i != _ports[c].end()) {
- _ports[c].erase (i);
- }
- }
-
- PortsHaveChanged (c);
-}
-
-bool
-ARDOUR::UserBundle::port_attached_to_channel (uint32_t c, std::string const & p) const
-{
- assert (c < nchannels ().get (type()));
-
- Glib::Mutex::Lock lm (_ports_mutex);
- return std::find (_ports[c].begin(), _ports[c].end(), p) != _ports[c].end();
-}
-
-void
-ARDOUR::UserBundle::add_channel ()
-{
- ConfigurationWillChange ();
-
- {
- Glib::Mutex::Lock lm (_ports_mutex);
- _ports.resize (_ports.size() + 1);
- }
-
- ConfigurationHasChanged ();
-}
-
-void
-ARDOUR::UserBundle::set_channels (uint32_t n)
-{
- ConfigurationWillChange ();
-
- {
- Glib::Mutex::Lock lm (_ports_mutex);
- _ports.resize (n);
- }
-
- ConfigurationHasChanged ();
-}
-
-void
-ARDOUR::UserBundle::remove_channel (uint32_t r)
-{
- assert (r < nchannels ().get (type()));
-
- ConfigurationWillChange ();
-
- {
- Glib::Mutex::Lock lm (_ports_mutex);
- _ports.erase (_ports.begin() + r, _ports.begin() + r + 1);
- }
-
- ConfigurationHasChanged ();
-}
-
int
ARDOUR::UserBundle::set_state (XMLNode const & node)
{
@@ -181,17 +82,21 @@ ARDOUR::UserBundle::get_state ()
node->add_property ("name", name ());
- for (std::vector<PortList>::iterator i = _ports.begin(); i != _ports.end(); ++i) {
-
- XMLNode* c = new XMLNode ("Channel");
+ {
+ Glib::Mutex::Lock lm (_ports_mutex);
- for (PortList::iterator j = i->begin(); j != i->end(); ++j) {
- XMLNode* p = new XMLNode ("Port");
- p->add_property ("name", *j);
- c->add_child_nocopy (*p);
+ for (std::vector<PortList>::iterator i = _ports.begin(); i != _ports.end(); ++i) {
+
+ XMLNode* c = new XMLNode ("Channel");
+
+ for (PortList::iterator j = i->begin(); j != i->end(); ++j) {
+ XMLNode* p = new XMLNode ("Port");
+ p->add_property ("name", *j);
+ c->add_child_nocopy (*p);
+ }
+
+ node->add_child_nocopy (*c);
}
-
- node->add_child_nocopy (*c);
}
return *node;
diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h
index 4e4a76f977..7d726e70ee 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.h
+++ b/libs/surfaces/mackie/mackie_control_protocol.h
@@ -319,7 +319,7 @@ class MackieControlProtocol
static const char * default_port_name;
/// The Midi port(s) connected to the units
- typedef vector<Mackie::MackiePort*> MackiePorts;
+ typedef std::vector<Mackie::MackiePort*> MackiePorts;
MackiePorts _ports;
/// Sometimes the real port goes away, and we want to contain the breakage