Rename ARDOUR::Connection to ARDOUR::Bundle, a few minor cleanups along the way.
authorCarl Hetherington <carl@carlh.net>
Fri, 18 May 2007 15:58:01 +0000 (15:58 +0000)
committerCarl Hetherington <carl@carlh.net>
Fri, 18 May 2007 15:58:01 +0000 (15:58 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1882 d708f5d6-7413-0410-9779-e7cbd77b26cf

19 files changed:
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h
gtk2_ardour/redirect_box.cc
gtk2_ardour/redirect_box.h
gtk2_ardour/route_params_ui.cc
libs/ardour/SConscript
libs/ardour/ardour/bundle.h [new file with mode: 0644]
libs/ardour/ardour/connection.h [deleted file]
libs/ardour/ardour/io.h
libs/ardour/ardour/session.h
libs/ardour/ardour/session_bundle.h [new file with mode: 0644]
libs/ardour/ardour/session_connection.h [deleted file]
libs/ardour/audio_track.cc
libs/ardour/bundle.cc [new file with mode: 0644]
libs/ardour/connection.cc [deleted file]
libs/ardour/io.cc
libs/ardour/session.cc
libs/ardour/session_state.cc
libs/ardour/track.cc

index 1a21464bf53e49baf046141777a91df78566eb95..9225fa6b127d3a9d53e84b87ea55100b86a2aea4 100644 (file)
@@ -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) {
index 7e92f8357949fad841aee54de77502201205347d..02a78575ad5d13c0ead7abd1587d8fa4a59de8fa 100644 (file)
@@ -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 ();
index 96e99e46673b18eb756f2b88c94b1c49d4cbc21c..99d7b9735d07899d0a4d838f221ffd66146e8d48 100644 (file)
@@ -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"
index 88fbd5924d700fa8db53a5332ec38e47f6838841..089542b0411c56360724a2bd41b533d71913b321 100644 (file)
@@ -52,7 +52,7 @@ class PluginUIWindow;
 class RouteRedirectSelection;
 
 namespace ARDOUR {
-       class Connection;
+       class Bundle;
        class Insert;
        class Plugin;
        class PluginInsert;
index b5655f0cc9db335703b71f50406ea1966b8fc0fc..03e0f2ca03ca52236f638846fdff96533dc061d5 100644 (file)
@@ -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"
index dba845f2188be70c544868a3a195058a397ee7f4..d33aaa852ff786528dc15685e07e5586687d7460 100644 (file)
@@ -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 (file)
index 0000000..69b8fe1
--- /dev/null
@@ -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 (file)
index d2f1cb4..0000000
+++ /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__ */
-
index ee5d3ba85d27939322a7c0192e46fdd05c3dabb8..18929ee52801494b98d8ec526e0e126ce1518cba 100644 (file)
@@ -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&);
index 076cef24885dc41f382b6da3335863f018e85f58..80362e45b5f84ac5dbf73ba7e83bdbfd8980f861 100644 (file)
@@ -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_bundle.h b/libs/ardour/ardour/session_bundle.h
new file mode 100644 (file)
index 0000000..e4b3cf6
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+    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_session_bundle_h__
+#define __ardour_session_bundle_h__
+
+#include <ardour/session.h>
+#include <ardour/bundle.h>
+
+namespace ARDOUR {
+
+template<class T> void 
+Session::foreach_bundle (T *obj, void (T::*func)(Bundle *)) 
+{
+       Glib::Mutex::Lock lm (bundle_lock);
+       for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); i++) {
+               (obj->*func) (*i);
+       }
+}
+
+} /* namespace */
+
+#endif /* __ardour_session_bundle_h__ */
diff --git a/libs/ardour/ardour/session_connection.h b/libs/ardour/ardour/session_connection.h
deleted file mode 100644 (file)
index d5e32c7..0000000
+++ /dev/null
@@ -1,39 +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_session_connection_h__
-#define __ardour_session_connection_h__
-
-#include <ardour/session.h>
-#include <ardour/connection.h>
-
-namespace ARDOUR {
-
-template<class T> void 
-Session::foreach_connection (T *obj, void (T::*func)(Connection *)) 
-{
-       Glib::Mutex::Lock lm (connection_lock);
-       for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); i++) {
-               (obj->*func) (*i);
-       }
-}
-
-} /* namespace */
-
-#endif /* __ardour_session_connection_h__ */
index 2c01e900978b9e1ccf6a0854d5e43564c50624d4..58cf38ec6e46c653f87f13f6bd41c79f97cb8af5 100644 (file)
@@ -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/bundle.cc b/libs/ardour/bundle.cc
new file mode 100644 (file)
index 0000000..0d8c36a
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+    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.
+
+*/
+
+#include <algorithm>
+
+#include <pbd/failed_constructor.h>
+#include <ardour/ardour.h>
+#include <ardour/bundle.h>
+#include <pbd/xml++.h>
+
+#include "i18n.h"
+
+using namespace ARDOUR;
+using namespace PBD;
+
+/** Construct a Bundle from an XML node.
+ * @param node XML node.
+ */
+Bundle::Bundle (const XMLNode& node)
+{
+       if (set_state (node)) {
+               throw failed_constructor();
+       }
+}
+
+/** Construct an InputBundle from an XML node.
+ * @param node XML node.
+ */
+InputBundle::InputBundle (const XMLNode& node)
+       : Bundle (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
+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
+Bundle::add_port_to_channel (int ch, string portname)
+{
+       {
+               Glib::Mutex::Lock lm (channels_lock);
+               _channels[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.
+ */
+
+void
+Bundle::remove_port_from_channel (int ch, string portname)
+{
+       bool changed = false;
+
+       {
+               Glib::Mutex::Lock lm (channels_lock);
+               PortList& pl = _channels[ch];
+               PortList::iterator i = find (pl.begin(), pl.end(), portname);
+               
+               if (i != pl.end()) {
+                       pl.erase (i);
+                       changed = true;
+               }
+       }
+
+       if (changed) {
+                PortsChanged (ch); /* EMIT SIGNAL */
+       }
+}
+
+/**
+ * @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;
+}
+
+
+/** Set the number of channels.
+ * @param n New number of channels.
+ */
+
+void
+Bundle::set_nchannels (int n)
+{
+       {
+               Glib::Mutex::Lock lm (channels_lock);
+               _channels.clear ();
+               for (int i = 0; i < n; ++i) {
+                       _channels.push_back (PortList());
+               }
+       }
+
+       ConfigurationChanged (); /* EMIT SIGNAL */
+}
+
+XMLNode&
+Bundle::get_state ()
+{
+       XMLNode *node;
+       string str;
+
+       if (dynamic_cast<InputBundle *> (this)) {
+               node = new XMLNode ("InputConnection");
+       } else {
+               node = new XMLNode ("OutputConnection");
+       }
+
+       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 += '}';
+       }
+
+       node->add_property ("connections", str);
+
+       return *node;
+}
+
+int
+Bundle::set_state (const XMLNode& node)
+{
+       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;
+       }
+       
+       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
+Bundle::set_channels (const string& str)
+{
+       vector<string> ports;
+       int i;
+       int n;
+       int 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;
+}
+
+int
+Bundle::parse_io_string (const string& str, vector<string>& ports)
+{
+       string::size_type pos, opos;
+
+       if (str.length() == 0) {
+               return 0;
+       }
+
+       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();
+}
+
diff --git a/libs/ardour/connection.cc b/libs/ardour/connection.cc
deleted file mode 100644 (file)
index 13b7dc4..0000000
+++ /dev/null
@@ -1,274 +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.
-
-*/
-
-#include <algorithm>
-
-#include <pbd/failed_constructor.h>
-#include <ardour/ardour.h>
-#include <ardour/connection.h>
-#include <pbd/xml++.h>
-
-#include "i18n.h"
-
-using namespace ARDOUR;
-using namespace PBD;
-
-Connection::Connection (const XMLNode& node)
-{
-       if (set_state (node)) {
-               throw failed_constructor();
-       }
-}
-
-InputConnection::InputConnection (const XMLNode& node)
-       : Connection (node)
-{
-}
-
-OutputConnection::OutputConnection (const XMLNode& node)
-       : Connection (node)
-{
-}
-
-void
-Connection::set_name (string name, void *src)
-{
-       _name = name;
-       NameChanged (src);
-}
-
-void
-Connection::add_connection (int port, string portname)
-{
-       {
-               Glib::Mutex::Lock lm (port_lock);
-               _ports[port].push_back (portname);
-       }
-        ConnectionsChanged (port); /* EMIT SIGNAL */
-}
-
-void
-Connection::remove_connection (int port, string portname)
-{
-       bool changed = false;
-
-       {
-               Glib::Mutex::Lock lm (port_lock);
-               PortList& pl = _ports[port];
-               PortList::iterator i = find (pl.begin(), pl.end(), portname);
-               
-               if (i != pl.end()) {
-                       pl.erase (i);
-                       changed = true;
-               }
-       }
-
-       if (changed) {
-                ConnectionsChanged (port); /* EMIT SIGNAL */
-       }
-}
-
-const Connection::PortList&
-Connection::port_connections (int port) const
-{
-       Glib::Mutex::Lock lm (port_lock);
-       return _ports[port];
-}
-
-bool
-Connection::operator== (const Connection& other) const
-{
-       return other._ports == _ports;
-}
-
-void
-Connection::add_port ()
-{
-       {
-               Glib::Mutex::Lock lm (port_lock);
-               _ports.push_back (PortList());
-       }
-        ConfigurationChanged(); /* EMIT SIGNAL */
-}
-
-void
-Connection::remove_port (int which_port)
-{
-       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;
-               }
-       }
-
-       if (changed) {
-                ConfigurationChanged(); /* EMIT SIGNAL */
-       }
-}
-
-void 
-Connection::clear ()
-{
-       {
-               Glib::Mutex::Lock lm (port_lock);
-               _ports.clear ();
-       }
-
-        ConfigurationChanged(); /* EMIT SIGNAL */
-}
-
-XMLNode&
-Connection::get_state ()
-{
-       XMLNode *node;
-       string str;
-
-       if (dynamic_cast<InputConnection *> (this)) {
-               node = new XMLNode ("InputConnection");
-       } else {
-               node = new XMLNode ("OutputConnection");
-       }
-
-       node->add_property ("name", _name);
-
-       for (vector<PortList>::iterator i = _ports.begin(); i != _ports.end(); ++i) {
-
-               str += '{';
-
-               for (vector<string>::iterator ii = (*i).begin(); ii != (*i).end(); ++ii) {
-                       if (ii != (*i).begin()) {
-                               str += ',';
-                       }
-                       str += *ii;
-               }
-               str += '}';
-       }
-
-       node->add_property ("connections", str);
-
-       return *node;
-}
-
-int
-Connection::set_state (const XMLNode& node)
-{
-       const XMLProperty *prop;
-
-       if ((prop = node.property ("name")) == 0) {
-               error << _("Node for Connection has no \"name\" property") << endmsg;
-               return -1;
-       }
-
-       _name = prop->value();
-       _sysdep = false;
-       
-       if ((prop = node.property ("connections")) == 0) {
-               error << _("Node for Connection has no \"connections\" property") << endmsg;
-               return -1;
-       }
-       
-       set_connections (prop->value());
-
-       return 0;
-}
-
-int
-Connection::set_connections (const string& str)
-{
-       vector<string> ports;
-       int i;
-       int n;
-       int nports;
-       
-       if ((nports = count (str.begin(), str.end(), '{')) == 0) {
-               return 0;
-       }
-
-       for (n = 0; n < nports; ++n) {
-               add_port ();
-       }
-
-       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_connection (i, ports[x]);
-                       }
-               }
-
-               ostart = end+1;
-               i++;
-       }
-
-       return 0;
-}
-
-int
-Connection::parse_io_string (const string& str, vector<string>& ports)
-{
-       string::size_type pos, opos;
-
-       if (str.length() == 0) {
-               return 0;
-       }
-
-       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();
-}
-
index 65e302d33b39d55c6a0af861912ca8d29acec787..49649aac6aa5196deea57dcbebc7fe46aa007157 100644 (file)
@@ -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
index 2570b8433db9a837e14df015b6e555c6d0e664f7..1fa5d47ac0fe3d220aa3135749b125400cf093e4 100644 (file)
@@ -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;
                }
index e58f2324e34f4a0eb96467916e2b53f318322f42..b86ea2d0880505c18980ba188d49786d8c593ee4 100644 (file)
@@ -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;
index a5484813f9f4049974a6272d3a0554433257b7ea..ebbb6177764b22f97216c86a0cdf3275fc83c135 100644 (file)
@@ -31,7 +31,6 @@
 #include <ardour/audioplaylist.h>
 #include <ardour/panner.h>
 #include <ardour/utils.h>
-#include <ardour/connection.h>
 
 #include "i18n.h"