Ardour  9.0-pre0-233-gbf2016071d
Temporal::Beats Class Reference

#include <beats.h>

Inheritance diagram for Temporal::Beats:
[legend]

Public Member Functions

 Beats ()
 
 Beats (const Beats &other)
 
 Beats (int64_t b, int64_t t)
 
int64_t to_ticks () const
 
int64_t to_ticks (uint32_t ppqn) const
 
int64_t get_beats () const
 
int32_t get_ticks () const
 
Beatsoperator= (double time)
 
Beatsoperator= (const Beats &other)
 
Beats round_up_to_multiple (Beats const &multiple) const
 
Beats round_to_multiple (Beats const &multiple) const
 
Beats round_down_to_multiple (Beats const &multiple) const
 
Beats round_to_beat () const
 
Beats round_up_to_beat () const
 
Beats round_down_to_beat () const
 
Beats prev_beat () const
 
Beats next_beat () const
 
Beats round_to_subdivision (int subdivision, RoundMode dir) const
 
Beats abs () const
 
Beats diff (Beats const &other) const
 
bool operator== (const Beats &b) const
 
bool operator== (int beats) const
 
bool operator!= (const Beats &b) const
 
bool operator< (const Beats &b) const
 
bool operator<= (const Beats &b) const
 
bool operator> (const Beats &b) const
 
bool operator>= (const Beats &b) const
 
Beats operator+ (const Beats &b) const
 
Beats operator- (const Beats &b) const
 
Beats operator- () const
 
Beats operator* (int32_t factor) const
 
Beats operator/ (int32_t factor) const
 
Beats operator* (ratio_t const &factor) const
 
Beats operator/ (ratio_t const &factor) const
 
Beats operator% (Beats const &b) const
 
Beats operator%= (Beats const &b)
 
Beats operator/ (Beats const &other) const
 
Beats operator* (Beats const &other) const
 
Beatsoperator+= (const Beats &b)
 
Beatsoperator-= (const Beats &b)
 
bool operator! () const
 
 operator bool () const
 
std::string str () const
 

Static Public Member Functions

static Beats from_double (double beats)
 
static Beats beats (int64_t beats)
 
static Beats ticks (int64_t ticks)
 
static Beats ticks_at_rate (int64_t ticks, uint32_t ppqn)
 
static Beats one_tick ()
 

Static Public Attributes

static const int32_t PPQN = Temporal::ticks_per_beat
 

Protected Attributes

int64_t _ticks
 

Detailed Description

Musical time in beats.

Definition at line 65 of file beats.h.

Constructor & Destructor Documentation

◆ Beats() [1/3]

Temporal::Beats::Beats ( )
inline

Definition at line 69 of file beats.h.

◆ Beats() [2/3]

Temporal::Beats::Beats ( const Beats other)
inline

Definition at line 70 of file beats.h.

◆ Beats() [3/3]

Temporal::Beats::Beats ( int64_t  b,
int64_t  t 
)
inlineexplicit

Create from a precise beats:ticks pair.

Definition at line 73 of file beats.h.

Member Function Documentation

◆ abs()

Beats Temporal::Beats::abs ( ) const
inline

Definition at line 155 of file beats.h.

◆ beats()

static Beats Temporal::Beats::beats ( int64_t  beats)
inlinestatic

Create from an integer number of beats.

Definition at line 83 of file beats.h.

◆ diff()

Beats Temporal::Beats::diff ( Beats const &  other) const
inline

Definition at line 159 of file beats.h.

◆ from_double()

static Beats Temporal::Beats::from_double ( double  beats)
inlinestatic

Create from a real number of beats.

Definition at line 76 of file beats.h.

◆ get_beats()

int64_t Temporal::Beats::get_beats ( ) const
inline

Definition at line 106 of file beats.h.

◆ get_ticks()

int32_t Temporal::Beats::get_ticks ( ) const
inline

Definition at line 107 of file beats.h.

◆ next_beat()

Beats Temporal::Beats::next_beat ( ) const
inline

Definition at line 148 of file beats.h.

◆ one_tick()

static Beats Temporal::Beats::one_tick ( )
inlinestatic

Definition at line 239 of file beats.h.

◆ operator bool()

Temporal::Beats::operator bool ( ) const
inlineexplicit

Definition at line 237 of file beats.h.

◆ operator!()

bool Temporal::Beats::operator! ( ) const
inline

Definition at line 236 of file beats.h.

◆ operator!=()

bool Temporal::Beats::operator!= ( const Beats b) const
inline

Definition at line 174 of file beats.h.

◆ operator%()

Beats Temporal::Beats::operator% ( Beats const &  b) const
inline

Definition at line 211 of file beats.h.

◆ operator%=()

Beats Temporal::Beats::operator%= ( Beats const &  b)
inline

Definition at line 213 of file beats.h.

◆ operator*() [1/3]

Beats Temporal::Beats::operator* ( Beats const &  other) const
inline

Definition at line 222 of file beats.h.

◆ operator*() [2/3]

