add a bit of state to VCAs
This commit is contained in:
parent
33e56e58d7
commit
4478bdc1d1
@ -23,6 +23,7 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "pbd/controllable.h"
|
||||
#include "pbd/statefuldestructible.h"
|
||||
|
||||
#include "ardour/session_handle.h"
|
||||
|
||||
@ -31,13 +32,15 @@ namespace ARDOUR {
|
||||
class GainControl;
|
||||
class Route;
|
||||
|
||||
class LIBARDOUR_API VCA : public SessionHandleRef {
|
||||
class LIBARDOUR_API VCA : public SessionHandleRef, public PBD::StatefulDestructible {
|
||||
public:
|
||||
VCA (Session& session, const std::string& name, uint32_t num);
|
||||
|
||||
std::string name() const { return _name; }
|
||||
uint32_t number () const { return _number; }
|
||||
|
||||
void set_name (std::string const&);
|
||||
|
||||
void set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
|
||||
double get_value () const;
|
||||
|
||||
@ -46,8 +49,13 @@ class LIBARDOUR_API VCA : public SessionHandleRef {
|
||||
void add (boost::shared_ptr<Route>);
|
||||
void remove (boost::shared_ptr<Route>);
|
||||
|
||||
XMLNode& get_state();
|
||||
int set_state (XMLNode const&, int version);
|
||||
|
||||
static std::string default_name_template ();
|
||||
static int next_vca_number ();
|
||||
static std::string xml_node_name;
|
||||
|
||||
private:
|
||||
uint32_t _number;
|
||||
std::string _name;
|
||||
|
@ -16,6 +16,8 @@
|
||||
675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "pbd/convert.h"
|
||||
|
||||
#include "ardour/automation_control.h"
|
||||
#include "ardour/gain_control.h"
|
||||
#include "ardour/route.h"
|
||||
@ -28,6 +30,7 @@ using namespace PBD;
|
||||
using std::string;
|
||||
|
||||
gint VCA::next_number = 0;
|
||||
string VCA::xml_node_name (X_("VCA"));
|
||||
|
||||
string
|
||||
VCA::default_name_template ()
|
||||
@ -74,3 +77,34 @@ VCA::remove (boost::shared_ptr<Route> r)
|
||||
{
|
||||
r->gain_control()->remove_master (_control);
|
||||
}
|
||||
|
||||
void
|
||||
VCA::set_name (string const& str)
|
||||
{
|
||||
_name = str;
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
VCA::get_state ()
|
||||
{
|
||||
XMLNode* node = new XMLNode (xml_node_name);
|
||||
node->add_property (X_("name"), _name);
|
||||
node->add_property (X_("number"), _number);
|
||||
return *node;
|
||||
}
|
||||
|
||||
int
|
||||
VCA::set_state (XMLNode const& node, int /*version*/)
|
||||
{
|
||||
XMLProperty const* prop;
|
||||
|
||||
if ((prop = node.property ("name")) != 0) {
|
||||
set_name (prop->value());
|
||||
}
|
||||
|
||||
if ((prop = node.property ("number")) != 0) {
|
||||
_number = atoi (prop->value());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user