ardour
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
ARDOUR::TempoMap Class Reference

#include <tempo.h>

Inheritance diagram for ARDOUR::TempoMap:
PBD::StatefulDestructible PBD::Stateful PBD::Destructible

Classes

struct  BBTPoint
 

Public Types

enum  BBTPointType { Bar, Beat }
 
typedef std::vector< BBTPointBBTPointList
 

Public Member Functions

 TempoMap (framecnt_t frame_rate)
 
 ~TempoMap ()
 
template<class T >
void apply_with_metrics (T &obj, void(T::*method)(const Metrics &))
 
void get_grid (BBTPointList::const_iterator &, BBTPointList::const_iterator &, framepos_t start, framepos_t end)
 
void bbt_time (framepos_t when, Timecode::BBT_Time &)
 
void bbt_time_rt (framepos_t when, Timecode::BBT_Time &)
 
framepos_t frame_time (const Timecode::BBT_Time &)
 
framecnt_t bbt_duration_at (framepos_t, const Timecode::BBT_Time &, int dir)
 
framepos_t framepos_plus_bbt (framepos_t pos, Timecode::BBT_Time b) const
 
framepos_t framepos_plus_beats (framepos_t, Evoral::Beats) const
 
framepos_t framepos_minus_beats (framepos_t, Evoral::Beats) const
 
Evoral::Beats framewalk_to_beats (framepos_t pos, framecnt_t distance) const
 
const Tempotempo_at (framepos_t) const
 
const Metermeter_at (framepos_t) const
 
const TempoSectiontempo_section_at (framepos_t) const
 
const MeterSectionmeter_section_at (framepos_t) const
 
void add_tempo (const Tempo &, Timecode::BBT_Time where)
 
void add_meter (const Meter &, Timecode::BBT_Time where)
 
void remove_tempo (const TempoSection &, bool send_signal)
 
void remove_meter (const MeterSection &, bool send_signal)
 
void replace_tempo (const TempoSection &, const Tempo &, const Timecode::BBT_Time &where)
 
void replace_meter (const MeterSection &, const Meter &, const Timecode::BBT_Time &where)
 
framepos_t round_to_bar (framepos_t frame, RoundMode dir)
 
framepos_t round_to_beat (framepos_t frame, RoundMode dir)
 
framepos_t round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir)
 
void set_length (framepos_t frames)
 
XMLNodeget_state (void)
 
int set_state (const XMLNode &, int version)
 
void dump (std::ostream &) const
 
void clear ()
 
TempoMetric metric_at (Timecode::BBT_Time bbt) const
 
TempoMetric metric_at (framepos_t, Metrics::const_iterator *last=NULL) const
 
Metrics::const_iterator metrics_end ()
 
void change_existing_tempo_at (framepos_t, double bpm, double note_type)
 
void change_initial_tempo (double bpm, double note_type)
 
void insert_time (framepos_t, framecnt_t)
 
bool cut_time (framepos_t where, framecnt_t amount)
 
int n_tempos () const
 
int n_meters () const
 
framecnt_t frame_rate () const
 
- Public Member Functions inherited from PBD::Stateful
 Stateful ()
 
virtual ~Stateful ()
 
virtual bool apply_changes (PropertyBase const &)
 
PropertyChange apply_changes (PropertyList const &)
 
const OwnedPropertyListproperties () const
 
void add_property (PropertyBase &s)
 
void add_extra_xml (XMLNode &)
 
XMLNodeextra_xml (const std::string &str, bool add_if_missing=false)
 
void save_extra_xml (const XMLNode &)
 
const PBD::IDid () const
 
bool set_id (const XMLNode &)
 
void set_id (const std::string &)
 
void reset_id ()
 
void clear_changes ()
 
virtual void clear_owned_changes ()
 
PropertyListget_changes_as_properties (Command *) const
 
virtual void rdiff (std::vector< Command * > &) const
 
bool changed () const
 
virtual PropertyListproperty_factory (const XMLNode &) const
 
virtual void suspend_property_changes ()
 
virtual void resume_property_changes ()
 
bool property_changes_suspended () const
 
- Public Member Functions inherited from PBD::Destructible
 Destructible ()
 
virtual ~Destructible ()
 
void drop_references ()
 

Static Public Member Functions

static const Tempodefault_tempo ()
 
static const Meterdefault_meter ()
 

Private Member Functions

void recompute_map (bool reassign_tempo_bbt, framepos_t end=-1)
 
void extend_map (framepos_t end)
 
void require_map_to (framepos_t pos)
 
