ardour
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Evoral::ControlList Class Reference

#include <ControlList.hpp>

Inheritance diagram for Evoral::ControlList:
ARDOUR::AutomationList

Classes

struct  LookupCache
 
struct  SearchCache
 

Public Types

enum  InterpolationStyle { Discrete, Linear, Curved }
 
typedef std::list< ControlEvent * > EventList
 
typedef EventList::iterator iterator
 
typedef EventList::reverse_iterator reverse_iterator
 
typedef EventList::const_iterator const_iterator
 
typedef
EventList::const_reverse_iterator 
const_reverse_iterator
 

Public Member Functions

 ControlList (const Parameter &id, const ParameterDescriptor &desc)
 
 ControlList (const ControlList &)
 
 ControlList (const ControlList &, double start, double end)
 
virtual ~ControlList ()
 
virtual boost::shared_ptr
< ControlList
create (const Parameter &id, const ParameterDescriptor &desc)
 
void dump (std::ostream &)
 
ControlListoperator= (const ControlList &)
 
bool operator== (const ControlList &)
 
void copy_events (const ControlList &)
 
virtual void freeze ()
 
virtual void thaw ()
 
bool frozen () const
 
const Parameterparameter () const
 
void set_parameter (const Parameter &p)
 
const ParameterDescriptordescriptor () const
 
void set_descriptor (const ParameterDescriptor &d)
 
EventList::size_type size () const
 
double length () const
 
bool empty () const
 
void reset_default (double val)
 
void clear ()
 
void x_scale (double factor)
 
bool extend_to (double)
 
void slide (iterator before, double distance)
 
void shift (double before, double distance)
 
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)
 
void erase (iterator)
 
void erase (iterator, iterator)
 
void erase (double, double)
 
bool move_ranges (std::list< RangeMove< double > > const &)
 
void modify (iterator, double, double)
 
void thin (double thinning_factor)
 
boost::shared_ptr< ControlListcut (double, double)
 
boost::shared_ptr< ControlListcopy (double, double)
 
void clear (double, double)
 
bool paste (const ControlList &, double position, float times)
 
void set_yrange (double min, double max)
 
double get_max_y () const
 
double get_min_y () const
 
void truncate_end (double length)
 
void truncate_start (double length)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
ControlEventback ()
 
const ControlEventback () const
 
ControlEventfront ()
 
const ControlEventfront () const
 
std::pair
< ControlList::iterator,
ControlList::iterator
control_points_adjacent (double when)
 
template<class T >
void apply_to_points (T &obj, void(T::*method)(const ControlList &))
 
double eval (double where)
 
double rt_safe_eval (double where, bool &ok)
 
const EventListevents () const
 
double default_value () const
 
Glib::Threads::RWLock & lock () const
 
LookupCachelookup_cache () const
 
SearchCachesearch_cache () const
 
double unlocked_eval (double x) const
 
bool rt_safe_earliest_event (double start, double &x, double &y, bool start_inclusive=false) const
 
bool rt_safe_earliest_event_unlocked (double start, double &x, double &y, bool start_inclusive=false) const
 
bool rt_safe_earliest_event_linear_unlocked (double start, double &x, double &y, bool inclusive) const
 
bool rt_safe_earliest_event_discrete_unlocked (double start, double &x, double &y, bool inclusive) const
 
void create_curve ()
 
void destroy_curve ()
 
Curvecurve ()
 
const Curvecurve () const
 
void mark_dirty () const
 
InterpolationStyle interpolation () const
 
void set_interpolation (InterpolationStyle)
 
virtual bool touching () const
 
virtual bool writing () const
 
virtual bool touch_enabled () const
 
void start_write_pass (double time)
 
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
 
bool operator!= (ControlList const &) const
 
void invalidate_insert_iterator ()
 

Static Public Member Functions

static bool time_comparator (const ControlEvent *a, const ControlEvent *b)
 

Public Attributes

PBD::Signal0< void > Dirty
 
PBD::Signal1< void,
InterpolationStyle
InterpolationChanged
 

Protected Member Functions

double multipoint_eval (double x) const
 
void build_search_cache_if_necessary (double start) const
 
boost::shared_ptr< ControlListcut_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)
 

Protected Attributes

LookupCache _lookup_cache
 
SearchCache _search_cache
 
Glib::Threads::RWLock _lock
 
Parameter _parameter
 
ParameterDescriptor _desc
 
InterpolationStyle _interpolation
 
EventList _events
 
int8_t _frozen
 
bool _changed_when_thawed
 
double _min_yval
 
double _max_yval
 
