23 #ifndef EVORAL_CONTROL_LIST_HPP
24 #define EVORAL_CONTROL_LIST_HPP
30 #include <boost/pool/pool.hpp>
31 #include <boost/pool/pool_alloc.hpp>
33 #include <glibmm/threads.h>
59 : when (w), value (v), coeff (0)
63 : when (other.when), value (other.value), coeff (0)
67 for (
size_t i = 0; i < 4; ++i)
68 coeff[i] = other.
coeff[i];
76 coeff =
new double[4];
78 coeff[0] = coeff[1] = coeff[2] = coeff[3] = 0.0;
121 EventList::size_type
size()
const {
return _events.size(); }
125 Glib::Threads::RWLock::ReaderLock lm (_lock);
126 if (_events.empty()) {
127 return std::numeric_limits<Temporal::timepos_t>::min();
129 return at_start ? _events.front()->when : _events.back()->when;
133 Glib::Threads::RWLock::ReaderLock lm (_lock);
134 return _events.empty() ? std::numeric_limits<Temporal::timecnt_t>::min() :
Temporal::timecnt_t (_events.back()->when);
136 bool empty()
const {
return _events.empty(); }
210 void thin (
double thinning_factor);
252 Glib::Threads::RWLock::WriterLock lm (_lock);
253 (obj.*method)(*
this);
263 Glib::Threads::RWLock::ReaderLock lm (_lock);
264 return unlocked_eval (where);
276 Glib::Threads::RWLock::ReaderLock lm (_lock, Glib::Threads::TRY_LOCK);
278 if ((ok = lm.locked())) {
279 return unlocked_eval (where);
293 std::pair<ControlList::const_iterator,ControlList::const_iterator>
range;
307 Glib::Threads::RWLock&
lock()
const {
return _lock; }
325 const Curve&
curve()
const { assert(_curve);
return *_curve; }
356 virtual bool writing()
const {
return false; }
399 mutable Glib::Threads::RWLock
_lock;
double * coeff
double[4] allocated by Curve as needed
ControlEvent(const ControlEvent &other)
ControlEvent(Temporal::timepos_t const &w, double v)
void start_domain_bounce(Temporal::DomainBounceInfo &)
EventList::size_type size() const
bool move_ranges(std::list< Temporal::RangeMove > const &)
void y_transform(std::function< double(double)> callback)
double unlocked_eval(Temporal::timepos_t const &x) const
std::vector< OrderedPoint > OrderedPoints
void maybe_add_insert_guard(Temporal::timepos_t const &when)
bool rt_safe_earliest_event_discrete_unlocked(Temporal::timepos_t const &start, Temporal::timepos_t &x, double &y, bool inclusive) const
std::pair< ControlList::iterator, ControlList::iterator > control_points_adjacent(Temporal::timepos_t const &when)
reverse_iterator rbegin()
bool erase_range_internal(Temporal::timepos_t const &start, Temporal::timepos_t const &end, EventList &)
std::shared_ptr< ControlList > cut(Temporal::timepos_t const &, Temporal::timepos_t const &)
std::shared_ptr< ControlList > cut_copy_clear(Temporal::timepos_t const &, Temporal::timepos_t const &, int op)
EventList::iterator iterator
const ParameterDescriptor & descriptor() const
void x_scale(Temporal::ratio_t const &)
const Parameter & parameter() const
ControlList(const ControlList &)
bool paste(const ControlList &, Temporal::timepos_t const &)
LookupCache _lookup_cache
SearchCache _search_cache
virtual std::shared_ptr< ControlList > create(const Parameter &id, const ParameterDescriptor &desc, Temporal::TimeDomainProvider const &)
void set_descriptor(const ParameterDescriptor &d)
void dump(std::ostream &)
EventList::reverse_iterator reverse_iterator
InterpolationStyle _interpolation
SearchCache & search_cache() const
virtual void add(Temporal::timepos_t const &when, double value, bool with_guards=true, bool with_initial=true)
PBD::Signal< void()> Dirty
void erase_range(Temporal::timepos_t const &start, Temporal::timepos_t const &end)
double rt_safe_eval(Temporal::timepos_t const &where, bool &ok) const
ControlList(const Parameter &id, const ParameterDescriptor &desc, Temporal::TimeDomainProvider const &)
ControlList(const ControlList &, Temporal::timepos_t const &start, Temporal::timepos_t const &end)
void set_parameter(const Parameter &p)
bool rt_safe_earliest_event_linear_unlocked(Temporal::timepos_t const &start, Temporal::timepos_t &x, double &y, bool inclusive, Temporal::timecnt_t min_x_delta=Temporal::timecnt_t::max()) const
LookupCache & lookup_cache() const
const Curve & curve() const
EventList::const_reverse_iterator const_reverse_iterator
Temporal::timepos_t when(bool at_start) const
void erase(Temporal::timepos_t const &, double)
void thin(double thinning_factor)
Glib::Threads::RWLock & lock() const
ParameterDescriptor _desc
virtual bool touching() const
const ControlEvent * back() const
virtual InterpolationStyle default_interpolation() const
static bool time_comparator(const ControlEvent *a, const ControlEvent *b)
void set_in_write_pass(bool, bool add_point=false, Temporal::timepos_t=std::numeric_limits< Temporal::timepos_t >::min())
void fast_simple_add(Temporal::timepos_t const &when, double value)
const ControlEvent * front() const
InterpolationStyle interpolation() const
PBD::Signal< void()> WritePassStarted
void unlocked_remove_duplicates()
void invalidate_insert_iterator()
Temporal::timecnt_t length() const
double eval(Temporal::timepos_t const &where) const
bool maybe_insert_straight_line(Temporal::timepos_t const &when, double value)
std::list< ControlEvent * > EventList
virtual void maybe_signal_changed()
void add_guard_point(Temporal::timepos_t const &when, Temporal::timecnt_t const &offset)
void start_write_pass(Temporal::timepos_t const &)
void apply_to_points(T &obj, void(T::*method)(const ControlList &))
const_iterator end() const
const EventList & events() const
virtual bool writing() const
void unlocked_invalidate_insert_iterator()
void _x_scale(Temporal::ratio_t const &)
const_reverse_iterator rend() const
void truncate_start(Temporal::timecnt_t const &overall_length)
bool in_write_pass() const
const_reverse_iterator rbegin() const
Temporal::timepos_t insert_position
Glib::Threads::RWLock _lock
void erase(iterator, iterator)
PBD::Signal< void(InterpolationStyle)> InterpolationChanged
void copy_events(const ControlList &)
bool _changed_when_thawed
void modify(iterator, Temporal::timepos_t const &, double)
virtual bool editor_add(Temporal::timepos_t const &when, double value, bool with_guard)
virtual bool editor_add_ordered(OrderedPoints const &, bool with_guard)
void finish_domain_bounce(Temporal::DomainBounceInfo &)
void clear(Temporal::timepos_t const &start, Temporal::timepos_t const &end)
void truncate_end(Temporal::timepos_t const &last_coordinate)
std::shared_ptr< ControlList > copy(Temporal::timepos_t const &, Temporal::timepos_t const &)
virtual bool touch_enabled() const
bool extend_to(Temporal::timepos_t const &)
void list_merge(ControlList const &other, std::function< double(double, double)> callback)
iterator erase_from_iterator_to(iterator iter, Temporal::timepos_t const &when)
bool did_write_during_pass
EventList::const_iterator const_iterator
void build_search_cache_if_necessary(Temporal::timepos_t const &start) const
void shift(Temporal::timepos_t const &before, Temporal::timecnt_t const &distance)
void write_pass_finished(Temporal::timepos_t const &, double thinning_factor=0.0)
Temporal::timepos_t ensure_time_domain(Temporal::timepos_t const &) const
const_iterator begin() const
bool set_interpolation(InterpolationStyle is)
void slide(iterator before, Temporal::timecnt_t const &distance)
double multipoint_eval(Temporal::timepos_t const &x) const
iterator most_recent_insert_iterator
static timecnt_t const & max()
PBD::PropertyDescriptor< timepos_t > start
Temporal::timecnt_t timecnt_t
Temporal::timepos_t timepos_t
bool operator==(const ProcessorSelection &a, const ProcessorSelection &b)
std::pair< ControlList::const_iterator, ControlList::const_iterator > range
OrderedPoint(Temporal::timepos_t const &t, double v)
ControlList::const_iterator first