diff options
author | Carl Hetherington <carl@carlh.net> | 2007-05-18 15:58:01 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2007-05-18 15:58:01 +0000 |
commit | fd6408e6baf9094d73a4b6c1b5b24455b11124b2 (patch) | |
tree | adf52058c24df24b161116608778eda8e23c1e54 | |
parent | 452daa63710c9e13d8fb47573a2525c5e58ef9f5 (diff) |
Rename ARDOUR::Connection to ARDOUR::Bundle, a few minor cleanups along the way.
git-svn-id: svn://localhost/ardour2/trunk@1882 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 48 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.h | 10 | ||||
-rw-r--r-- | gtk2_ardour/redirect_box.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/redirect_box.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_params_ui.cc | 2 | ||||
-rw-r--r-- | libs/ardour/SConscript | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/bundle.h | 131 | ||||
-rw-r--r-- | libs/ardour/ardour/connection.h | 93 | ||||
-rw-r--r-- | libs/ardour/ardour/io.h | 34 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 26 | ||||
-rw-r--r-- | libs/ardour/ardour/session_bundle.h (renamed from libs/ardour/ardour/session_connection.h) | 14 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 12 | ||||
-rw-r--r-- | libs/ardour/bundle.cc (renamed from libs/ardour/connection.cc) | 148 | ||||
-rw-r--r-- | libs/ardour/io.cc | 177 | ||||
-rw-r--r-- | libs/ardour/session.cc | 88 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 16 | ||||
-rw-r--r-- | libs/ardour/track.cc | 1 |
17 files changed, 422 insertions, 384 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 1a21464bf5..9225fa6b12 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -42,8 +42,8 @@ #include <ardour/send.h> #include <ardour/insert.h> #include <ardour/ladspa_plugin.h> -#include <ardour/connection.h> -#include <ardour/session_connection.h> +#include <ardour/bundle.h> +#include <ardour/session_bundle.h> #include "ardour_ui.h" #include "ardour_dialog.h" @@ -506,7 +506,7 @@ MixerStrip::output_press (GdkEventButton *ev) citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output))); citems.push_back (SeparatorElem()); - _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu); + _session.foreach_bundle (this, &MixerStrip::add_bundle_to_output_menu); output_menu.popup (1, ev->time); break; @@ -568,7 +568,7 @@ MixerStrip::input_press (GdkEventButton *ev) citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input))); citems.push_back (SeparatorElem()); - _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu); + _session.foreach_bundle (this, &MixerStrip::add_bundle_to_input_menu); input_menu.popup (1, ev->time); break; @@ -580,53 +580,53 @@ MixerStrip::input_press (GdkEventButton *ev) } void -MixerStrip::connection_input_chosen (ARDOUR::Connection *c) +MixerStrip::bundle_input_chosen (ARDOUR::Bundle *c) { if (!ignore_toggle) { try { - _route->use_input_connection (*c, this); + _route->use_input_bundle (*c, this); } catch (AudioEngine::PortRegistrationFailure& err) { - error << _("could not register new ports required for that connection") + error << _("could not register new ports required for that bundle") << endmsg; } } } void -MixerStrip::connection_output_chosen (ARDOUR::Connection *c) +MixerStrip::bundle_output_chosen (ARDOUR::Bundle *c) { if (!ignore_toggle) { try { - _route->use_output_connection (*c, this); + _route->use_output_bundle (*c, this); } catch (AudioEngine::PortRegistrationFailure& err) { - error << _("could not register new ports required for that connection") + error << _("could not register new ports required for that bundle") << endmsg; } } } void -MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c) +MixerStrip::add_bundle_to_input_menu (ARDOUR::Bundle* c) { using namespace Menu_Helpers; - if (dynamic_cast<InputConnection *> (c) == 0) { + if (dynamic_cast<InputBundle *> (c) == 0) { return; } MenuList& citems = input_menu.items(); - if (c->nports() == _route->n_inputs().get_total()) { + if (c->nchannels() == _route->n_inputs().get_total()) { - citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c))); + citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), c))); - ARDOUR::Connection *current = _route->input_connection(); + ARDOUR::Bundle *current = _route->input_bundle(); if (current == c) { ignore_toggle = true; @@ -637,20 +637,20 @@ MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c) } void -MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c) +MixerStrip::add_bundle_to_output_menu (ARDOUR::Bundle* c) { using namespace Menu_Helpers; - if (dynamic_cast<OutputConnection *> (c) == 0) { + if (dynamic_cast<OutputBundle *> (c) == 0) { return; } - if (c->nports() == _route->n_outputs().get_total()) { + if (c->nchannels() == _route->n_outputs().get_total()) { MenuList& citems = output_menu.items(); - citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c))); + citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), c))); - ARDOUR::Connection *current = _route->output_connection(); + ARDOUR::Bundle *current = _route->output_bundle(); if (current == c) { ignore_toggle = true; @@ -705,9 +705,9 @@ MixerStrip::connect_to_pan () void MixerStrip::update_input_display () { - ARDOUR::Connection *c; + ARDOUR::Bundle *c; - if ((c = _route->input_connection()) != 0) { + if ((c = _route->input_bundle()) != 0) { input_label.set_text (c->name()); } else { switch (_width) { @@ -725,9 +725,9 @@ MixerStrip::update_input_display () void MixerStrip::update_output_display () { - ARDOUR::Connection *c; + ARDOUR::Bundle *c; - if ((c = _route->output_connection()) != 0) { + if ((c = _route->output_bundle()) != 0) { output_label.set_text (c->name()); } else { switch (_width) { diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 7e92f83579..02a78575ad 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -69,7 +69,7 @@ namespace ARDOUR { class Insert; class Session; class PortInsert; - class Connection; + class Bundle; class Plugin; } namespace Gtk { @@ -168,13 +168,13 @@ class MixerStrip : public RouteUI, public Gtk::EventBox gint output_press (GdkEventButton *); Gtk::Menu input_menu; - void add_connection_to_input_menu (ARDOUR::Connection *); + void add_bundle_to_input_menu (ARDOUR::Bundle *); Gtk::Menu output_menu; - void add_connection_to_output_menu (ARDOUR::Connection *); + void add_bundle_to_output_menu (ARDOUR::Bundle *); - void connection_input_chosen (ARDOUR::Connection *); - void connection_output_chosen (ARDOUR::Connection *); + void bundle_input_chosen (ARDOUR::Bundle *); + void bundle_output_chosen (ARDOUR::Bundle *); void edit_input_configuration (); void edit_output_configuration (); diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 96e99e4667..99d7b9735d 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -45,8 +45,6 @@ #include <ardour/send.h> #include <ardour/insert.h> #include <ardour/ladspa_plugin.h> -#include <ardour/connection.h> -#include <ardour/session_connection.h> #include "ardour_ui.h" #include "ardour_dialog.h" diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h index 88fbd5924d..089542b041 100644 --- a/gtk2_ardour/redirect_box.h +++ b/gtk2_ardour/redirect_box.h @@ -52,7 +52,7 @@ class PluginUIWindow; class RouteRedirectSelection; namespace ARDOUR { - class Connection; + class Bundle; class Insert; class Plugin; class PluginInsert; diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index b5655f0cc9..03e0f2ca03 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -35,8 +35,6 @@ #include <ardour/audio_track.h> #include <ardour/send.h> #include <ardour/insert.h> -#include <ardour/connection.h> -#include <ardour/session_connection.h> #include "route_params_ui.h" #include "keyboard.h" diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript index dba845f218..d33aaa852f 100644 --- a/libs/ardour/SConscript +++ b/libs/ardour/SConscript @@ -27,6 +27,7 @@ ardour.Append(POTFILE = domain + '.pot') ardour.Append(CPPPATH = '#libs/surfaces/control_protocol') ardour_files=Split(""" +bundle.cc chan_count.cc diskstream.cc directory_names.cc @@ -61,7 +62,6 @@ auditioner.cc automation.cc automation_event.cc configuration.cc -connection.cc control_protocol_manager.cc crossfade.cc curve.cc diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h new file mode 100644 index 0000000000..69b8fe1d10 --- /dev/null +++ b/libs/ardour/ardour/bundle.h @@ -0,0 +1,131 @@ +/* + Copyright (C) 2002 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_bundle_h__ +#define __ardour_bundle_h__ + +#include <vector> +#include <string> +#include <sigc++/signal.h> +#include <glibmm/thread.h> +#include <pbd/stateful.h> + +using std::vector; +using std::string; + +namespace ARDOUR { + +/** + * A set of `channels', each of which is associated with 0 or more + * JACK ports. + */ + +class Bundle : public Stateful, public sigc::trackable { + public: + /** + * Bundle constructor. + * @param name Name for this Bundle. + * @param dy true if this Bundle is `dynamic', ie it is created on-the-fly + * and should not be written to the session file. + */ + Bundle (string name, bool dy = false) : _name (name), _dynamic(dy) {} + ~Bundle() {} + + /// A vector of JACK port names + typedef vector<string> PortList; + + void set_name (string name, void *src); + + /** + * @return name of this Bundle. + */ + string name() const { return _name; } + + /** + * @return true if this Bundle is marked as `dynamic', meaning + * that it won't be written to the session file. + */ + bool dynamic() const { return _dynamic; } + + /** + * @return Number of channels that this Bundle has. + */ + uint32_t nchannels () const { return _channels.size(); } + const PortList& channel_ports (int ch) const; + + void set_nchannels (int n); + + void add_port_to_channel (int ch, string portname); + void remove_port_from_channel (int ch, string portname); + + /// Our name changed + sigc::signal<void, void*> NameChanged; + /// The number of channels changed + sigc::signal<void> ConfigurationChanged; + /// The ports associated with one of our channels changed + sigc::signal<void, int> PortsChanged; + + bool operator==(const Bundle& other) const; + + XMLNode& get_state (void); + int set_state (const XMLNode&); + + protected: + Bundle (const XMLNode&); + + private: + mutable Glib::Mutex channels_lock; ///< mutex for _channels + vector<PortList> _channels; ///< list of JACK ports associated with each of our channels + string _name; ///< name + bool _dynamic; ///< true if `dynamic', ie not to be written to the session file + + int set_channels (const string& str); + int parse_io_string (const string& str, vector<string>& ports); +}; + +/** + * Bundle in which the JACK ports are inputs. + */ + +class InputBundle : public Bundle { + public: + /** + * InputBundle constructor. + * \param name Name. + * \param dy true if this Bundle is `dynamic'; ie it is created on-the-fly + * and should not be written to the session file. + */ + InputBundle (string name, bool dy = false) : Bundle (name, dy) {} + InputBundle (const XMLNode&); +}; + +/** + * Bundle in which the JACK ports are outputs. + */ + +class OutputBundle : public Bundle { + public: + OutputBundle (string name, bool dy = false) : Bundle (name, dy) {} + OutputBundle (const XMLNode&); +}; + +} + +#endif /* __ardour_bundle_h__ */ + diff --git a/libs/ardour/ardour/connection.h b/libs/ardour/ardour/connection.h deleted file mode 100644 index d2f1cb4294..0000000000 --- a/libs/ardour/ardour/connection.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2002 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_connection_h__ -#define __ardour_connection_h__ - -#include <vector> -#include <string> -#include <sigc++/signal.h> -#include <glibmm/thread.h> -#include <pbd/stateful.h> - -using std::vector; -using std::string; - -namespace ARDOUR { - -class Connection : public Stateful, public sigc::trackable { - public: - Connection (string name, bool sdep = false) : _name (name), _sysdep(sdep) {} - ~Connection() {} - - typedef vector<string> PortList; - - void set_name (string name, void *src); - string name() const { return _name; } - - bool system_dependent() const { return _sysdep; } - - uint32_t nports () const { return _ports.size(); } - const PortList& port_connections (int port) const; - - void add_connection (int port, string portname); - void remove_connection (int port, string portname); - - void add_port (); - void remove_port (int port); - void clear (); - - sigc::signal<void,void*> NameChanged; - sigc::signal<void> ConfigurationChanged; - sigc::signal<void,int> ConnectionsChanged; - - bool operator==(const Connection& other) const; - - XMLNode& get_state (void); - int set_state (const XMLNode&); - - protected: - Connection (const XMLNode&); - - private: - mutable Glib::Mutex port_lock; - vector<PortList> _ports; - string _name; - bool _sysdep; - - int set_connections (const string& str); - int parse_io_string (const string& str, vector<string>& ports); -}; - -class InputConnection : public Connection { - public: - InputConnection (string name, bool sdep = false) : Connection (name, sdep) {} - InputConnection (const XMLNode&); -}; - -class OutputConnection : public Connection { - public: - OutputConnection (string name, bool sdep = false) : Connection (name, sdep) {} - OutputConnection (const XMLNode&); -}; - -} - -#endif /* __ardour_connection_h__ */ - diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index ee5d3ba85d..18929ee528 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -50,7 +50,7 @@ namespace ARDOUR { class Session; class AudioEngine; -class Connection; +class Bundle; class Panner; class PeakMeter; class Port; @@ -116,11 +116,11 @@ class IO : public PBD::StatefulDestructible int ensure_io (ChanCount in, ChanCount out, bool clear, void *src); - int use_input_connection (Connection&, void *src); - int use_output_connection (Connection&, void *src); + int use_input_bundle (Bundle&, void *src); + int use_output_bundle (Bundle&, void *src); - Connection *input_connection() const { return _input_connection; } - Connection *output_connection() const { return _output_connection; } + Bundle *input_bundle() const { return _input_bundle; } + Bundle *output_bundle() const { return _output_bundle; } int add_input_port (string source, void *src, DataType type = DataType::NIL); int add_output_port (string destination, void *src, DataType type = DataType::NIL); @@ -280,8 +280,8 @@ class IO : public PBD::StatefulDestructible PortSet _inputs; PeakMeter* _meter; string _name; - Connection* _input_connection; - Connection* _output_connection; + Bundle* _input_bundle; + Bundle* _output_bundle; bool no_panner_reset; bool _phase_invert; XMLNode* deferred_state; @@ -334,10 +334,10 @@ class IO : public PBD::StatefulDestructible /* are these the best variable names ever, or what? */ - sigc::connection input_connection_configuration_connection; - sigc::connection output_connection_configuration_connection; - sigc::connection input_connection_connection_connection; - sigc::connection output_connection_connection_connection; + sigc::connection input_bundle_configuration_connection; + sigc::connection output_bundle_configuration_connection; + sigc::connection input_bundle_connection_connection; + sigc::connection output_bundle_connection_connection; static bool panners_legal; @@ -363,13 +363,13 @@ class IO : public PBD::StatefulDestructible int ensure_inputs (ChanCount, bool clear, bool lockit, void *src); int ensure_outputs (ChanCount, bool clear, bool lockit, void *src); - void drop_input_connection (); - void drop_output_connection (); + void drop_input_bundle (); + void drop_output_bundle (); - void input_connection_configuration_changed (); - void input_connection_connection_changed (int); - void output_connection_configuration_changed (); - void output_connection_connection_changed (int); + void input_bundle_configuration_changed (); + void input_bundle_connection_changed (int); + void output_bundle_configuration_changed (); + void output_bundle_connection_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 076cef2488..80362e45b5 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -91,7 +91,7 @@ class Send; class Redirect; class PortInsert; class PluginInsert; -class Connection; +class Bundle; class TempoMap; class AudioTrack; class NamedSelection; @@ -714,15 +714,15 @@ class Session : public PBD::StatefulDestructible nframes_t available_capture_duration(); - /* I/O Connections */ + /* I/O bundles */ - template<class T> void foreach_connection (T *obj, void (T::*func)(Connection *)); - void add_connection (Connection *); - void remove_connection (Connection *); - Connection *connection_by_name (string) const; + template<class T> void foreach_bundle (T *obj, void (T::*func)(Bundle *)); + void add_bundle (Bundle *); + void remove_bundle (Bundle *); + Bundle *bundle_by_name (string) const; - sigc::signal<void,Connection *> ConnectionAdded; - sigc::signal<void,Connection *> ConnectionRemoved; + sigc::signal<void,Bundle *> BundleAdded; + sigc::signal<void,Bundle *> BundleRemoved; /* MIDI */ @@ -1567,12 +1567,12 @@ class Session : public PBD::StatefulDestructible mutable gint _playback_load_min; mutable gint _capture_load_min; - /* I/O Connections */ + /* I/O bundles */ - typedef list<Connection *> ConnectionList; - mutable Glib::Mutex connection_lock; - ConnectionList _connections; - int load_connections (const XMLNode&); + typedef list<Bundle *> BundleList; + mutable Glib::Mutex bundle_lock; + BundleList _bundles; + int load_bundles (const XMLNode&); void reverse_diskstream_buffers (); diff --git a/libs/ardour/ardour/session_connection.h b/libs/ardour/ardour/session_bundle.h index d5e32c7904..e4b3cf66a1 100644 --- a/libs/ardour/ardour/session_connection.h +++ b/libs/ardour/ardour/session_bundle.h @@ -17,23 +17,23 @@ */ -#ifndef __ardour_session_connection_h__ -#define __ardour_session_connection_h__ +#ifndef __ardour_session_bundle_h__ +#define __ardour_session_bundle_h__ #include <ardour/session.h> -#include <ardour/connection.h> +#include <ardour/bundle.h> namespace ARDOUR { template<class T> void -Session::foreach_connection (T *obj, void (T::*func)(Connection *)) +Session::foreach_bundle (T *obj, void (T::*func)(Bundle *)) { - Glib::Mutex::Lock lm (connection_lock); - for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); i++) { + Glib::Mutex::Lock lm (bundle_lock); + for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); i++) { (obj->*func) (*i); } } } /* namespace */ -#endif /* __ardour_session_connection_h__ */ +#endif /* __ardour_session_bundle_h__ */ diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 2c01e90097..58cf38ec6e 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -134,22 +134,22 @@ AudioTrack::deprecated_use_diskstream_connections () } if ((prop = node.property ("input-connection")) != 0) { - Connection* c = _session.connection_by_name (prop->value()); + Bundle* c = _session.bundle_by_name (prop->value()); if (c == 0) { - error << string_compose(_("Unknown connection \"%1\" listed for input of %2"), prop->value(), _name) << endmsg; + error << string_compose(_("Unknown bundle \"%1\" listed for input of %2"), prop->value(), _name) << endmsg; - if ((c = _session.connection_by_name (_("in 1"))) == 0) { - error << _("No input connections available as a replacement") + if ((c = _session.bundle_by_name (_("in 1"))) == 0) { + error << _("No input bundles available as a replacement") << endmsg; return -1; } else { - info << string_compose (_("Connection %1 was not available - \"in 1\" used instead"), prop->value()) + info << string_compose (_("Bundle %1 was not available - \"in 1\" used instead"), prop->value()) << endmsg; } } - use_input_connection (*c, this); + use_input_bundle(*c, this); } else if ((prop = node.property ("inputs")) != 0) { if (set_inputs (prop->value())) { diff --git a/libs/ardour/connection.cc b/libs/ardour/bundle.cc index 13b7dc4ddb..0d8c36a84f 100644 --- a/libs/ardour/connection.cc +++ b/libs/ardour/bundle.cc @@ -21,7 +21,7 @@ #include <pbd/failed_constructor.h> #include <ardour/ardour.h> -#include <ardour/connection.h> +#include <ardour/bundle.h> #include <pbd/xml++.h> #include "i18n.h" @@ -29,48 +29,72 @@ using namespace ARDOUR; using namespace PBD; -Connection::Connection (const XMLNode& node) +/** Construct a Bundle from an XML node. + * @param node XML node. + */ +Bundle::Bundle (const XMLNode& node) { if (set_state (node)) { throw failed_constructor(); } } -InputConnection::InputConnection (const XMLNode& node) - : Connection (node) +/** Construct an InputBundle from an XML node. + * @param node XML node. + */ +InputBundle::InputBundle (const XMLNode& node) + : Bundle (node) { + } -OutputConnection::OutputConnection (const XMLNode& node) - : Connection (node) +/** Construct an OutputBundle from an XML node. + * @param node XML node. + */ +OutputBundle::OutputBundle (const XMLNode& node) + : Bundle (node) { + } +/** Set the name. + * @param name New name. + */ void -Connection::set_name (string name, void *src) +Bundle::set_name (string name, void *src) { _name = name; NameChanged (src); } +/** 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 -Connection::add_connection (int port, string portname) +Bundle::add_port_to_channel (int ch, string portname) { { - Glib::Mutex::Lock lm (port_lock); - _ports[port].push_back (portname); + Glib::Mutex::Lock lm (channels_lock); + _channels[ch].push_back (portname); } - ConnectionsChanged (port); /* EMIT SIGNAL */ + + 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. + */ + void -Connection::remove_connection (int port, string portname) +Bundle::remove_port_from_channel (int ch, string portname) { bool changed = false; { - Glib::Mutex::Lock lm (port_lock); - PortList& pl = _ports[port]; + Glib::Mutex::Lock lm (channels_lock); + PortList& pl = _channels[ch]; PortList::iterator i = find (pl.begin(), pl.end(), portname); if (i != pl.end()) { @@ -80,74 +104,56 @@ Connection::remove_connection (int port, string portname) } if (changed) { - ConnectionsChanged (port); /* EMIT SIGNAL */ + PortsChanged (ch); /* EMIT SIGNAL */ } } -const Connection::PortList& -Connection::port_connections (int port) const +/** + * @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 (port_lock); - return _ports[port]; + 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 -Connection::operator== (const Connection& other) const +Bundle::operator== (const Bundle& other) const { - return other._ports == _ports; + return other._channels == _channels; } -void -Connection::add_port () -{ - { - Glib::Mutex::Lock lm (port_lock); - _ports.push_back (PortList()); - } - ConfigurationChanged(); /* EMIT SIGNAL */ -} + +/** Set the number of channels. + * @param n New number of channels. + */ void -Connection::remove_port (int which_port) +Bundle::set_nchannels (int n) { - bool changed = false; - { - Glib::Mutex::Lock lm (port_lock); - vector<PortList>::iterator i; - int n; - - for (n = 0, i = _ports.begin(); i != _ports.end() && n < which_port; ++i, ++n); - - if (i != _ports.end()) { - _ports.erase (i); - changed = true; + Glib::Mutex::Lock lm (channels_lock); + _channels.clear (); + for (int i = 0; i < n; ++i) { + _channels.push_back (PortList()); } } - if (changed) { - ConfigurationChanged(); /* EMIT SIGNAL */ - } -} - -void -Connection::clear () -{ - { - Glib::Mutex::Lock lm (port_lock); - _ports.clear (); - } - - ConfigurationChanged(); /* EMIT SIGNAL */ + ConfigurationChanged (); /* EMIT SIGNAL */ } XMLNode& -Connection::get_state () +Bundle::get_state () { XMLNode *node; string str; - if (dynamic_cast<InputConnection *> (this)) { + if (dynamic_cast<InputBundle *> (this)) { node = new XMLNode ("InputConnection"); } else { node = new XMLNode ("OutputConnection"); @@ -155,7 +161,7 @@ Connection::get_state () node->add_property ("name", _name); - for (vector<PortList>::iterator i = _ports.begin(); i != _ports.end(); ++i) { + for (vector<PortList>::iterator i = _channels.begin(); i != _channels.end(); ++i) { str += '{'; @@ -174,7 +180,7 @@ Connection::get_state () } int -Connection::set_state (const XMLNode& node) +Bundle::set_state (const XMLNode& node) { const XMLProperty *prop; @@ -184,33 +190,35 @@ Connection::set_state (const XMLNode& node) } _name = prop->value(); - _sysdep = false; + _dynamic = false; if ((prop = node.property ("connections")) == 0) { error << _("Node for Connection has no \"connections\" property") << endmsg; return -1; } - set_connections (prop->value()); + set_channels (prop->value()); return 0; } +/** Set up channels from an XML property string. + * @param str String. + * @return 0 on success, -1 on error. + */ int -Connection::set_connections (const string& str) +Bundle::set_channels (const string& str) { vector<string> ports; int i; int n; - int nports; + int nchannels; - if ((nports = count (str.begin(), str.end(), '{')) == 0) { + if ((nchannels = count (str.begin(), str.end(), '{')) == 0) { return 0; } - for (n = 0; n < nports; ++n) { - add_port (); - } + set_nchannels (nchannels); string::size_type start, end, ostart; @@ -235,7 +243,7 @@ Connection::set_connections (const string& str) } else if (n > 0) { for (int x = 0; x < n; ++x) { - add_connection (i, ports[x]); + add_port_to_channel (i, ports[x]); } } @@ -247,7 +255,7 @@ Connection::set_connections (const string& str) } int -Connection::parse_io_string (const string& str, vector<string>& ports) +Bundle::parse_io_string (const string& str, vector<string>& ports) { string::size_type pos, opos; diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 65e302d33b..49649aac6a 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -34,7 +34,7 @@ #include <ardour/port.h> #include <ardour/audio_port.h> #include <ardour/midi_port.h> -#include <ardour/connection.h> +#include <ardour/bundle.h> #include <ardour/session.h> #include <ardour/cycle_timer.h> #include <ardour/panner.h> @@ -130,8 +130,8 @@ IO::IO (Session& s, string name, _gain = 1.0; _desired_gain = 1.0; - _input_connection = 0; - _output_connection = 0; + _input_bundle = 0; + _output_bundle = 0; pending_state_node = 0; no_panner_reset = false; _phase_invert = false; @@ -172,8 +172,8 @@ IO::IO (Session& s, const XMLNode& node, DataType dt) no_panner_reset = false; _desired_gain = 1.0; _gain = 1.0; - _input_connection = 0; - _output_connection = 0; + _input_bundle = 0; + _output_bundle = 0; apply_gain_automation = false; @@ -329,20 +329,20 @@ IO::just_meter_input (nframes_t start_frame, nframes_t end_frame, } void -IO::drop_input_connection () +IO::drop_input_bundle () { - _input_connection = 0; - input_connection_configuration_connection.disconnect(); - input_connection_connection_connection.disconnect(); + _input_bundle = 0; + input_bundle_configuration_connection.disconnect(); + input_bundle_connection_connection.disconnect(); _session.set_dirty (); } void -IO::drop_output_connection () +IO::drop_output_bundle () { - _output_connection = 0; - output_connection_configuration_connection.disconnect(); - output_connection_connection_connection.disconnect(); + _output_bundle = 0; + output_bundle_configuration_connection.disconnect(); + output_bundle_connection_connection.disconnect(); _session.set_dirty (); } @@ -372,7 +372,7 @@ IO::disconnect_input (Port* our_port, string other_port, void* src) return -1; } - drop_input_connection(); + drop_input_bundle (); } } @@ -407,7 +407,7 @@ IO::connect_input (Port* our_port, string other_port, void* src) return -1; } - drop_input_connection (); + drop_input_bundle (); } } @@ -442,7 +442,7 @@ IO::disconnect_output (Port* our_port, string other_port, void* src) return -1; } - drop_output_connection (); + drop_output_bundle (); } } @@ -477,7 +477,7 @@ IO::connect_output (Port* our_port, string other_port, void* src) return -1; } - drop_output_connection (); + drop_output_bundle (); } } @@ -538,7 +538,7 @@ IO::remove_output_port (Port* port, void* src) } _session.engine().unregister_port (*port); - drop_output_connection (); + drop_output_bundle (); setup_peak_meters (); reset_panner (); @@ -596,7 +596,7 @@ IO::add_output_port (string destination, void* src, DataType type) } _outputs.add (our_port); - drop_output_connection (); + drop_output_bundle (); setup_peak_meters (); reset_panner (); } @@ -642,7 +642,7 @@ IO::remove_input_port (Port* port, void* src) } _session.engine().unregister_port (*port); - drop_input_connection (); + drop_input_bundle (); setup_peak_meters (); reset_panner (); @@ -700,7 +700,7 @@ IO::add_input_port (string source, void* src, DataType type) } _inputs.add (our_port); - drop_input_connection (); + drop_input_bundle (); setup_peak_meters (); reset_panner (); } @@ -735,7 +735,7 @@ IO::disconnect_inputs (void* src) _session.engine().disconnect (*i); } - drop_input_connection (); + drop_input_bundle (); } } @@ -757,7 +757,7 @@ IO::disconnect_outputs (void* src) _session.engine().disconnect (*i); } - drop_output_connection (); + drop_output_bundle (); } } @@ -821,7 +821,7 @@ IO::ensure_inputs_locked (ChanCount count, bool clear, void* src) } if (changed) { - drop_input_connection (); + drop_input_bundle (); setup_peak_meters (); reset_panner (); MoreChannels (n_inputs()); /* EMIT SIGNAL */ @@ -988,12 +988,12 @@ IO::ensure_io (ChanCount in, ChanCount out, bool clear, void* src) } if (out_changed) { - drop_output_connection (); + drop_output_bundle (); output_changed (ConfigurationChanged, src); /* EMIT SIGNAL */ } if (in_changed) { - drop_input_connection (); + drop_input_bundle (); input_changed (ConfigurationChanged, src); /* EMIT SIGNAL */ } @@ -1084,7 +1084,7 @@ IO::ensure_outputs_locked (ChanCount count, bool clear, void* src) } if (changed) { - drop_output_connection (); + drop_output_bundle (); MoreChannels (n_outputs()); /* EMIT SIGNAL */ _session.set_dirty (); } @@ -1197,13 +1197,13 @@ IO::state (bool full_state) str = ""; - if (_input_connection) { - node->add_property ("input-connection", _input_connection->name()); + if (_input_bundle) { + node->add_property ("input-connection", _input_bundle->name()); need_ins = false; } - if (_output_connection) { - node->add_property ("output-connection", _output_connection->name()); + if (_output_bundle) { + node->add_property ("output-connection", _output_bundle->name()); need_outs = false; } @@ -1554,24 +1554,27 @@ IO::create_ports (const XMLNode& node) int num_inputs = 0; int num_outputs = 0; + /* XXX: we could change *-connection to *-bundle, but it seems a bit silly to + * break the session file format. + */ if ((prop = node.property ("input-connection")) != 0) { - Connection* c = _session.connection_by_name (prop->value()); + Bundle* c = _session.bundle_by_name (prop->value()); if (c == 0) { - error << string_compose(_("Unknown connection \"%1\" listed for input of %2"), prop->value(), _name) << endmsg; + error << string_compose(_("Unknown bundle \"%1\" listed for input of %2"), prop->value(), _name) << endmsg; - if ((c = _session.connection_by_name (_("in 1"))) == 0) { - error << _("No input connections available as a replacement") + if ((c = _session.bundle_by_name (_("in 1"))) == 0) { + error << _("No input bundles available as a replacement") << endmsg; return -1; } else { - info << string_compose (_("Connection %1 was not available - \"in 1\" used instead"), prop->value()) + info << string_compose (_("Bundle %1 was not available - \"in 1\" used instead"), prop->value()) << endmsg; } } - num_inputs = c->nports(); + num_inputs = c->nchannels(); } else if ((prop = node.property ("inputs")) != 0) { @@ -1579,22 +1582,22 @@ IO::create_ports (const XMLNode& node) } if ((prop = node.property ("output-connection")) != 0) { - Connection* c = _session.connection_by_name (prop->value()); + Bundle* c = _session.bundle_by_name (prop->value()); if (c == 0) { - error << string_compose(_("Unknown connection \"%1\" listed for output of %2"), prop->value(), _name) << endmsg; + error << string_compose(_("Unknown bundle \"%1\" listed for output of %2"), prop->value(), _name) << endmsg; - if ((c = _session.connection_by_name (_("out 1"))) == 0) { - error << _("No output connections available as a replacement") + if ((c = _session.bundle_by_name (_("out 1"))) == 0) { + error << _("No output bundles available as a replacement") << endmsg; return -1; } else { - info << string_compose (_("Connection %1 was not available - \"out 1\" used instead"), prop->value()) + info << string_compose (_("Bundle %1 was not available - \"out 1\" used instead"), prop->value()) << endmsg; } } - num_outputs = c->nports (); + num_outputs = c->nchannels (); } else if ((prop = node.property ("outputs")) != 0) { num_outputs = count (prop->value().begin(), prop->value().end(), '{'); @@ -1623,22 +1626,22 @@ IO::make_connections (const XMLNode& node) const XMLProperty* prop; if ((prop = node.property ("input-connection")) != 0) { - Connection* c = _session.connection_by_name (prop->value()); + Bundle* c = _session.bundle_by_name (prop->value()); if (c == 0) { error << string_compose(_("Unknown connection \"%1\" listed for input of %2"), prop->value(), _name) << endmsg; - if ((c = _session.connection_by_name (_("in 1"))) == 0) { + if ((c = _session.bundle_by_name (_("in 1"))) == 0) { error << _("No input connections available as a replacement") << endmsg; return -1; } else { - info << string_compose (_("Connection %1 was not available - \"in 1\" used instead"), prop->value()) + info << string_compose (_("Bundle %1 was not available - \"in 1\" used instead"), prop->value()) << endmsg; } } - use_input_connection (*c, this); + use_input_bundle (*c, this); } else if ((prop = node.property ("inputs")) != 0) { if (set_inputs (prop->value())) { @@ -1647,23 +1650,23 @@ IO::make_connections (const XMLNode& node) } } - if ((prop = node.property ("output-connection")) != 0) { - Connection* c = _session.connection_by_name (prop->value()); + if ((prop = node.property ("output-bundle")) != 0) { + Bundle* c = _session.bundle_by_name (prop->value()); if (c == 0) { - error << string_compose(_("Unknown connection \"%1\" listed for output of %2"), prop->value(), _name) << endmsg; + error << string_compose(_("Unknown bundle \"%1\" listed for output of %2"), prop->value(), _name) << endmsg; - if ((c = _session.connection_by_name (_("out 1"))) == 0) { - error << _("No output connections available as a replacement") + if ((c = _session.bundle_by_name (_("out 1"))) == 0) { + error << _("No output bundles available as a replacement") << endmsg; return -1; } else { - info << string_compose (_("Connection %1 was not available - \"out 1\" used instead"), prop->value()) + info << string_compose (_("Bundle %1 was not available - \"out 1\" used instead"), prop->value()) << endmsg; } } - use_output_connection (*c, this); + use_output_bundle (*c, this); } else if ((prop = node.property ("outputs")) != 0) { if (set_outputs (prop->value())) { @@ -1928,7 +1931,7 @@ IO::input_latency () const } int -IO::use_input_connection (Connection& c, void* src) +IO::use_input_bundle (Bundle& c, void* src) { uint32_t limit; @@ -1936,11 +1939,11 @@ IO::use_input_connection (Connection& c, void* src) BLOCK_PROCESS_CALLBACK (); Glib::Mutex::Lock lm2 (io_lock); - limit = c.nports(); + limit = c.nchannels(); - drop_input_connection (); + drop_input_bundle (); - // FIXME connections only work for audio-only + // FIXME bundles only work for audio-only if (ensure_inputs (ChanCount(DataType::AUDIO, limit), false, false, src)) { return -1; } @@ -1950,9 +1953,9 @@ IO::use_input_connection (Connection& c, void* src) */ for (uint32_t n = 0; n < limit; ++n) { - const Connection::PortList& pl = c.port_connections (n); + const Bundle::PortList& pl = c.channel_ports (n); - for (Connection::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))) { @@ -1980,9 +1983,9 @@ IO::use_input_connection (Connection& c, void* src) /* second pass: connect all requested ports where necessary */ for (uint32_t n = 0; n < limit; ++n) { - const Connection::PortList& pl = c.port_connections (n); + const Bundle::PortList& pl = c.channel_ports (n); - for (Connection::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))) { @@ -1994,12 +1997,12 @@ IO::use_input_connection (Connection& c, void* src) } } - _input_connection = &c; + _input_bundle = &c; - input_connection_configuration_connection = c.ConfigurationChanged.connect - (mem_fun (*this, &IO::input_connection_configuration_changed)); - input_connection_connection_connection = c.ConnectionsChanged.connect - (mem_fun (*this, &IO::input_connection_connection_changed)); + input_bundle_configuration_connection = c.ConfigurationChanged.connect + (mem_fun (*this, &IO::input_bundle_configuration_changed)); + input_bundle_connection_connection = c.PortsChanged.connect + (mem_fun (*this, &IO::input_bundle_connection_changed)); } input_changed (IOChange (ConfigurationChanged|ConnectionsChanged), src); /* EMIT SIGNAL */ @@ -2007,7 +2010,7 @@ IO::use_input_connection (Connection& c, void* src) } int -IO::use_output_connection (Connection& c, void* src) +IO::use_output_bundle (Bundle& c, void* src) { uint32_t limit; @@ -2015,9 +2018,9 @@ IO::use_output_connection (Connection& c, void* src) BLOCK_PROCESS_CALLBACK (); Glib::Mutex::Lock lm2 (io_lock); - limit = c.nports(); + limit = c.nchannels(); - drop_output_connection (); + drop_output_bundle (); // FIXME: audio-only if (ensure_outputs (ChanCount(DataType::AUDIO, limit), false, false, src)) { @@ -2030,9 +2033,9 @@ IO::use_output_connection (Connection& c, void* src) for (uint32_t n = 0; n < limit; ++n) { - const Connection::PortList& pl = c.port_connections (n); + const Bundle::PortList& pl = c.channel_ports (n); - for (Connection::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))) { @@ -2060,9 +2063,9 @@ IO::use_output_connection (Connection& c, void* src) for (uint32_t n = 0; n < limit; ++n) { - const Connection::PortList& pl = c.port_connections (n); + const Bundle::PortList& pl = c.channel_ports (n); - for (Connection::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))) { @@ -2073,12 +2076,12 @@ IO::use_output_connection (Connection& c, void* src) } } - _output_connection = &c; + _output_bundle = &c; - output_connection_configuration_connection = c.ConfigurationChanged.connect - (mem_fun (*this, &IO::output_connection_configuration_changed)); - output_connection_connection_connection = c.ConnectionsChanged.connect - (mem_fun (*this, &IO::output_connection_connection_changed)); + output_bundle_configuration_connection = c.ConfigurationChanged.connect + (mem_fun (*this, &IO::output_bundle_configuration_changed)); + output_bundle_connection_connection = c.PortsChanged.connect + (mem_fun (*this, &IO::output_bundle_connection_changed)); } output_changed (IOChange (ConnectionsChanged|ConfigurationChanged), src); /* EMIT SIGNAL */ @@ -2129,27 +2132,27 @@ IO::reset_panners () } void -IO::input_connection_connection_changed (int ignored) +IO::input_bundle_connection_changed (int ignored) { - use_input_connection (*_input_connection, this); + use_input_bundle (*_input_bundle, this); } void -IO::input_connection_configuration_changed () +IO::input_bundle_configuration_changed () { - use_input_connection (*_input_connection, this); + use_input_bundle (*_input_bundle, this); } void -IO::output_connection_connection_changed (int ignored) +IO::output_bundle_connection_changed (int ignored) { - use_output_connection (*_output_connection, this); + use_output_bundle (*_output_bundle, this); } void -IO::output_connection_configuration_changed () +IO::output_bundle_configuration_changed () { - use_output_connection (*_output_connection, this); + use_output_bundle (*_output_bundle, this); } void diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 2570b8433d..1fa5d47ac0 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -58,7 +58,7 @@ #include <ardour/redirect.h> #include <ardour/send.h> #include <ardour/insert.h> -#include <ardour/connection.h> +#include <ardour/bundle.h> #include <ardour/slave.h> #include <ardour/tempo.h> #include <ardour/audio_track.h> @@ -458,10 +458,10 @@ Session::destroy () } #ifdef TRACK_DESTRUCTION - cerr << "delete connections\n"; + cerr << "delete bundles\n"; #endif /* TRACK_DESTRUCTION */ - for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); ) { - ConnectionList::iterator tmp; + for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ) { + BundleList::iterator tmp; tmp = i; ++tmp; @@ -575,7 +575,7 @@ Session::when_engine_running () // XXX HOW TO ALERT UI TO THIS ? DO WE NEED TO? } - /* Create a set of Connection objects that map + /* Create a set of Bundle objects that map to the physical outputs currently available */ @@ -585,24 +585,22 @@ Session::when_engine_running () char buf[32]; snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1); - Connection* c = new OutputConnection (buf, true); + Bundle* c = new OutputBundle (buf, true); + c->set_nchannels (1); + c->add_port_to_channel (0, _engine.get_nth_physical_output (DataType::AUDIO, np)); - c->add_port (); - c->add_connection (0, _engine.get_nth_physical_output (DataType::AUDIO, np)); - - add_connection (c); + add_bundle (c); } for (uint32_t np = 0; np < n_physical_inputs; ++np) { char buf[32]; snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1); - Connection* c = new InputConnection (buf, true); - - c->add_port (); - c->add_connection (0, _engine.get_nth_physical_input (DataType::AUDIO, np)); + Bundle* c = new InputBundle (buf, true); + c->set_nchannels (1); + c->add_port_to_channel (0, _engine.get_nth_physical_input (DataType::AUDIO, np)); - add_connection (c); + add_bundle (c); } /* TWO: STEREO */ @@ -611,28 +609,24 @@ Session::when_engine_running () char buf[32]; snprintf (buf, sizeof (buf), _("out %" PRIu32 "+%" PRIu32), np+1, np+2); - Connection* c = new OutputConnection (buf, true); + Bundle* c = new OutputBundle (buf, true); + c->set_nchannels (2); + c->add_port_to_channel (0, _engine.get_nth_physical_output (DataType::AUDIO, np)); + c->add_port_to_channel (1, _engine.get_nth_physical_output (DataType::AUDIO, np+1)); - c->add_port (); - c->add_port (); - c->add_connection (0, _engine.get_nth_physical_output (DataType::AUDIO, np)); - c->add_connection (1, _engine.get_nth_physical_output (DataType::AUDIO, np+1)); - - add_connection (c); + add_bundle (c); } for (uint32_t np = 0; np < n_physical_inputs; np +=2) { char buf[32]; snprintf (buf, sizeof (buf), _("in %" PRIu32 "+%" PRIu32), np+1, np+2); - Connection* c = new InputConnection (buf, true); - - c->add_port (); - c->add_port (); - c->add_connection (0, _engine.get_nth_physical_input (DataType::AUDIO, np)); - c->add_connection (1, _engine.get_nth_physical_input (DataType::AUDIO, np+1)); + Bundle* c = new InputBundle (buf, true); + c->set_nchannels (2); + c->add_port_to_channel (0, _engine.get_nth_physical_input (DataType::AUDIO, np)); + c->add_port_to_channel (1, _engine.get_nth_physical_input (DataType::AUDIO, np+1)); - add_connection (c); + add_bundle (c); } /* THREE MASTER */ @@ -677,13 +671,13 @@ Session::when_engine_running () } - Connection* c = new OutputConnection (_("Master Out"), true); + Bundle* c = new OutputBundle (_("Master Out"), true); + c->set_nchannels (_master_out->n_inputs().get_total()); for (uint32_t n = 0; n < _master_out->n_inputs ().get_total(); ++n) { - c->add_port (); - c->add_connection ((int) n, _master_out->input(n)->name()); + c->add_port_to_channel ((int) n, _master_out->input(n)->name()); } - add_connection (c); + add_bundle (c); } hookup_io (); @@ -3601,46 +3595,46 @@ Session::available_capture_duration () } void -Session::add_connection (ARDOUR::Connection* connection) +Session::add_bundle (ARDOUR::Bundle* bundle) { { - Glib::Mutex::Lock guard (connection_lock); - _connections.push_back (connection); + Glib::Mutex::Lock guard (bundle_lock); + _bundles.push_back (bundle); } - ConnectionAdded (connection); /* EMIT SIGNAL */ + BundleAdded (bundle); /* EMIT SIGNAL */ set_dirty(); } void -Session::remove_connection (ARDOUR::Connection* connection) +Session::remove_bundle (ARDOUR::Bundle* bundle) { bool removed = false; { - Glib::Mutex::Lock guard (connection_lock); - ConnectionList::iterator i = find (_connections.begin(), _connections.end(), connection); + Glib::Mutex::Lock guard (bundle_lock); + BundleList::iterator i = find (_bundles.begin(), _bundles.end(), bundle); - if (i != _connections.end()) { - _connections.erase (i); + if (i != _bundles.end()) { + _bundles.erase (i); removed = true; } } if (removed) { - ConnectionRemoved (connection); /* EMIT SIGNAL */ + BundleRemoved (bundle); /* EMIT SIGNAL */ } set_dirty(); } -ARDOUR::Connection * -Session::connection_by_name (string name) const +ARDOUR::Bundle * +Session::bundle_by_name (string name) const { - Glib::Mutex::Lock lm (connection_lock); + Glib::Mutex::Lock lm (bundle_lock); - for (ConnectionList::const_iterator i = _connections.begin(); i != _connections.end(); ++i) { + for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) { if ((*i)->name() == name) { return* i; } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index e58f2324e3..b86ea2d088 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -79,7 +79,7 @@ #include <ardour/redirect.h> #include <ardour/send.h> #include <ardour/insert.h> -#include <ardour/connection.h> +#include <ardour/bundle.h> #include <ardour/slave.h> #include <ardour/tempo.h> #include <ardour/audio_track.h> @@ -972,9 +972,9 @@ Session::state(bool full_state) child = node->add_child ("Connections"); { - Glib::Mutex::Lock lm (connection_lock); - for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); ++i) { - if (!(*i)->system_dependent()) { + Glib::Mutex::Lock lm (bundle_lock); + for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) { + if (!(*i)->dynamic()) { child->add_child_nocopy ((*i)->get_state()); } } @@ -1217,7 +1217,7 @@ Session::set_state (const XMLNode& node) if ((child = find_named_node (node, "Connections")) == 0) { error << _("Session: XML state has no connections section") << endmsg; goto out; - } else if (load_connections (*child)) { + } else if (load_bundles (*child)) { goto out; } @@ -2106,7 +2106,7 @@ Session::control_protocol_path () } int -Session::load_connections (const XMLNode& node) +Session::load_bundles (const XMLNode& node) { XMLNodeList nlist = node.children(); XMLNodeConstIterator niter; @@ -2115,9 +2115,9 @@ Session::load_connections (const XMLNode& node) for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == "InputConnection") { - add_connection (new ARDOUR::InputConnection (**niter)); + add_bundle (new ARDOUR::InputBundle (**niter)); } else if ((*niter)->name() == "OutputConnection") { - add_connection (new ARDOUR::OutputConnection (**niter)); + add_bundle (new ARDOUR::OutputBundle (**niter)); } else { error << string_compose(_("Unknown node \"%1\" found in Connections list from state file"), (*niter)->name()) << endmsg; return -1; diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index a5484813f9..ebbb617776 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -31,7 +31,6 @@ #include <ardour/audioplaylist.h> #include <ardour/panner.h> #include <ardour/utils.h> -#include <ardour/connection.h> #include "i18n.h" |