double _default_value
 
bool _sort_pending
 
Curve_curve
 

Private Member Functions

void unlocked_invalidate_insert_iterator ()
 
void add_guard_point (double when)
 

Private Attributes

iterator most_recent_insert_iterator
 
double insert_position
 
bool new_write_pass
 
bool did_write_during_pass
 
bool _in_write_pass
 

Detailed Description

A list (sequence) of time-stamped values for a control

Definition at line 78 of file ControlList.hpp.

Member Typedef Documentation

typedef EventList::const_iterator Evoral::ControlList::const_iterator

Definition at line 84 of file ControlList.hpp.

typedef EventList::const_reverse_iterator Evoral::ControlList::const_reverse_iterator

Definition at line 85 of file ControlList.hpp.

Definition at line 81 of file ControlList.hpp.

typedef EventList::iterator Evoral::ControlList::iterator

Definition at line 82 of file ControlList.hpp.

typedef EventList::reverse_iterator Evoral::ControlList::reverse_iterator

Definition at line 83 of file ControlList.hpp.

Member Enumeration Documentation

Enumerator
Discrete 
Linear 
Curved 

Definition at line 253 of file ControlList.hpp.

Constructor & Destructor Documentation

Evoral::ControlList::ControlList ( const Parameter id,
const ParameterDescriptor desc 
)

Definition at line 53 of file ControlList.cpp.

Evoral::ControlList::ControlList ( const ControlList other)

Definition at line 77 of file ControlList.cpp.

Evoral::ControlList::ControlList ( const ControlList other,
double  start,
double  end 
)

Definition at line 103 of file ControlList.cpp.

Evoral::ControlList::~ControlList ( )
virtual

Definition at line 136 of file ControlList.cpp.

Member Function Documentation

void Evoral::ControlList::_x_scale ( double  factor)
protected

Definition at line 246 of file ControlList.cpp.

void Evoral::ControlList::add ( double  when,
double  value,
bool  with_guards = true,
bool  with_default = true 
)
virtual

Definition at line 549 of file ControlList.cpp.

void Evoral::ControlList::add_guard_point ( double  when)
private

Definition at line 396 of file ControlList.cpp.

template<class T >
void Evoral::ControlList::apply_to_points ( T &  obj,
void(T::*)(const ControlList &)  method 
)
inline

Definition at line 186 of file ControlList.hpp.

ControlEvent* Evoral::ControlList::back ( )
inline

Definition at line 179 of file ControlList.hpp.

const ControlEvent* Evoral::ControlList::back ( ) const
inline

Definition at line 180 of file ControlList.hpp.

iterator Evoral::ControlList::begin ( )
inline

Definition at line 171 of file ControlList.hpp.

const_iterator Evoral::ControlList::begin ( ) const
inline

Definition at line 172 of file ControlList.hpp.

void Evoral::ControlList::build_search_cache_if_necessary ( double  start) const
protected

Definition at line 1243 of file ControlList.cpp.

void Evoral::ControlList::clear ( )

Definition at line 214 of file ControlList.cpp.

void Evoral::ControlList::clear ( double  start,
double  end 
)

Definition at line 1585 of file ControlList.cpp.

std::pair< ControlList::iterator, ControlList::iterator > Evoral::ControlList::control_points_adjacent ( double  when)

Definition at line 833 of file ControlList.cpp.

boost::shared_ptr< ControlList > Evoral::ControlList::copy ( double  start,
double  end 
)

Definition at line 1579 of file ControlList.cpp.

void Evoral::ControlList::copy_events ( const ControlList other)

Definition at line 176 of file ControlList.cpp.

boost::shared_ptr< ControlList > Evoral::ControlList::create ( const Parameter id,
const ParameterDescriptor desc 
)
virtual

Reimplemented in ARDOUR::AutomationList.

Definition at line 146 of file ControlList.cpp.

void Evoral::ControlList::create_curve ( )

Definition at line 191 of file ControlList.cpp.

Curve& Evoral::ControlList::curve ( )
inline

Definition at line 248 of file ControlList.hpp.

const Curve& Evoral::ControlList::curve ( ) const
inline

Definition at line 249 of file ControlList.hpp.

boost::shared_ptr< ControlList > Evoral::ControlList::cut ( double  start,
double  end 
)

Definition at line 1573 of file ControlList.cpp.

boost::shared_ptr< ControlList > Evoral::ControlList::cut_copy_clear ( double  start,
double  end,
int  op 
)
protected
Parameters
startStart position in model coordinates.
endEnd position in model coordinates.
op0 = cut, 1 = copy, 2 = clear.

