(Source List) Take-ID: new (working) implementation.
authorBen Loftis <ben@harrisonconsoles.com>
Sat, 13 Oct 2018 13:36:43 +0000 (08:36 -0500)
committerBen Loftis <ben@harrisonconsoles.com>
Thu, 1 Aug 2019 17:11:31 +0000 (12:11 -0500)
libs/ardour/ardour/file_source.h
libs/ardour/ardour/source.h
libs/ardour/disk_writer.cc
libs/ardour/source.cc

index 7452e9fb5baca961d96d5d2293194124ee04d8c5..976a28bee0b1a97eb585cd16ca27f2fe95bcaae1 100644 (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;
index 1e1fde2f89e1157cfdb2c4f51be0233afc4c7a57..e3a386b97a6cff8ad45cd059d3a82751e044f7b6 100644 (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 ();
 };
 
index 541d5ff3cbaa3cce86449b92cc3ac51375aaee07..e8c380f8d4dd50bc9363e68fb4f63eed04b04fa9 100644 (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);
index 6ae1aca1ca1defcd9afaafd7373daf1b997cfd32..412f78c886ab91a7a482bb51282fe8a8b96d6759 100644 (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)) {