static std::string default_name_template ();
static int next_vca_number ();
static std::string xml_node_name;
+ static void set_next_vca_number (uint32_t);
virtual boost::shared_ptr<GainControl> gain_control() const { return _gain_control; }
virtual boost::shared_ptr<AutomationControl> solo_control() const { return _solo_control; }
snprintf (buf, sizeof (buf), "%d", Evoral::event_id_counter());
node->add_property ("event-counter", buf);
+ /* save the VCA counter */
+
+ snprintf (buf, sizeof (buf), "%" PRIu32, VCA::next_vca_number());
+ node->add_property ("vca-counter", buf);
+
/* various options */
list<XMLNode*> midi_port_nodes = _midi_ports->get_midi_port_states();
Evoral::init_event_id_counter (atoi (prop->value()));
}
+ if ((prop = node.property (X_("vca-counter"))) != 0) {
+ uint32_t x;
+ sscanf (prop->value().c_str(), "%" PRIu32, &x);
+ VCA::set_next_vca_number (x);
+ } else {
+ VCA::set_next_vca_number (1);
+ }
+
if ((child = find_named_node (node, "MIDIPorts")) != 0) {
_midi_ports->set_midi_port_states (child->children());
}
using namespace PBD;
using std::string;
-gint VCA::next_number = 0;
+gint VCA::next_number = 1;
string VCA::xml_node_name (X_("VCA"));
string
int
VCA::next_vca_number ()
{
- /* recall that atomic_int_add() returns the value before the add */
- return g_atomic_int_add (&next_number, 1) + 1;
+ /* recall that atomic_int_add() returns the value before the add. We
+ * start at one, then next one will be two etc.
+ */
+ return g_atomic_int_add (&next_number, 1);
+}
+
+void
+VCA::set_next_vca_number (uint32_t n)
+{
+ g_atomic_int_set (&next_number, n);
}
VCA::VCA (Session& s, uint32_t num, const string& name)