Definition at line 1476 of file ControlList.cpp.

double Evoral::ControlList::default_value ( ) const
inline

Definition at line 226 of file ControlList.hpp.

const ParameterDescriptor& Evoral::ControlList::descriptor ( ) const
inline

Definition at line 107 of file ControlList.hpp.

void Evoral::ControlList::destroy_curve ( )

Definition at line 197 of file ControlList.cpp.

void Evoral::ControlList::dump ( std::ostream &  )

Definition at line 1748 of file ControlList.cpp.

void Evoral::ControlList::editor_add ( double  when,
double  value 
)
virtual

Definition at line 455 of file ControlList.cpp.

bool Evoral::ControlList::empty ( ) const
inline

Definition at line 115 of file ControlList.hpp.

iterator Evoral::ControlList::end ( )
inline

Definition at line 173 of file ControlList.hpp.

const_iterator Evoral::ControlList::end ( ) const
inline

Definition at line 174 of file ControlList.hpp.

void Evoral::ControlList::erase ( iterator  i)

Definition at line 672 of file ControlList.cpp.

void Evoral::ControlList::erase ( iterator  start,
iterator  end 
)

Definition at line 686 of file ControlList.cpp.

void Evoral::ControlList::erase ( double  when,
double  value 
)

Erase the first event which matches the given time and value

Definition at line 699 of file ControlList.cpp.

ControlList::iterator Evoral::ControlList::erase_from_iterator_to ( iterator  iter,
double  when 
)
protected

Definition at line 532 of file ControlList.cpp.

void Evoral::ControlList::erase_range ( double  start,
double  end 
)

Definition at line 723 of file ControlList.cpp.

bool Evoral::ControlList::erase_range_internal ( double  start,
double  end,
EventList events 
)
protected

Definition at line 743 of file ControlList.cpp.

double Evoral::ControlList::eval ( double  where)
inline

Definition at line 191 of file ControlList.hpp.

const EventList& Evoral::ControlList::events ( ) const
inline

Definition at line 225 of file ControlList.hpp.

bool Evoral::ControlList::extend_to ( double  when)

Definition at line 234 of file ControlList.cpp.

void Evoral::ControlList::fast_simple_add ( double  when,
double  value 
)

Definition at line 329 of file ControlList.cpp.

void Evoral::ControlList::freeze ( )
virtual

Definition at line 866 of file ControlList.cpp.

ControlEvent* Evoral::ControlList::front ( )
inline

Definition at line 181 of file ControlList.hpp.

const ControlEvent* Evoral::ControlList::front ( ) const
inline

Definition at line 182 of file ControlList.hpp.

bool Evoral::ControlList::frozen ( ) const
inline

Definition at line 102 of file ControlList.hpp.

double Evoral::ControlList::get_max_y ( ) const
inline

Definition at line 165 of file ControlList.hpp.

double Evoral::ControlList::get_min_y ( ) const
inline

Definition at line 166 of file ControlList.hpp.

bool Evoral::ControlList::in_write_pass ( ) const

Definition at line 449 of file ControlList.cpp.

InterpolationStyle Evoral::ControlList::interpolation ( ) const
inline

Definition at line 259 of file ControlList.hpp.

void Evoral::ControlList::invalidate_insert_iterator ( )

Definition at line 339 of file ControlList.cpp.

double Evoral::ControlList::length ( ) const
inline

Definition at line 111 of file ControlList.hpp.

Glib::Threads::RWLock& Evoral::ControlList::lock ( ) const
inline

Definition at line 229 of file ControlList.hpp.

LookupCache& Evoral::ControlList::lookup_cache ( ) const
inline

Definition at line 230 of file ControlList.hpp.

void Evoral::ControlList::mark_dirty ( ) const

Definition at line 892 of file ControlList.cpp.

void Evoral::ControlList::maybe_add_insert_guard ( double  when)
protected

Definition at line 484 of file ControlList.cpp.

bool Evoral::ControlList::maybe_insert_straight_line ( double  when,
double  value 
)
protected

If we would just be adding to a straight line, move the previous point instead.

Definition at line 504 of file ControlList.cpp.

void Evoral::ControlList::maybe_signal_changed ( )
protectedvirtual

Reimplemented in ARDOUR::AutomationList.

Definition at line 204 of file ControlList.cpp.

void Evoral::ControlList::modify ( iterator  iter,
double  when,
double  val 
)

Definition at line 803 of file ControlList.cpp.

bool Evoral::ControlList::move_ranges ( std::list< RangeMove< double > > const &  movements)