Beats Temporal::Beats::operator* ( int32_t  factor) const
inline

Definition at line 206 of file beats.h.

◆ operator*() [3/3]

Beats Temporal::Beats::operator* ( ratio_t const &  factor) const
inline

Definition at line 208 of file beats.h.

◆ operator+()

Beats Temporal::Beats::operator+ ( const Beats b) const
inline

Definition at line 194 of file beats.h.

◆ operator+=()

Beats& Temporal::Beats::operator+= ( const Beats b)
inline

Definition at line 226 of file beats.h.

◆ operator-() [1/2]

Beats Temporal::Beats::operator- ( ) const
inline

Definition at line 202 of file beats.h.

◆ operator-() [2/2]

Beats Temporal::Beats::operator- ( const Beats b) const
inline

Definition at line 198 of file beats.h.

◆ operator-=()

Beats& Temporal::Beats::operator-= ( const Beats b)
inline

Definition at line 231 of file beats.h.

◆ operator/() [1/3]

Beats Temporal::Beats::operator/ ( Beats const &  other) const
inline

Definition at line 218 of file beats.h.

◆ operator/() [2/3]

Beats Temporal::Beats::operator/ ( int32_t  factor) const
inline

Definition at line 207 of file beats.h.

◆ operator/() [3/3]

Beats Temporal::Beats::operator/ ( ratio_t const &  factor) const
inline

Definition at line 209 of file beats.h.

◆ operator<()

bool Temporal::Beats::operator< ( const Beats b) const
inline

Definition at line 178 of file beats.h.

◆ operator<=()

bool Temporal::Beats::operator<= ( const Beats b) const
inline

Definition at line 182 of file beats.h.

◆ operator=() [1/2]

Beats& Temporal::Beats::operator= ( const Beats other)
inline

Definition at line 114 of file beats.h.

◆ operator=() [2/2]

Beats& Temporal::Beats::operator= ( double  time)
inline

Definition at line 109 of file beats.h.

◆ operator==() [1/2]

bool Temporal::Beats::operator== ( const Beats b) const
inline

Definition at line 166 of file beats.h.

◆ operator==() [2/2]

bool Temporal::Beats::operator== ( int  beats) const
inline

Definition at line 170 of file beats.h.

◆ operator>()

bool Temporal::Beats::operator> ( const Beats b) const
inline

Definition at line 186 of file beats.h.

◆ operator>=()

bool Temporal::Beats::operator>= ( const Beats b) const
inline

Definition at line 190 of file beats.h.

◆ prev_beat()

Beats Temporal::Beats::prev_beat ( ) const
inline

Definition at line 143 of file beats.h.

◆ round_down_to_beat()

Beats Temporal::Beats::round_down_to_beat ( ) const
inline

Definition at line 138 of file beats.h.

◆ round_down_to_multiple()

Beats Temporal::Beats::round_down_to_multiple ( Beats const &  multiple) const
inline

Definition at line 126 of file beats.h.

◆ round_to_beat()

Beats Temporal::Beats::round_to_beat ( ) const
inline

Definition at line 130 of file beats.h.

◆ round_to_multiple()

Beats Temporal::Beats::round_to_multiple ( Beats const &  multiple) const
inline

Definition at line 123 of file beats.h.

◆ round_to_subdivision()

Beats Temporal::Beats::round_to_subdivision ( int  subdivision,
RoundMode  dir 
) const

◆ round_up_to_beat()

Beats Temporal::Beats::round_up_to_beat ( ) const
inline

Definition at line 134 of file beats.h.

◆ round_up_to_multiple()

Beats Temporal::Beats::round_up_to_multiple ( Beats const &  multiple) const
inline

Definition at line 120 of file beats.h.

◆ str()

std::string Temporal::Beats::str ( ) const
inline

Definition at line 241 of file beats.h.

◆ ticks()

static Beats Temporal::Beats::ticks ( int64_t  ticks)
inlinestatic

Create from ticks at the standard PPQN.

Definition at line 88 of file beats.h.

◆ ticks_at_rate()

static Beats Temporal::Beats::ticks_at_rate ( int64_t  ticks,
uint32_t  ppqn 
)
inlinestatic

Create from ticks at a given rate.

Note this can also be used to create from frames by setting ppqn to the number of samples per beat. Note the resulting Beats will, like all others, have the default PPQN, so this is a potentially lossy conversion.

Definition at line 99 of file beats.h.

◆ to_ticks() [1/2]

int64_t Temporal::Beats::to_ticks ( ) const
inline

Definition at line 103 of file beats.h.

◆ to_ticks() [2/2]

int64_t Temporal::Beats::to_ticks ( uint32_t  ppqn) const
inline

Definition at line 104 of file beats.h.

Member Data Documentation

◆ _ticks

int64_t Temporal::Beats::_ticks
protected

Definition at line 248 of file beats.h.

◆ PPQN

const int32_t Temporal::Beats::PPQN = Temporal::ticks_per_beat
static

Definition at line 67 of file beats.h.


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