void require_map_to (const Timecode::BBT_Time &)
 
void _extend_map (TempoSection *tempo, MeterSection *meter, Metrics::iterator next_metric, Timecode::BBT_Time current, framepos_t current_frame, framepos_t end)
 
BBTPointList::const_iterator bbt_before_or_at (framepos_t)
 
BBTPointList::const_iterator bbt_before_or_at (const Timecode::BBT_Time &)
 
BBTPointList::const_iterator bbt_after_or_at (framepos_t)
 
framepos_t round_to_type (framepos_t fr, RoundMode dir, BBTPointType)
 
void bbt_time (framepos_t, Timecode::BBT_Time &, const BBTPointList::const_iterator &)
 
framecnt_t bbt_duration_at_unlocked (const Timecode::BBT_Time &when, const Timecode::BBT_Time &bbt, int dir)
 
const MeterSectionfirst_meter () const
 
MeterSectionfirst_meter ()
 
const TempoSectionfirst_tempo () const
 
TempoSectionfirst_tempo ()
 
void do_insert (MetricSection *section)
 
void add_tempo_locked (const Tempo &, Timecode::BBT_Time where, bool recompute)
 
void add_meter_locked (const Meter &, Timecode::BBT_Time where, bool recompute)
 
bool remove_tempo_locked (const TempoSection &)
 
bool remove_meter_locked (const MeterSection &)
 

Private Attributes

Metrics metrics
 
framecnt_t _frame_rate
 
Glib::Threads::RWLock lock
 
BBTPointList _map
 

Static Private Attributes

static Tempo _default_tempo
 
static Meter _default_meter
 

Friends

class ::BBTTest
 
class ::FrameposPlusBeatsTest
 
class ::TempoTest
 

Additional Inherited Members

- Public Attributes inherited from PBD::Stateful
PBD::Signal1< void, const
PropertyChange & > 
PropertyChanged
 
- Public Attributes inherited from PBD::Destructible
PBD::Signal0< void > Destroyed
 
PBD::Signal0< void > DropReferences
 
- Static Public Attributes inherited from PBD::Stateful
static int current_state_version = 0
 
static int loading_state_version = 0
 
- Protected Member Functions inherited from PBD::Stateful
void add_instant_xml (XMLNode &, const std::string &directory_path)
 
XMLNodeinstant_xml (const std::string &str, const std::string &directory_path)
 
void add_properties (XMLNode &)
 
PropertyChange set_values (XMLNode const &)
 
virtual void post_set (const PropertyChange &)
 
virtual void send_change (const PropertyChange &)
 
virtual void mid_thaw (const PropertyChange &)
 
- Protected Attributes inherited from PBD::Stateful
XMLNode_extra_xml
 
XMLNode_instant_xml
 
PBD::PropertyChange _pending_changed
 
Glib::Threads::Mutex _lock
 
std::string _xml_node_name
 name of node to use for this object in XML More...
 
OwnedPropertyList_properties
 

Detailed Description

Definition at line 208 of file tempo.h.

Member Typedef Documentation

Definition at line 238 of file tempo.h.

Member Enumeration Documentation

Enumerator
Bar 
Beat 

Definition at line 216 of file tempo.h.

Constructor & Destructor Documentation

TempoMap::TempoMap ( framecnt_t  frame_rate)

Definition at line 278 of file tempo.cc.

TempoMap::~TempoMap ( )

Definition at line 299 of file tempo.cc.

Member Function Documentation

void TempoMap::_extend_map ( TempoSection tempo,
MeterSection meter,
Metrics::iterator  next_metric,
Timecode::BBT_Time  current,
framepos_t  current_frame,
framepos_t  end 
)
private

Definition at line 951 of file tempo.cc.

void TempoMap::add_meter ( const Meter meter,
Timecode::BBT_Time  where 
)

Definition at line 590 of file tempo.cc.

void TempoMap::add_meter_locked ( const Meter meter,
Timecode::BBT_Time  where,
bool  recompute 
)
private

Definition at line 608 of file tempo.cc.

void TempoMap::add_tempo ( const Tempo tempo,
Timecode::BBT_Time  where 
)

Definition at line 513 of file tempo.cc.

void TempoMap::add_tempo_locked ( const Tempo tempo,
Timecode::BBT_Time  where,
bool  recompute 
)
private

Definition at line 525 of file tempo.cc.

template<class T >
void ARDOUR::TempoMap::apply_with_metrics ( T &  obj,
void(T::*)(const Metrics &)  method 
)
inline

