13
0

(Source List) Take-ID: new (working) implementation.

This commit is contained in:
Ben Loftis 2018-10-13 08:36:43 -05:00
parent afb987d698
commit 949450bbb5
4 changed files with 18 additions and 2 deletions

View File

@ -56,7 +56,6 @@ public:
void mark_immutable_except_write();
void mark_nonremovable ();
const std::string& take_id () const { return _take_id; }
bool within_session () const { return _within_session; }
uint16_t channel() const { return _channel; }
float gain() const { return _gain; }
@ -110,7 +109,6 @@ public:
void set_within_session_from_path (const std::string&);
std::string _path;
std::string _take_id;
bool _file_is_new;
uint16_t _channel;
bool _within_session;

View File

@ -68,6 +68,9 @@ public:
virtual samplecnt_t length (samplepos_t pos) const = 0;
virtual void update_length (samplecnt_t cnt) = 0;
void set_take_id (std::string id) { _take_id =id; }
const std::string& take_id () const { return _take_id; }
virtual samplepos_t natural_position() const { return 0; }
void mark_for_remove();
@ -120,6 +123,7 @@ protected:
DataType _type;
Flag _flags;
time_t _timestamp;
std::string _take_id;
samplepos_t _timeline_position;
bool _analysed;
@ -131,6 +135,7 @@ protected:
std::string _ancestor_name;
private:
void fix_writable_flags ();
};

View File

@ -1216,6 +1216,10 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
as->set_captured_for (_name.val());
as->mark_immutable ();
char buf[128];
strftime (buf, sizeof(buf), "%F %H.%M.%S", &when);
as->set_take_id ( buf );
if (Config->get_auto_analyse_audio()) {
Analyser::queue_source_for_analysis (as, true);
}
@ -1258,6 +1262,10 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
_midi_write_source->set_timeline_position (capture_info.front()->start);
_midi_write_source->set_captured_for (_name);
char buf[128];
strftime (buf, sizeof(buf), "%F %H.%M.%S", &when);
_midi_write_source->set_take_id ( buf );
/* set length in beats to entire capture length */
BeatsSamplesConverter converter (_session.tempo_map(), capture_info.front()->start);

View File

@ -102,6 +102,7 @@ Source::get_state ()
XMLNode *node = new XMLNode ("Source");
node->set_property ("name", name());
node->set_property ("take-id", take_id());
node->set_property ("type", _type);
node->set_property (X_("flags"), _flags);
node->set_property ("id", id());
@ -137,6 +138,10 @@ Source::set_state (const XMLNode& node, int version)
if (!node.get_property (X_("flags"), _flags)) {
_flags = Flag (0);
}
if (!node.get_property (X_("take-id"), _take_id)) {
_take_id = "";
}
/* old style, from the period when we had DestructiveFileSource */
if (node.get_property (X_("destructive"), str)) {