Move automation around according to a list of region movements.

Parameters
returntrue if anything was changed, otherwise false (ie nothing needed changing)

Definition at line 1651 of file ControlList.cpp.

double Evoral::ControlList::multipoint_eval ( double  x) const
protected

Called by unlocked_eval() to handle cases of 3 or more control points.

Definition at line 1169 of file ControlList.cpp.

bool Evoral::ControlList::operator!= ( ControlList const &  other) const

Definition at line 1720 of file ControlList.cpp.

ControlList & Evoral::ControlList::operator= ( const ControlList other)

Definition at line 158 of file ControlList.cpp.

bool Evoral::ControlList::operator== ( const ControlList other)

Definition at line 152 of file ControlList.cpp.

const Parameter& Evoral::ControlList::parameter ( ) const
inline

Definition at line 104 of file ControlList.hpp.

bool Evoral::ControlList::paste ( const ControlList alist,
double  pos,
float  times 
)
Parameters
posPosition in model coordinates

Definition at line 1592 of file ControlList.cpp.

reverse_iterator Evoral::ControlList::rbegin ( )
inline

Definition at line 175 of file ControlList.hpp.

const_reverse_iterator Evoral::ControlList::rbegin ( ) const
inline

Definition at line 176 of file ControlList.hpp.

reverse_iterator Evoral::ControlList::rend ( )
inline

Definition at line 177 of file ControlList.hpp.

const_reverse_iterator Evoral::ControlList::rend ( ) const
inline

Definition at line 178 of file ControlList.hpp.

void Evoral::ControlList::reset_default ( double  val)
inline

Definition at line 117 of file ControlList.hpp.

bool Evoral::ControlList::rt_safe_earliest_event ( double  start,
double &  x,
double &  y,
bool  inclusive = false 
) const

Get the earliest event after start using the current interpolation style.

If an event is found, x and y are set to its coordinates.

Parameters
inclusiveInclude events with timestamp exactly equal to start
Returns
true if event is found (and x and y are valid).

Definition at line 1276 of file ControlList.cpp.

bool Evoral::ControlList::rt_safe_earliest_event_discrete_unlocked ( double  start,
double &  x,
double &  y,
bool  inclusive 
) const

Get the earliest event after start without interpolation.

If an event is found, x and y are set to its coordinates.

Parameters
inclusiveInclude events with timestamp exactly equal to start
Returns
true if event is found (and x and y are valid).

Definition at line 1314 of file ControlList.cpp.

bool Evoral::ControlList::rt_safe_earliest_event_linear_unlocked ( double  start,
double &  x,
double &  y,
bool  inclusive 
) const

Get the earliest time the line crosses an integer (Linear interpolation).

If an event is found, x and y are set to its coordinates.

Parameters
inclusiveInclude events with timestamp exactly equal to start
Returns
true if event is found (and x and y are valid).

Definition at line 1355 of file ControlList.cpp.

bool Evoral::ControlList::rt_safe_earliest_event_unlocked ( double  start,
double &  x,
double &  y,
bool  inclusive = false 
) const

Get the earliest event after start using the current interpolation style.

If an event is found, x and y are set to its coordinates.

Parameters
inclusiveInclude events with timestamp exactly equal to start
Returns
true if event is found (and x and y are valid).

Definition at line 1296 of file ControlList.cpp.

double Evoral::ControlList::rt_safe_eval ( double  where,
bool &  ok 
)
inline

Definition at line 196 of file ControlList.hpp.

SearchCache& Evoral::ControlList::search_cache ( ) const
inline

Definition at line 231 of file ControlList.hpp.

void Evoral::ControlList::set_descriptor ( const ParameterDescriptor d)
inline

Definition at line 108 of file ControlList.hpp.

void Evoral::ControlList::set_in_write_pass ( bool  yn,
bool  add_point = false,
double  when = 0.0 
)

Definition at line 384 of file ControlList.cpp.

void Evoral::ControlList::set_interpolation ( InterpolationStyle  s)

Definition at line 1709 of file ControlList.cpp.

void Evoral::ControlList::set_parameter ( const Parameter p)
inline

Definition at line 105 of file ControlList.hpp.

void Evoral::ControlList::set_yrange ( double  min,
double  max 
)
inline

Definition at line 160 of file ControlList.hpp.

void Evoral::ControlList::shift ( double  before,
double  distance 
)

Definition at line 785 of file ControlList.cpp.

EventList::size_type Evoral::ControlList::size ( ) const
inline

Definition at line 110 of file ControlList.hpp.

