summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorNikolaus Gullotta <nik@harrisonconsoles.com>2019-07-22 15:47:01 -0500
committerNikolaus Gullotta <nik@harrisonconsoles.com>2019-07-22 15:47:01 -0500
commit7d4f72174c2c5b97baf5fe5ec22f41ad28818925 (patch)
treebf944e4e8d27674d312b6169b7bd27a2614187d3 /libs
parentb5a50821fcf934f198483d5061ba8fcb791efcc9 (diff)
Location timestamp changes - can now sort by location creation date: lib ardour part
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/location.h3
-rw-r--r--libs/ardour/location.cc10
2 files changed, 10 insertions, 3 deletions
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h
index d31277ee71..f55f931731 100644
--- a/libs/ardour/ardour/location.h
+++ b/libs/ardour/ardour/location.h
@@ -23,6 +23,7 @@
#include <list>
#include <iostream>
#include <map>
+#include <ctime>
#include <sys/types.h>
@@ -69,6 +70,7 @@ public:
void lock ();
void unlock ();
+ time_t timestamp() { return _timestamp; };
samplepos_t start() const { return _start; }
samplepos_t end() const { return _end; }
samplecnt_t length() const { return _end - _start; }
@@ -160,6 +162,7 @@ private:
bool _locked;
PositionLockStyle _position_lock_style;
boost::shared_ptr<SceneChange> _scene_change;
+ time_t _timestamp;
void set_mark (bool yn);
bool set_flag_internal (bool yn, Flags flag);
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 24774c5fec..1b4b5a87c1 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -65,6 +65,7 @@ Location::Location (Session& s)
, _flags (Flags (0))
, _locked (false)
, _position_lock_style (AudioTime)
+ , _timestamp(time(0))
{
assert (_start >= 0);
assert (_end >= 0);
@@ -79,7 +80,7 @@ Location::Location (Session& s, samplepos_t sample_start, samplepos_t sample_end
, _flags (bits)
, _locked (false)
, _position_lock_style (s.config.get_glue_new_markers_to_bars_and_beats() ? MusicTime : AudioTime)
-
+ , _timestamp(time(0))
{
recompute_beat_from_samples (sub_num);
@@ -97,7 +98,7 @@ Location::Location (const Location& other)
, _end_beat (other._end_beat)
, _flags (other._flags)
, _position_lock_style (other._position_lock_style)
-
+ , _timestamp(time(0))
{
/* copy is not locked even if original was */
@@ -113,6 +114,7 @@ Location::Location (Session& s, const XMLNode& node)
: SessionHandleRef (s)
, _flags (Flags (0))
, _position_lock_style (AudioTime)
+ , _timestamp(time(0))
{
/* Note: _position_lock_style is initialised above in case set_state doesn't set it
(for 2.X session file compatibility).
@@ -599,7 +601,7 @@ Location::get_state ()
node->set_property ("flags", _flags);
node->set_property ("locked", _locked);
node->set_property ("position-lock-style", _position_lock_style);
-
+ node->set_property ("timestamp", _timestamp);
if (_scene_change) {
node->add_child_nocopy (_scene_change->get_state());
}
@@ -648,6 +650,8 @@ Location::set_state (const XMLNode& node, int version)
return -1;
}
+ node.get_property ("timestamp", _timestamp);
+
Flags old_flags (_flags);
if (!node.get_property ("flags", _flags)) {