summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2007-10-19 13:30:07 +0000
committerCarl Hetherington <carl@carlh.net>2007-10-19 13:30:07 +0000
commit77f16522e0b396262bc272c1637753faa9da0ba7 (patch)
tree54520a9d20bc61e72cfdf8c162eb9ed07b95e99d /libs/ardour/ardour
parent239ec39da6583e6e00cd03fa3bde8f1e27016b4d (diff)
Various work on bundles. We now have a Bundle Manager dialogue, and hopefully things are a bit cleaner internally. This commit changes the session file format with respect to bundles (or Connections as they used to be called).
git-svn-id: svn://localhost/ardour2/trunk@2561 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audioengine.h4
-rw-r--r--libs/ardour/ardour/auto_bundle.h50
-rw-r--r--libs/ardour/ardour/bundle.h120
-rw-r--r--libs/ardour/ardour/data_type.h1
-rw-r--r--libs/ardour/ardour/io.h58
-rw-r--r--libs/ardour/ardour/session.h7
-rw-r--r--libs/ardour/ardour/user_bundle.h72
7 files changed, 190 insertions, 122 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 34f7eb8c22..503b8166f0 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -144,7 +144,7 @@ class AudioEngine : public sigc::trackable
/** Caller may not delete the object pointed to by the return value
*/
- Port *get_port_by_name (const std::string& name, bool keep = true);
+ Port *get_port_by_name (const std::string& name, bool keep = true) const;
enum TransportState {
TransportStopped = JackTransportStopped,
@@ -199,7 +199,7 @@ class AudioEngine : public sigc::trackable
ARDOUR::Session *session;
jack_client_t *_jack;
std::string jack_client_name;
- Glib::Mutex _process_lock;
+ mutable Glib::Mutex _process_lock;
Glib::Cond session_removed;
bool session_remove_pending;
bool _running;
diff --git a/libs/ardour/ardour/auto_bundle.h b/libs/ardour/ardour/auto_bundle.h
new file mode 100644
index 0000000000..685a083e8d
--- /dev/null
+++ b/libs/ardour/ardour/auto_bundle.h
@@ -0,0 +1,50 @@
+/*
+ Copyright (C) 2007 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_auto_bundle_h__
+#define __ardour_auto_bundle_h__
+
+#include <vector>
+#include <glibmm/thread.h>
+#include "ardour/bundle.h"
+
+namespace ARDOUR {
+
+class AutoBundle : public Bundle {
+
+ public:
+ AutoBundle (bool i = true);
+ AutoBundle (std::string const &, bool i = true);
+
+ uint32_t nchannels () const;
+ const PortList& channel_ports (uint32_t) const;
+
+ void set_channels (uint32_t);
+ void set_port (uint32_t, std::string const &);
+
+ private:
+ /// mutex for _ports;
+ /// XXX: is this necessary?
+ mutable Glib::Mutex _ports_mutex;
+ std::vector<PortList> _ports;
+};
+
+}
+
+#endif /* __ardour_auto_bundle_h__ */
diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h
index 9c5f3cb21a..ba92063b30 100644
--- a/libs/ardour/ardour/bundle.h
+++ b/libs/ardour/ardour/bundle.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2002 Paul Davis
+ Copyright (C) 2002-2007 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
@@ -20,118 +20,54 @@
#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;
+#include "ardour/data_type.h"
namespace ARDOUR {
+typedef std::vector<std::string> PortList;
+
/**
- * A set of `channels', each of which is associated with 0 or more
- * JACK ports.
+ * A set of `channels', each of which is associated with 0 or more JACK ports.
*/
-class Bundle : public PBD::Stateful, public sigc::trackable {
+class Bundle {
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; }
+ Bundle () : _type (DataType::AUDIO) {}
+ Bundle (bool i) : _type (DataType::AUDIO), _ports_are_inputs (i) {}
+ Bundle (std::string const & n, bool i = true) : _name (n), _type (DataType::AUDIO), _ports_are_inputs (i) {}
+ virtual ~Bundle() {}
/**
* @return Number of channels that this Bundle has.
*/
- uint32_t nchannels () const { return _channels.size(); }
- const PortList& channel_ports (int ch) const;
+ virtual uint32_t nchannels () const = 0;
+ virtual const PortList& channel_ports (uint32_t) const = 0;
- void set_nchannels (int n);
+ void set_name (std::string const & n) {
+ _name = n;
+ NameChanged ();
+ }
+
+ std::string name () const { return _name; }
- void add_port_to_channel (int ch, string portname);
- void remove_port_from_channel (int ch, string portname);
+ sigc::signal<void> NameChanged;
- /// 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;
+ void set_type (DataType t) { _type = t; }
+ DataType type () const { return _type; }
- bool operator==(const Bundle& other) const;
-
- XMLNode& get_state (void);
- int set_state (const XMLNode&);
-
- protected:
- Bundle (const XMLNode&);
+ void set_ports_are_inputs () { _ports_are_inputs = true; }
+ void set_ports_are_outputs () { _ports_are_inputs = false; }
+ bool ports_are_inputs () const { return _ports_are_inputs; }
+ bool ports_are_outputs () const { return !_ports_are_inputs; }
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 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.
- */
- OutputBundle (string name, bool dy = false) : Bundle (name, dy) {}
- OutputBundle (const XMLNode&);
+ std::string _name;
+ ARDOUR::DataType _type;
+ bool _ports_are_inputs;
};
}
#endif /* __ardour_bundle_h__ */
-
diff --git a/libs/ardour/ardour/data_type.h b/libs/ardour/ardour/data_type.h
index 68d9554904..854f52acba 100644
--- a/libs/ardour/ardour/data_type.h
+++ b/libs/ardour/ardour/data_type.h
@@ -21,7 +21,6 @@
#define __ardour_data_type_h__
#include <string>
-#include <ardour/data_type.h>
#include <jack/jack.h>
namespace ARDOUR {
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 6e68c01d8c..888b770250 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -43,6 +43,7 @@
#include <ardour/chan_count.h>
#include <ardour/latent.h>
#include <ardour/automation_control.h>
+#include <ardour/user_bundle.h>
using std::string;
using std::vector;
@@ -54,6 +55,7 @@ namespace ARDOUR {
class Session;
class AudioEngine;
class Bundle;
+class AutoBundle;
class Panner;
class PeakMeter;
class Port;
@@ -123,9 +125,12 @@ class IO : public Automatable, public Latent
int connect_input_ports_to_bundle (boost::shared_ptr<Bundle>, void *src);
int connect_output_ports_to_bundle (boost::shared_ptr<Bundle>, void *src);
- boost::shared_ptr<Bundle> input_bundle();
- boost::shared_ptr<Bundle> output_bundle();
+ std::vector<boost::shared_ptr<Bundle> > bundles_connected_to_inputs ();
+ std::vector<boost::shared_ptr<Bundle> > bundles_connected_to_outputs ();
+ boost::shared_ptr<AutoBundle> bundle_for_inputs () { return _bundle_for_inputs; }
+ boost::shared_ptr<AutoBundle> bundle_for_outputs () { return _bundle_for_outputs; }
+
int add_input_port (string source, void *src, DataType type = DataType::NIL);
int add_output_port (string destination, void *src, DataType type = DataType::NIL);
@@ -179,9 +184,6 @@ class IO : public Automatable, public Latent
void attach_buffers(ChanCount ignored);
- boost::shared_ptr<Bundle> bundle_for_inputs () const { return _bundle_for_inputs; }
- boost::shared_ptr<Bundle> bundle_for_outputs () const { return _bundle_for_outputs; }
-
sigc::signal<void,IOChange,void*> input_changed;
sigc::signal<void,IOChange,void*> output_changed;
@@ -272,8 +274,6 @@ class IO : public Automatable, public Latent
PortSet _outputs;
PortSet _inputs;
PeakMeter* _meter;
- boost::shared_ptr<Bundle> _input_bundle; ///< bundle connected to our inputs
- boost::shared_ptr<Bundle> _output_bundle; ///< bundle connected to our outputs
bool no_panner_reset;
bool _phase_invert;
bool _denormal_protection;
@@ -310,13 +310,6 @@ class IO : public Automatable, public Latent
friend class Send;
- /* are these the best variable names ever, or what? */
-
- 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;
int connecting_became_legal ();
@@ -330,8 +323,21 @@ class IO : public Automatable, public Latent
ChanCount _output_minimum; ///< minimum number of output channels (0 for no minimum)
ChanCount _output_maximum; ///< maximum number of output channels (ChanCount::INFINITE for no maximum)
- boost::shared_ptr<Bundle> _bundle_for_inputs;
- boost::shared_ptr<Bundle> _bundle_for_outputs;
+ boost::shared_ptr<AutoBundle> _bundle_for_inputs; ///< a bundle representing our inputs
+ boost::shared_ptr<AutoBundle> _bundle_for_outputs; ///< a bundle representing our outputs
+
+ struct UserBundleInfo {
+ UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b);
+
+ boost::shared_ptr<UserBundle> bundle;
+ sigc::connection configuration_will_change;
+ sigc::connection configuration_has_changed;
+ sigc::connection ports_will_change;
+ sigc::connection ports_have_changed;
+ };
+
+ std::vector<UserBundleInfo> _bundles_connected_to_outputs; ///< user bundles connected to our outputs
+ std::vector<UserBundleInfo> _bundles_connected_to_inputs; ///< user bundles connected to our inputs
static int parse_io_string (const string&, vector<string>& chns);
@@ -343,13 +349,14 @@ class IO : public Automatable, public Latent
int ensure_inputs (ChanCount, bool clear, bool lockit, void *src);
int ensure_outputs (ChanCount, bool clear, bool lockit, void *src);
- void drop_input_bundle ();
- void drop_output_bundle ();
+ void check_bundles_connected_to_inputs ();
+ void check_bundles_connected_to_outputs ();
+ void check_bundles (std::vector<UserBundleInfo>&, const PortSet&);
- void input_bundle_configuration_changed ();
- void input_bundle_connection_changed (int);
- void output_bundle_configuration_changed ();
- void output_bundle_connection_changed (int);
+ void bundle_configuration_will_change ();
+ void bundle_configuration_has_changed ();
+ void bundle_ports_will_change (int);
+ void bundle_ports_have_changed (int);
int create_ports (const XMLNode&);
int make_connections (const XMLNode&);
@@ -363,8 +370,11 @@ class IO : public Automatable, public Latent
int32_t find_input_port_hole ();
int32_t find_output_port_hole ();
- void create_bundles ();
- void setup_bundles ();
+ void create_bundles_for_inputs_and_outputs ();
+ void setup_bundles_for_inputs_and_outputs ();
+
+ void maybe_add_input_bundle_to_list (boost::shared_ptr<Bundle>, std::vector<boost::shared_ptr<Bundle> >*);
+ void maybe_add_output_bundle_to_list (boost::shared_ptr<Bundle>, std::vector<boost::shared_ptr<Bundle> >*);
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index bbcae6e91d..e153914a09 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -489,7 +489,8 @@ class Session : public PBD::StatefulDestructible
void set_remote_control_ids();
- AudioEngine &engine() { return _engine; };
+ AudioEngine & engine() { return _engine; }
+ AudioEngine const & engine () const { return _engine; }
int32_t max_level;
int32_t min_level;
@@ -716,7 +717,6 @@ class Session : public PBD::StatefulDestructible
void add_bundle (boost::shared_ptr<Bundle>);
void remove_bundle (boost::shared_ptr<Bundle>);
boost::shared_ptr<Bundle> bundle_by_name (string) const;
- boost::shared_ptr<Bundle> bundle_by_ports (vector<string> const &) const;
sigc::signal<void,boost::shared_ptr<Bundle> > BundleAdded;
sigc::signal<void,boost::shared_ptr<Bundle> > BundleRemoved;
@@ -1564,7 +1564,8 @@ class Session : public PBD::StatefulDestructible
typedef list<boost::shared_ptr<Bundle> > BundleList;
mutable Glib::Mutex bundle_lock;
BundleList _bundles;
- int load_bundles (const XMLNode&);
+ XMLNode* _bundle_xml_node;
+ int load_bundles (XMLNode const &);
void reverse_diskstream_buffers ();
diff --git a/libs/ardour/ardour/user_bundle.h b/libs/ardour/ardour/user_bundle.h
new file mode 100644
index 0000000000..954e93d5d1
--- /dev/null
+++ b/libs/ardour/ardour/user_bundle.h
@@ -0,0 +1,72 @@
+/*
+ Copyright (C) 2007 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_user_bundle_h__
+#define __ardour_user_bundle_h__
+
+#include <vector>
+#include <glibmm/thread.h>
+#include "pbd/stateful.h"
+#include "ardour/bundle.h"
+
+namespace ARDOUR {
+
+class Session;
+
+class UserBundle : public Bundle, public PBD::Stateful {
+
+ public:
+ UserBundle (std::string const &);
+ UserBundle (XMLNode const &, bool);
+
+ uint32_t nchannels () const;
+ const ARDOUR::PortList& channel_ports (uint32_t) const;
+
+ void add_channel ();
+ void set_channels (uint32_t);
+ void remove_channel (uint32_t);
+ void add_port_to_channel (uint32_t, std::string const &);
+ void remove_port_from_channel (uint32_t, std::string const &);
+ bool port_attached_to_channel (uint32_t, std::string const &) const;
+ XMLNode& get_state ();
+
+ /// The number of channels is about to change
+ sigc::signal<void> ConfigurationWillChange;
+ /// The number of channels has changed
+ sigc::signal<void> ConfigurationHasChanged;
+ /// The port set associated with one of our channels is about to change
+ /// Parameter is the channel number
+ sigc::signal<void, int> PortsWillChange;
+ /// The port set associated with one of our channels has changed
+ /// Parameter is the channel number
+ sigc::signal<void, int> PortsHaveChanged;
+
+ private:
+
+ int set_state (const XMLNode &);
+
+ /// mutex for _ports;
+ /// XXX: is this necessary?
+ mutable Glib::Mutex _ports_mutex;
+ std::vector<PortList> _ports;
+};
+
+}
+
+#endif