Definition at line 240 of file tempo.h.

TempoMap::BBTPointList::const_iterator TempoMap::bbt_after_or_at ( framepos_t  pos)
private

Definition at line 2449 of file tempo.cc.

TempoMap::BBTPointList::const_iterator TempoMap::bbt_before_or_at ( framepos_t  pos)
private

Definition at line 2405 of file tempo.cc.

TempoMap::BBTPointList::const_iterator TempoMap::bbt_before_or_at ( const Timecode::BBT_Time &  bbt)
private

Definition at line 2434 of file tempo.cc.

framecnt_t TempoMap::bbt_duration_at ( framepos_t  pos,
const Timecode::BBT_Time &  bbt,
int  dir 
)

Definition at line 1245 of file tempo.cc.

framecnt_t TempoMap::bbt_duration_at_unlocked ( const Timecode::BBT_Time &  when,
const Timecode::BBT_Time &  bbt,
int  dir 
)
private

Definition at line 1255 of file tempo.cc.

void TempoMap::bbt_time ( framepos_t  when,
Timecode::BBT_Time &  bbt 
)

Definition at line 1168 of file tempo.cc.

void TempoMap::bbt_time ( framepos_t  frame,
Timecode::BBT_Time &  bbt,
const BBTPointList::const_iterator &  i 
)
private

Definition at line 1202 of file tempo.cc.

void TempoMap::bbt_time_rt ( framepos_t  when,
Timecode::BBT_Time &  bbt 
)

Definition at line 1186 of file tempo.cc.

void TempoMap::change_existing_tempo_at ( framepos_t  where,
double  bpm,
double  note_type 
)

Definition at line 653 of file tempo.cc.

void TempoMap::change_initial_tempo ( double  bpm,
double  note_type 
)

Definition at line 634 of file tempo.cc.

void ARDOUR::TempoMap::clear ( )
bool TempoMap::cut_time ( framepos_t  where,
framecnt_t  amount 
)

Definition at line 1904 of file tempo.cc.

static const Meter& ARDOUR::TempoMap::default_meter ( )
inlinestatic

Definition at line 284 of file tempo.h.

static const Tempo& ARDOUR::TempoMap::default_tempo ( )
inlinestatic

Definition at line 283 of file tempo.h.

void TempoMap::do_insert ( MetricSection section)
private

Definition at line 380 of file tempo.cc.

void TempoMap::dump ( std::ostream &  o) const

Definition at line 1762 of file tempo.cc.

void TempoMap::extend_map ( framepos_t  end)
private

Definition at line 909 of file tempo.cc.

const MeterSection & TempoMap::first_meter ( ) const
private

Definition at line 702 of file tempo.cc.

MeterSection & TempoMap::first_meter ( )
private

Definition at line 718 of file tempo.cc.

const TempoSection & TempoMap::first_tempo ( ) const
private

Definition at line 736 of file tempo.cc.

TempoSection & TempoMap::first_tempo ( )
private

Definition at line 754 of file tempo.cc.

framecnt_t ARDOUR::TempoMap::frame_rate ( ) const
inline

Definition at line 331 of file tempo.h.

framepos_t TempoMap::frame_time ( const Timecode::BBT_Time &  bbt)

Definition at line 1218 of file tempo.cc.

framepos_t TempoMap::framepos_minus_beats ( framepos_t  pos,
Evoral::Beats  beats 
) const

Subtract some (fractional) beats from a frame position, and return the result in frames

Definition at line 2052 of file tempo.cc.

framepos_t TempoMap::framepos_plus_bbt ( framepos_t  pos,
Timecode::BBT_Time  b 
) const

Add the BBT interval op to pos and return the result

Definition at line 2165 of file tempo.cc.

framepos_t TempoMap::framepos_plus_beats ( framepos_t  pos,
Evoral::Beats  beats 
) const

Add some (fractional) beats to a session frame position, and return the result in frames. pos can be -ve, if required.

Definition at line 1960 of file tempo.cc.

Evoral::Beats TempoMap::framewalk_to_beats ( framepos_t  pos,
framecnt_t  distance 
) const

Count the number of beats that are equivalent to distance when going forward, starting at pos.

Definition at line 2303 of file tempo.cc.

void TempoMap::get_grid ( BBTPointList::const_iterator &  ,
BBTPointList::const_iterator &  ,
framepos_t  start,
framepos_t  end 
)

Definition at line 1573 of file tempo.cc.

XMLNode & TempoMap::get_state ( void  )
virtual

Implements PBD::Stateful.

