(Source List) Region Tags (libardour part)
authorBen Loftis <ben@harrisonconsoles.com>
Sat, 20 Oct 2018 01:02:44 +0000 (20:02 -0500)
committerBen Loftis <ben@harrisonconsoles.com>
Thu, 1 Aug 2019 17:11:31 +0000 (12:11 -0500)
Rough-in: Region-Tags.

More correct implementation of tags property (libardour).

Region Tags (libardour part)

libs/ardour/ardour/region.h
libs/ardour/ardour/session.h
libs/ardour/region.cc
libs/ardour/session.cc

index 61a676f5a0b6a99d8949416ff0b6c87e1341d2be..d676db1d1e7d1511fd2f8916e6b0c2fd80b17c0e 100644 (file)
@@ -67,6 +67,7 @@ namespace Properties {
        LIBARDOUR_API extern PBD::PropertyDescriptor<float>             shift;
        LIBARDOUR_API extern PBD::PropertyDescriptor<PositionLockStyle> position_lock_style;
        LIBARDOUR_API extern PBD::PropertyDescriptor<uint64_t>          layering_index;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<std::string>               tags;
 };
 
 class Playlist;
@@ -282,6 +283,17 @@ public:
        virtual boost::shared_ptr<const Evoral::Control>
        control (const Evoral::Parameter& id) const = 0;
 
+       /* tags */
+
+       std::string tags()    const { return _tags; }
+       virtual bool set_tags (const std::string& str) {
+               if (_tags != str) {
+                       _tags = str;
+                       PropertyChanged (PBD::PropertyChange (Properties::tags));
+               }
+               return true;
+       }
+
        /* serialization */
 
        XMLNode&         get_state ();
@@ -451,6 +463,7 @@ private:
        PBD::Property<float>       _shift;
        PBD::EnumProperty<PositionLockStyle> _position_lock_style;
        PBD::Property<uint64_t>    _layering_index;
+       PBD::Property<std::string> _tags;
 
        samplecnt_t             _last_length;
        samplepos_t             _last_position;
index dac08af29bc7e8272368063a9c299c7c7952d53c..11406c5ca0169c97b3be71fdfd30143243e6d463 100644 (file)
@@ -780,6 +780,7 @@ public:
        int destroy_sources (std::list<boost::shared_ptr<Source> >);
 
        int remove_last_capture ();
+       void get_last_capture_sources (std::list<boost::shared_ptr<Source> >&);
 
        /** handlers should return 0 for "everything OK", and any other value for
         * "cannot setup audioengine".
index 4c20e2236a735ad76f517cbeca7ce537e23ed35b..94eb4ca27e6d261db48b741b75a3254fe8e35cac 100644 (file)
@@ -75,6 +75,7 @@ namespace ARDOUR {
                PBD::PropertyDescriptor<float> shift;
                PBD::PropertyDescriptor<PositionLockStyle> position_lock_style;
                PBD::PropertyDescriptor<uint64_t> layering_index;
+               PBD::PropertyDescriptor<std::string> tags;
        }
 }
 
@@ -134,7 +135,9 @@ Region::make_property_quarks ()
        Properties::position_lock_style.property_id = g_quark_from_static_string (X_("positional-lock-style"));
        DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for position_lock_style = %1\n", Properties::position_lock_style.property_id));
        Properties::layering_index.property_id = g_quark_from_static_string (X_("layering-index"));
-       DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for layering_index = %1\n", Properties::layering_index.property_id));
+       DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for layering_index = %1\n",      Properties::layering_index.property_id));
+       Properties::tags.property_id = g_quark_from_static_string (X_("tags"));
+       DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for tags = %1\n",        Properties::tags.property_id));
 }
 
 void
@@ -167,6 +170,7 @@ Region::register_properties ()
        add_property (_shift);
        add_property (_position_lock_style);
        add_property (_layering_index);
+       add_property (_tags);
 }
 
 #define REGION_DEFAULT_STATE(s,l) \
@@ -199,7 +203,8 @@ Region::register_properties ()
        , _stretch (Properties::stretch, 1.0) \
        , _shift (Properties::shift, 1.0) \
        , _position_lock_style (Properties::position_lock_style, _type == DataType::AUDIO ? AudioTime : MusicTime) \
-       , _layering_index (Properties::layering_index, 0)
+       , _layering_index (Properties::layering_index, 0) \
+       , _tags (Properties::tags, "")
 
 #define REGION_COPY_STATE(other) \
          _sync_marked (Properties::sync_marked, other->_sync_marked) \
@@ -233,7 +238,8 @@ Region::register_properties ()
        , _stretch (Properties::stretch, other->_stretch) \
        , _shift (Properties::shift, other->_shift) \
        , _position_lock_style (Properties::position_lock_style, other->_position_lock_style) \
-       , _layering_index (Properties::layering_index, other->_layering_index)
+       , _layering_index (Properties::layering_index, other->_layering_index) \
+       , _tags (Properties::tags, other->_tags)
 
 /* derived-from-derived constructor (no sources in constructor) */
 Region::Region (Session& s, samplepos_t start, samplecnt_t length, const string& name, DataType type)
@@ -1982,3 +1988,4 @@ Region::latest_possible_sample () const
 
        return _position + (minlen - _start) - 1;
 }
+
index eb55e55508b92c964821d516be21489391a3bc4a..4bb8742ed0c6c67b93b053160cee2247b60f32f4 100644 (file)
@@ -4824,6 +4824,25 @@ Session::remove_last_capture ()
        return 0;
 }
 
+void
+Session::get_last_capture_sources (std::list<boost::shared_ptr<Source> >& srcs)
+{
+       boost::shared_ptr<RouteList> rl = routes.reader ();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (!tr) {
+                       continue;
+               }
+
+               list<boost::shared_ptr<Source> >& l = tr->last_capture_sources();
+
+               if (!l.empty()) {
+                       srcs.insert (srcs.end(), l.begin(), l.end());
+                       l.clear ();
+               }
+       }
+}
+
 /* Source Management */
 
 void