X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fevoral%2Fevoral%2FControlList.hpp;h=6353813097c18355b6c0015129a8f3a8f597b1b7;hb=2b69fa6edffd9f37f7d9418e4acac467300d988a;hp=0774cc528afdfbd2f8b690f50ed57edcfaa06ed6;hpb=f049d0294c8e48b8d1f1ffa131fe7d687d8aa519;p=ardour.git diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp index 0774cc528a..6353813097 100644 --- a/libs/evoral/evoral/ControlList.hpp +++ b/libs/evoral/evoral/ControlList.hpp @@ -21,19 +21,25 @@ #include #include +#include + #include #include + #include + #include "pbd/signals.h" #include "evoral/visibility.h" #include "evoral/types.hpp" #include "evoral/Range.hpp" #include "evoral/Parameter.hpp" +#include "evoral/ParameterDescriptor.hpp" namespace Evoral { class Curve; +class TypeMap; /** A single event (time-stamped value) for a control */ @@ -78,12 +84,12 @@ public: typedef EventList::const_iterator const_iterator; typedef EventList::const_reverse_iterator const_reverse_iterator; - ControlList (const Parameter& id); + ControlList (const Parameter& id, const ParameterDescriptor& desc); ControlList (const ControlList&); ControlList (const ControlList&, double start, double end); virtual ~ControlList(); - virtual boost::shared_ptr create(Parameter id); + virtual boost::shared_ptr create(const Parameter& id, const ParameterDescriptor& desc); void dump (std::ostream&); @@ -98,6 +104,9 @@ public: const Parameter& parameter() const { return _parameter; } void set_parameter(const Parameter& p) { _parameter = p; } + const ParameterDescriptor& descriptor() const { return _desc; } + void set_descriptor(const ParameterDescriptor& d) { _desc = d; } + EventList::size_type size() const { return _events.size(); } double length() const { Glib::Threads::Mutex::Lock lm (_lock); @@ -115,9 +124,9 @@ public: void slide (iterator before, double distance); void shift (double before, double distance); - virtual bool clamp_value (double& /*when*/, double& /*value*/) const { return true; } - - virtual void add (double when, double value, bool with_guards=true); + virtual void add (double when, double value, bool with_guards=true, bool with_default=true); + virtual void editor_add (double when, double value); + void fast_simple_add (double when, double value); void erase_range (double start, double end); @@ -127,13 +136,26 @@ public: bool move_ranges (std::list< RangeMove > const &); void modify (iterator, double, double); - void thin (); + /** Thin the number of events in this list. + * + * The thinning factor has no units but corresponds to the area of a + * triangle computed between three points in the list. If the area is + * large, it indicates significant non-linearity between the points. + * + * During automation recording we thin the recorded points using this + * value. If a point is sufficiently co-linear with its neighbours (as + * defined by the area of the triangle formed by three of them), we will + * not include it in the list. The larger the value, the more points are + * excluded, so this effectively measures the amount of thinning to be + * done. + */ + void thin (double thinning_factor); boost::shared_ptr cut (double, double); boost::shared_ptr copy (double, double); void clear (double, double); - bool paste (ControlList&, double position, float times); + bool paste (const ControlList&, double position, float times); void set_yrange (double min, double max) { _min_yval = min; @@ -201,7 +223,7 @@ public: }; const EventList& events() const { return _events; } - double default_value() const { return _parameter.normal(); } + double default_value() const { return _default_value; } // FIXME: const violations for Curve Glib::Threads::Mutex& lock() const { return _lock; } @@ -241,7 +263,7 @@ public: virtual bool writing() const { return false; } virtual bool touch_enabled() const { return false; } void start_write_pass (double time); - void write_pass_finished (double when); + void write_pass_finished (double when, double thinning_factor=0.0); void set_in_write_pass (bool, bool add_point = false, double when = 0.0); bool in_write_pass () const; @@ -250,9 +272,6 @@ public: /** Emitted when our interpolation style changes */ PBD::Signal1 InterpolationChanged; - static void set_thinning_factor (double d); - static double thinning_factor() { return _thinning_factor; } - bool operator!= (ControlList const &) const; void invalidate_insert_iterator (); @@ -267,6 +286,10 @@ protected: boost::shared_ptr cut_copy_clear (double, double, int op); bool erase_range_internal (double start, double end, EventList &); + void maybe_add_insert_guard (double when); + iterator erase_from_iterator_to (iterator iter, double when); + bool maybe_insert_straight_line (double when, double value); + virtual void maybe_signal_changed (); void _x_scale (double factor); @@ -274,10 +297,12 @@ protected: mutable LookupCache _lookup_cache; mutable SearchCache _search_cache; + mutable Glib::Threads::Mutex _lock; + Parameter _parameter; + ParameterDescriptor _desc; InterpolationStyle _interpolation; EventList _events; - mutable Glib::Threads::Mutex _lock; int8_t _frozen; bool _changed_when_thawed; double _min_yval; @@ -287,8 +312,6 @@ protected: Curve* _curve; - static double _thinning_factor; - private: iterator most_recent_insert_iterator; double insert_position;