summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-06-11 15:35:34 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-06-11 15:35:34 +0000
commit106024330230fca331e2f611fec42ec1f4f43e5a (patch)
tree56342e0e544be5223d2fa360caaec80ac0fe6fa4 /libs/ardour
parent7468fdb9ca9892cec9b298690bf0edf3655d6453 (diff)
major, substantive reworking of how we store GUI information (visibility, height) for automation data. old design stored (insufficient) identifying information plus actual data in a GUI-only XML node; new scheme adds GUI data via extra_xml node to each AutomationControl object. reworked public/private methods for showing/hiding TimeAxisView objects; changed labelling of automation tracks to just show the name of the controlled parameter - more info can be viewed in the tooltip for the track headers. NOTE: Session file format ALTERED. No data loss but track visibility may be different than previous ardour3 versions
git-svn-id: svn://localhost/ardour2/branches/3.0@9703 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/automatable.h7
-rw-r--r--libs/ardour/automatable.cc52
-rw-r--r--libs/ardour/event_type_map.cc2
-rw-r--r--libs/ardour/pannable.cc75
-rw-r--r--libs/ardour/processor.cc37
-rw-r--r--libs/ardour/rc_configuration.cc4
-rw-r--r--libs/ardour/region.cc10
-rw-r--r--libs/ardour/route.cc12
-rw-r--r--libs/ardour/session_state.cc4
9 files changed, 34 insertions, 169 deletions
diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h
index 69ef7d3ecb..dc86c0cddd 100644
--- a/libs/ardour/ardour/automatable.h
+++ b/libs/ardour/ardour/automatable.h
@@ -73,10 +73,8 @@ public:
void protect_automation ();
- void what_has_visible_data(std::set<Evoral::Parameter>&) const;
const std::set<Evoral::Parameter>& what_can_be_automated() const { return _can_automate_list; }
-
- void mark_automation_visible(Evoral::Parameter, bool);
+ void what_has_existing_automation (std::set<Evoral::Parameter>&) const;
inline bool should_snapshot (framepos_t now) {
return (_last_automation_snapshot > now
@@ -91,8 +89,6 @@ public:
return _automation_interval;
}
- typedef Evoral::ControlSet::Controls Controls;
-
static const std::string xml_node_name;
int set_automation_xml_state (const XMLNode&, Evoral::Parameter default_param);
@@ -108,7 +104,6 @@ public:
int load_automation (const std::string& path);
int old_set_automation_state(const XMLNode&);
- std::set<Evoral::Parameter> _visible_controls;
std::set<Evoral::Parameter> _can_automate_list;
framepos_t _last_automation_snapshot;
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index 8c17a99bea..6d8114939d 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -79,22 +79,6 @@ Automatable::old_set_automation_state (const XMLNode& node)
warning << _("Automation node has no path property") << endmsg;
}
- if ((prop = node.property ("visible")) != 0) {
- uint32_t what;
- stringstream sstr;
-
- _visible_controls.clear ();
-
- sstr << prop->value();
- while (1) {
- sstr >> what;
- if (sstr.fail()) {
- break;
- }
- mark_automation_visible (Evoral::Parameter(PluginAutomation, 0, what), true);
- }
- }
-
_last_automation_snapshot = 0;
return 0;
@@ -167,17 +151,6 @@ Automatable::add_control(boost::shared_ptr<Evoral::Control> ac)
automation_list_automation_state_changed (param, al->automation_state ()); // sync everything up
}
-void
-Automatable::what_has_visible_data(set<Evoral::Parameter>& s) const
-{
- Glib::Mutex::Lock lm (control_lock());
- set<Evoral::Parameter>::const_iterator li;
-
- for (li = _visible_controls.begin(); li != _visible_controls.end(); ++li) {
- s.insert (*li);
- }
-}
-
string
Automatable::describe_parameter (Evoral::Parameter param)
{
@@ -205,20 +178,6 @@ Automatable::can_automate (Evoral::Parameter what)
_can_automate_list.insert (what);
}
-void
-Automatable::mark_automation_visible (Evoral::Parameter what, bool yn)
-{
- if (yn) {
- _visible_controls.insert (what);
- } else {
- set<Evoral::Parameter>::iterator i;
-
- if ((i = _visible_controls.find (what)) != _visible_controls.end()) {
- _visible_controls.erase (i);
- }
- }
-}
-
/** \a legacy_param is used for loading legacy sessions where an object (IO, Panner)
* had a single automation parameter, with it's type implicit. Derived objects should
* pass that type and it will be used for the untyped AutomationList found.
@@ -230,8 +189,6 @@ Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter le
/* Don't clear controls, since some may be special derived Controllable classes */
- _visible_controls.clear ();
-
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
@@ -292,8 +249,7 @@ Automatable::get_automation_xml_state ()
}
for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) {
- boost::shared_ptr<AutomationList> l
- = boost::dynamic_pointer_cast<AutomationList>(li->second->list());
+ boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(li->second->list());
if (!l->empty()) {
node->add_child_nocopy (l->get_state ());
}
@@ -364,11 +320,9 @@ void
Automatable::protect_automation ()
{
typedef set<Evoral::Parameter> ParameterSet;
- ParameterSet automated_params;
-
- what_has_data(automated_params);
+ const ParameterSet& automated_params = what_can_be_automated ();
- for (ParameterSet::iterator i = automated_params.begin(); i != automated_params.end(); ++i) {
+ for (ParameterSet::const_iterator i = automated_params.begin(); i != automated_params.end(); ++i) {
boost::shared_ptr<Evoral::Control> c = control(*i);
boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list());
diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc
index 2a45ba672c..4b21d32e58 100644
--- a/libs/ardour/event_type_map.cc
+++ b/libs/ardour/event_type_map.cc
@@ -244,7 +244,7 @@ EventTypeMap::new_parameter(const string& str) const
} else {
PBD::warning << "Unknown Parameter '" << str << "'" << endmsg;
}
-
+
return new_parameter(p_type, p_channel, p_id);
}
diff --git a/libs/ardour/pannable.cc b/libs/ardour/pannable.cc
index 4de47fc62b..e020c19451 100644
--- a/libs/ardour/pannable.cc
+++ b/libs/ardour/pannable.cc
@@ -185,33 +185,12 @@ XMLNode&
Pannable::state (bool full)
{
XMLNode* node = new XMLNode (X_("Pannable"));
- XMLNode* control_node;
- char buf[32];
-
- control_node = new XMLNode (X_("azimuth"));
- snprintf (buf, sizeof(buf), "%.12g", pan_azimuth_control->get_value());
- control_node->add_property (X_("value"), buf);
- node->add_child_nocopy (*control_node);
-
- control_node = new XMLNode (X_("width"));
- snprintf (buf, sizeof(buf), "%.12g", pan_width_control->get_value());
- control_node->add_property (X_("value"), buf);
- node->add_child_nocopy (*control_node);
-
- control_node = new XMLNode (X_("elevation"));
- snprintf (buf, sizeof(buf), "%.12g", pan_elevation_control->get_value());
- control_node->add_property (X_("value"), buf);
- node->add_child_nocopy (*control_node);
-
- control_node = new XMLNode (X_("frontback"));
- snprintf (buf, sizeof(buf), "%.12g", pan_frontback_control->get_value());
- control_node->add_property (X_("value"), buf);
- node->add_child_nocopy (*control_node);
-
- control_node = new XMLNode (X_("lfe"));
- snprintf (buf, sizeof(buf), "%.12g", pan_lfe_control->get_value());
- control_node->add_property (X_("value"), buf);
- node->add_child_nocopy (*control_node);
+
+ node->add_child_nocopy (pan_azimuth_control->get_state());
+ node->add_child_nocopy (pan_width_control->get_state());
+ node->add_child_nocopy (pan_elevation_control->get_state());
+ node->add_child_nocopy (pan_frontback_control->get_state());
+ node->add_child_nocopy (pan_lfe_control->get_state());
node->add_child_nocopy (get_automation_xml_state ());
@@ -219,45 +198,27 @@ Pannable::state (bool full)
}
int
-Pannable::set_state (const XMLNode& root, int /*version - not used*/)
+Pannable::set_state (const XMLNode& root, int version)
{
if (root.name() != X_("Pannable")) {
warning << string_compose (_("Pannable given XML data for %1 - ignored"), root.name()) << endmsg;
return -1;
}
- XMLNodeList nlist;
+ const XMLNodeList& nlist (root.children());
XMLNodeConstIterator niter;
- const XMLProperty *prop;
-
- nlist = root.children();
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
- if ((*niter)->name() == X_("azimuth")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_azimuth_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == X_("width")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_width_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == X_("elevation")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_elevation_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == X_("azimuth")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_frontback_control->set_value (atof (prop->value()));
- }
- } else if ((*niter)->name() == X_("lfe")) {
- prop = (*niter)->property (X_("value"));
- if (prop) {
- pan_lfe_control->set_value (atof (prop->value()));
- }
+ if ((*niter)->name() == pan_azimuth_control->name()) {
+ pan_azimuth_control->set_state (**niter, version);
+ } else if ((*niter)->name() == pan_width_control->name()) {
+ pan_width_control->set_state (**niter, version);
+ } else if ((*niter)->name() == pan_elevation_control->name()) {
+ pan_elevation_control->set_state (**niter, version);
+ } else if ((*niter)->name() == pan_frontback_control->name()) {
+ pan_frontback_control->set_state (**niter, version);
+ } else if ((*niter)->name() == pan_lfe_control->name()) {
+ pan_lfe_control->set_state (**niter, version);
} else if ((*niter)->name() == Automatable::xml_node_name) {
set_automation_xml_state (**niter, PanAzimuthAutomation);
}
diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc
index bb004c313d..bf4a8ea6cb 100644
--- a/libs/ardour/processor.cc
+++ b/libs/ardour/processor.cc
@@ -123,21 +123,7 @@ Processor::state (bool full_state)
if (full_state) {
XMLNode& automation = Automatable::get_automation_xml_state();
- if (!automation.children().empty()
- || !automation.properties().empty()
- || !_visible_controls.empty()) {
-
- stringstream sstr;
- for (set<Evoral::Parameter>::iterator x = _visible_controls.begin();
- x != _visible_controls.end(); ++x) {
-
- if (x != _visible_controls.begin()) {
- sstr << ' ';
- }
- sstr << (*x).id();
- }
-
- automation.add_property ("visible", sstr.str());
+ if (!automation.children().empty() || !automation.properties().empty()) {
node->add_child_nocopy (automation);
}
}
@@ -206,6 +192,8 @@ Processor::set_state (const XMLNode& node, int version)
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
+ Stateful::save_extra_xml (node);
+
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() == X_("Automation")) {
@@ -218,25 +206,6 @@ Processor::set_state (const XMLNode& node, int version)
set_automation_xml_state (*(*niter), Evoral::Parameter(PluginAutomation));
}
- if ((prop = (*niter)->property ("visible")) != 0) {
- uint32_t what;
- stringstream sstr;
-
- _visible_controls.clear ();
-
- sstr << prop->value();
- while (1) {
- sstr >> what;
- if (sstr.fail()) {
- break;
- }
- // FIXME: other automation types?
- mark_automation_visible (Evoral::Parameter(PluginAutomation, 0, what), true);
- }
- }
-
- } else if ((*niter)->name() == "Extra") {
- _extra_xml = new XMLNode (*(*niter));
} else if ((*niter)->name() == "Redirect") {
if ( !(legacy_active = (*niter)->property("active"))) {
error << string_compose(_("No %1 property flag in element %2"), "active", (*niter)->name()) << endl;
diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc
index a17fd9f5a5..1dc1ea636b 100644
--- a/libs/ardour/rc_configuration.cc
+++ b/libs/ardour/rc_configuration.cc
@@ -268,14 +268,14 @@ RCConfiguration::set_state (const XMLNode& root, int /*version*/)
_midi_port_states.clear ();
+ Stateful::save_extra_xml (root);
+
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
node = *niter;
if (node->name() == "Config") {
set_variables (*node);
- } else if (node->name() == "Extra") {
- _extra_xml = new XMLNode (*node);
} else if (node->name() == ControlProtocolManager::state_node_name) {
_control_protocol_state = new XMLNode (*node);
} else if (node->name() == MIDI::Port::state_node_name) {
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 17698d88a7..30a0b6f24a 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1251,15 +1251,7 @@ Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_c
const XMLProperty* prop;
const XMLNodeList& nlist = node.children();
- for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
-
- XMLNode *child = (*niter);
-
- if (child->name () == "Extra") {
- delete _extra_xml;
- _extra_xml = new XMLNode (*child);
- }
- }
+ Stateful::save_extra_xml (node);
what_changed = set_values (node);
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 0e8c93d75e..459ea67480 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -1902,6 +1902,8 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
nlist = node.children();
XMLNode processor_state (X_("processor_state"));
+ Stateful::save_extra_xml (node);
+
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
child = *niter;
@@ -2015,10 +2017,6 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
XMLNode *cmt = *(child->children().begin());
_comment = cmt->content();
- } else if (child->name() == X_("Extra")) {
-
- _extra_xml = new XMLNode (*child);
-
} else if (child->name() == Controllable::xml_node_name && (prop = child->property("name")) != 0) {
if (prop->value() == "solo") {
_solo_control->set_state (*child, version);
@@ -2255,6 +2253,8 @@ Route::_set_state_2X (const XMLNode& node, int version)
set_processor_state_2X (redirect_nodes, version);
+ Stateful::save_extra_xml (node);
+
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
child = *niter;
@@ -2265,10 +2265,6 @@ Route::_set_state_2X (const XMLNode& node, int version)
XMLNode *cmt = *(child->children().begin());
_comment = cmt->content();
- } else if (child->name() == X_("extra")) {
-
- _extra_xml = new XMLNode (*child);
-
} else if (child->name() == Controllable::xml_node_name && (prop = child->property("name")) != 0) {
if (prop->value() == X_("solo")) {
_solo_control->set_state (*child, version);
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 182b399877..5d9967cc98 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -1250,9 +1250,7 @@ Session::set_state (const XMLNode& node, int version)
IO::disable_connecting ();
- if ((child = find_named_node (node, "Extra")) != 0) {
- _extra_xml = new XMLNode (*child);
- }
+ Stateful::save_extra_xml (node);
if (((child = find_named_node (node, "Options")) != 0)) { /* old style */
load_options (*child);