13
0

Location timestamp changes - can now sort by location creation date: lib ardour part

This commit is contained in:
Nikolaus Gullotta 2019-07-22 15:47:01 -05:00
parent b5a50821fc
commit 7d4f72174c
2 changed files with 10 additions and 3 deletions

View File

@ -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);

View File

@ -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)) {