Definition at line 1659 of file tempo.cc.

void TempoMap::insert_time ( framepos_t  where,
framecnt_t  amount 
)

Definition at line 1811 of file tempo.cc.

const Meter & TempoMap::meter_at ( framepos_t  frame) const

Definition at line 1652 of file tempo.cc.

const MeterSection & TempoMap::meter_section_at ( framepos_t  frame) const

Definition at line 1624 of file tempo.cc.

TempoMetric TempoMap::metric_at ( Timecode::BBT_Time  bbt) const

Definition at line 1141 of file tempo.cc.

TempoMetric TempoMap::metric_at ( framepos_t  frame,
Metrics::const_iterator *  last = NULL 
) const

Return the TempoMetric at frame t, and point last to the latest metric change <= t, if it is non-NULL.

Definition at line 1112 of file tempo.cc.

Metrics::const_iterator ARDOUR::TempoMap::metrics_end ( )
inline

Definition at line 320 of file tempo.h.

int TempoMap::n_meters ( ) const

Definition at line 1796 of file tempo.cc.

int TempoMap::n_tempos ( ) const

Definition at line 1781 of file tempo.cc.

void TempoMap::recompute_map ( bool  reassign_tempo_bbt,
framepos_t  end = -1 
)
private

Definition at line 802 of file tempo.cc.

void TempoMap::remove_meter ( const MeterSection tempo,
bool  send_signal 
)

Definition at line 342 of file tempo.cc.

bool TempoMap::remove_meter_locked ( const MeterSection tempo)
private

Definition at line 361 of file tempo.cc.

void TempoMap::remove_tempo ( const TempoSection tempo,
bool  send_signal 
)

Definition at line 304 of file tempo.cc.

bool TempoMap::remove_tempo_locked ( const TempoSection tempo)
private

Definition at line 323 of file tempo.cc.

void TempoMap::replace_meter ( const MeterSection ms,
const Meter meter,
const Timecode::BBT_Time &  where 
)

Definition at line 570 of file tempo.cc.

void TempoMap::replace_tempo ( const TempoSection ts,
const Tempo tempo,
const Timecode::BBT_Time &  where 
)

Definition at line 491 of file tempo.cc.

void TempoMap::require_map_to ( framepos_t  pos)
private

Definition at line 770 of file tempo.cc.

void TempoMap::require_map_to ( const Timecode::BBT_Time &  bbt)
private

Definition at line 780 of file tempo.cc.

framepos_t TempoMap::round_to_bar ( framepos_t  frame,
RoundMode  dir 
)

Definition at line 1295 of file tempo.cc.

framepos_t TempoMap::round_to_beat ( framepos_t  frame,
RoundMode  dir 
)

Definition at line 1301 of file tempo.cc.

framepos_t TempoMap::round_to_beat_subdivision ( framepos_t  fr,
int  sub_num,
RoundMode  dir 
)

Definition at line 1307 of file tempo.cc.

framepos_t TempoMap::round_to_type ( framepos_t  fr,
RoundMode  dir,
BBTPointType  type 
)
private

Definition at line 1423 of file tempo.cc.

void ARDOUR::TempoMap::set_length ( framepos_t  frames)
int TempoMap::set_state ( const XMLNode node,
int  version 
)
virtual

Implements PBD::Stateful.

Definition at line 1675 of file tempo.cc.

const Tempo & TempoMap::tempo_at ( framepos_t  frame) const

Definition at line 1617 of file tempo.cc.

const TempoSection & TempoMap::tempo_section_at ( framepos_t  frame) const

Definition at line 1589 of file tempo.cc.

Friends And Related Function Documentation

friend class ::BBTTest
friend

Definition at line 335 of file tempo.h.

friend class ::FrameposPlusBeatsTest
friend

Definition at line 336 of file tempo.h.

friend class ::TempoTest
friend

Definition at line 337 of file tempo.h.

Member Data Documentation

Meter TempoMap::_default_meter
staticprivate

Definition at line 340 of file tempo.h.

Tempo TempoMap::_default_tempo
staticprivate

Definition at line 339 of file tempo.h.

framecnt_t ARDOUR::TempoMap::_frame_rate
private

Definition at line 343 of file tempo.h.

BBTPointList ARDOUR::TempoMap::_map
private

Definition at line 345 of file tempo.h.

Glib::Threads::RWLock ARDOUR::TempoMap::lock
mutableprivate

Definition at line 344 of file tempo.h.

Metrics ARDOUR::TempoMap::metrics
private

Definition at line 342 of file tempo.h.


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