diff options
author | Robin Gareus <robin@gareus.org> | 2013-07-09 01:25:54 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2013-07-10 15:27:14 +0200 |
commit | 24f2961cce98f296ef6c1824cce86c241bb120e6 (patch) | |
tree | 59ec591011a23548d39c321880cac3047247b4f3 /libs | |
parent | 4d49961c93fe23dc4f76a5bcb60c93d0c80bcd3c (diff) |
...towards unique track numbers.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/route.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 1 | ||||
-rw-r--r-- | libs/ardour/route.cc | 8 | ||||
-rw-r--r-- | libs/ardour/session.cc | 3 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 7 |
5 files changed, 23 insertions, 0 deletions
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 2e44d00984..134b153b4b 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -184,6 +184,9 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, void set_meter_type (MeterType t) { _meter_type = t; } MeterType meter_type() const { return _meter_type; } + void set_unique_id (uint32_t id) { _unique_id = id; } + uint32_t unique_id() const { return _unique_id; } + /* Processors */ boost::shared_ptr<Amp> amp() const { return _amp; } @@ -495,6 +498,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, uint32_t _soloed_by_others_upstream; uint32_t _soloed_by_others_downstream; uint32_t _solo_isolated; + uint32_t _unique_id; bool _denormal_protection; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a149224607..c3695de1dc 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -929,6 +929,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi bool _writable; bool _was_seamless; bool _under_nsm_control; + uint32_t _unique_track_number; void initialize_latencies (); void set_worst_io_latencies (); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index e87cb4b03f..9d121f6055 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -88,6 +88,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type) , _soloed_by_others_upstream (0) , _soloed_by_others_downstream (0) , _solo_isolated (0) + , _unique_id (0) , _denormal_protection (false) , _recordable (true) , _silent (false) @@ -1881,6 +1882,9 @@ Route::state(bool full_state) node->add_property("meter-type", enum_2_string (_meter_type)); + snprintf (buf, sizeof (buf), "%d", _unique_id); + node->add_property("unique-id", buf); + if (_route_group) { node->add_property("route-group", _route_group->name()); } @@ -2059,6 +2063,10 @@ Route::set_state (const XMLNode& node, int version) _meter_type = MeterType (string_2_enum (prop->value (), _meter_type)); } + if ((prop = node.property (X_("unique-id"))) != 0) { + _unique_id = atoi(prop->value()); + } + set_processor_state (processor_state); // this looks up the internal instrument in processors diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 914c6a9a77..e7dde4d225 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -134,6 +134,7 @@ Session::Session (AudioEngine &eng, , _target_transport_speed (0.0) , _requested_return_frame (-1) , _under_nsm_control (false) + , _unique_track_number (0) , _session_dir (new SessionDirectory(fullpath)) , state_tree (0) , _state_of_the_state (Clean) @@ -1649,6 +1650,7 @@ Session::new_midi_track (const ChanCount& input, const ChanCount& output, boost: try { track.reset (new MidiTrack (*this, track_name, Route::Flag (0), mode)); + track->set_unique_id(++_unique_track_number); if (track->init ()) { goto failed; @@ -1884,6 +1886,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod try { track.reset (new AudioTrack (*this, track_name, Route::Flag (0), mode)); + track->set_unique_id(++_unique_track_number); if (track->init ()) { goto failed; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 49a0eed559..59e0331383 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1033,6 +1033,9 @@ Session::state (bool full_state) snprintf (buf, sizeof (buf), "%" PRIu64, ID::counter()); node->add_property ("id-counter", buf); + snprintf (buf, sizeof (buf), "%d", _unique_track_number); + node->add_property ("trackid-counter", buf); + /* save the event ID counter */ snprintf (buf, sizeof (buf), "%d", Evoral::event_id_counter()); @@ -1241,6 +1244,10 @@ Session::set_state (const XMLNode& node, int version) ID::init_counter (now); } + if ((prop = node.property (X_("trackid-counter"))) != 0) { + _unique_track_number = atoi (prop->value()); + } + if ((prop = node.property (X_("event-counter"))) != 0) { Evoral::init_event_id_counter (atoi (prop->value())); } |