void Evoral::ControlList::slide ( iterator  before,
double  distance 
)

Definition at line 764 of file ControlList.cpp.

void Evoral::ControlList::start_write_pass ( double  time)

Definition at line 352 of file ControlList.cpp.

void Evoral::ControlList::thaw ( )
virtual

Reimplemented in ARDOUR::AutomationList.

Definition at line 872 of file ControlList.cpp.

void Evoral::ControlList::thin ( double  thinning_factor)

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.

Definition at line 262 of file ControlList.cpp.

static bool Evoral::ControlList::time_comparator ( const ControlEvent a,
const ControlEvent b 
)
inlinestatic

Definition at line 207 of file ControlList.hpp.

virtual bool Evoral::ControlList::touch_enabled ( ) const
inlinevirtual

Reimplemented in ARDOUR::AutomationList.

Definition at line 264 of file ControlList.hpp.

virtual bool Evoral::ControlList::touching ( ) const
inlinevirtual

Reimplemented in ARDOUR::AutomationList.

Definition at line 262 of file ControlList.hpp.

void Evoral::ControlList::truncate_end ( double  length)

Definition at line 908 of file ControlList.cpp.

void Evoral::ControlList::truncate_start ( double  length)

Definition at line 1011 of file ControlList.cpp.

double Evoral::ControlList::unlocked_eval ( double  x) const

Called by locked entry point and various private locations where we already hold the lock.

FIXME: Should this be private? Curve needs it..

Definition at line 1112 of file ControlList.cpp.

void Evoral::ControlList::unlocked_invalidate_insert_iterator ( )
private

Definition at line 346 of file ControlList.cpp.

void Evoral::ControlList::write_pass_finished ( double  when,
double  thinning_factor = 0.0 
)

Definition at line 371 of file ControlList.cpp.

virtual bool Evoral::ControlList::writing ( ) const
inlinevirtual

Reimplemented in ARDOUR::AutomationList.

Definition at line 263 of file ControlList.hpp.

void Evoral::ControlList::x_scale ( double  factor)

Definition at line 227 of file ControlList.cpp.

Member Data Documentation

bool Evoral::ControlList::_changed_when_thawed
protected

Definition at line 307 of file ControlList.hpp.

Curve* Evoral::ControlList::_curve
protected

Definition at line 313 of file ControlList.hpp.

double Evoral::ControlList::_default_value
protected

Definition at line 310 of file ControlList.hpp.

ParameterDescriptor Evoral::ControlList::_desc
protected

Definition at line 303 of file ControlList.hpp.

EventList Evoral::ControlList::_events
protected

Definition at line 305 of file ControlList.hpp.

int8_t Evoral::ControlList::_frozen
protected

Definition at line 306 of file ControlList.hpp.

bool Evoral::ControlList::_in_write_pass
private

Definition at line 320 of file ControlList.hpp.

InterpolationStyle Evoral::ControlList::_interpolation
protected

Definition at line 304 of file ControlList.hpp.

Glib::Threads::RWLock Evoral::ControlList::_lock
mutableprotected

Definition at line 300 of file ControlList.hpp.

LookupCache Evoral::ControlList::_lookup_cache
mutableprotected

Definition at line 297 of file ControlList.hpp.

double Evoral::ControlList::_max_yval
protected

Definition at line 309 of file ControlList.hpp.

double Evoral::ControlList::_min_yval
protected

Definition at line 308 of file ControlList.hpp.

Parameter Evoral::ControlList::_parameter
protected

Definition at line 302 of file ControlList.hpp.

SearchCache Evoral::ControlList::_search_cache
mutableprotected

Definition at line 298 of file ControlList.hpp.

bool Evoral::ControlList::_sort_pending
protected

Definition at line 311 of file ControlList.hpp.

bool Evoral::ControlList::did_write_during_pass
private

Definition at line 319 of file ControlList.hpp.

PBD::Signal0<void> Evoral::ControlList::Dirty
mutable

Emitted when mark_dirty() is called on this object

Definition at line 271 of file ControlList.hpp.

double Evoral::ControlList::insert_position
private

Definition at line 317 of file ControlList.hpp.

PBD::Signal1<void, InterpolationStyle> Evoral::ControlList::InterpolationChanged

Emitted when our interpolation style changes

Definition at line 273 of file ControlList.hpp.

iterator Evoral::ControlList::most_recent_insert_iterator
private

Definition at line 316 of file ControlList.hpp.

bool Evoral::ControlList::new_write_pass
private

Definition at line 318 of file ControlList.hpp.


The documentation for this class was generated from the following files: