Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)
« « « Anklang Documentation |
Musical time signature and tick conversions. More...
#include "transport.hh"
Classes | |
struct | Beat |
struct | Time |
Public Member Functions | |
double | samplerate () const |
double | inv_samplerate () const |
double | ticks_per_sample () const |
int64 | sample_to_tick (int64 sample) const |
int64 | sample_from_tick (int64 tick) const |
double | bpm () const |
int32 | bar_ticks () const |
int32 | beat_ticks () const |
int64 | start_offset () const |
void | set_samplerate (uint samplerate) |
Assign sample rate. | |
void | set_bpm (double bpm) |
Assign tempo in beats per minute. | |
Time | time_from_tick (int64 tick) const |
Calculate time from tick, requires set_bpm(). | |
int64 | time_to_tick (const Time &time) const |
Calculate tick from time, requires set_bpm(). | |
bool | set_signature (uint8 beats_per_bar, uint8 beat_unit) |
Assign time signature and offset for the signature to take effect. | |
const uint8 & | beats_per_bar () const |
const uint8 & | beat_unit () const |
int32 | bar_from_tick (int64 tick) const |
Calculate bar from tick, requires set_signature(). | |
int64 | bar_to_tick (int32 bar) const |
Calculate tick from bar, requires set_signature(). | |
Beat | beat_from_tick (int64 tick) const |
Calculate beat from tick, requires set_signature(). | |
int64 | beat_to_tick (const Beat &beat) const |
Calculate tick from beat, requires set_signature(). | |
TickSignature (double bpm, uint8 beats_per_bar, uint8 beat_unit) | |
TickSignature (const TickSignature &other) | |
TickSignature & | operator= (const TickSignature &src) |
Protected Attributes | |
uint8 | beats_per_bar_ |
Upper numeral (numerator), how many beats constitute a bar. | |
uint8 | beat_unit_ |
Lower numeral (denominator in [1 2 4 8 16]), note value that represents one beat. | |
int32 | beat_ticks_ |
int32 | bar_ticks_ |
int32 | samplerate_ |
Sample rate (mixing frequency) in Hz. | |
double | bpm_ |
Current tempo in beats per minute. | |
int64 | ticks_per_minute_ |
double | ticks_per_second_ |
double | inv_ticks_per_second_ |
double | ticks_per_sample_ |
double | sample_per_ticks_ |
double | inv_samplerate_ |
Precalculated 1.0 / samplerate . | |
Static Protected Attributes | |
static constexpr const int64 | offset_ |
Musical time signature and tick conversions.
Definition at line 61 of file transport.hh.
struct Ase::TickSignature::Beat |
struct Ase::TickSignature::Time |
Definition at line 82 of file transport.hh.
Class Members | ||
---|---|---|
int32 | minutes | Tick position in minutes. |
double | seconds | Seconds with fraction after the minute. |
Ase::TickSignature::TickSignature | ( | ) |
Definition at line 20 of file transport.cc.
Definition at line 28 of file transport.cc.
Ase::TickSignature::TickSignature | ( | const TickSignature & | other | ) |
Definition at line 24 of file transport.cc.
Calculate bar from tick, requires set_signature().
Definition at line 136 of file transport.cc.
int32 Ase::TickSignature::bar_ticks | ( | ) | const |
Definition at line 92 of file transport.hh.
Calculate tick from bar, requires set_signature().
Definition at line 143 of file transport.cc.
TickSignature::Beat Ase::TickSignature::beat_from_tick | ( | int64 | tick | ) | const |
Calculate beat from tick, requires set_signature().
Definition at line 112 of file transport.cc.
References Ase::TickSignature::Beat::bar, Ase::TickSignature::Beat::beat, and Ase::TickSignature::Beat::semiquaver.
int32 Ase::TickSignature::beat_ticks | ( | ) | const |
Definition at line 93 of file transport.hh.
Calculate tick from beat, requires set_signature().
Definition at line 125 of file transport.cc.
References Ase::TickSignature::Beat::bar, Ase::TickSignature::Beat::beat, and Ase::TickSignature::Beat::semiquaver.
const uint8 & Ase::TickSignature::beat_unit | ( | ) | const |
Definition at line 101 of file transport.hh.
const uint8 & Ase::TickSignature::beats_per_bar | ( | ) | const |
Definition at line 100 of file transport.hh.
double Ase::TickSignature::bpm | ( | ) | const |
Definition at line 91 of file transport.hh.
double Ase::TickSignature::inv_samplerate | ( | ) | const |
Definition at line 87 of file transport.hh.
TickSignature & Ase::TickSignature::operator= | ( | const TickSignature & | src | ) |
Definition at line 35 of file transport.cc.
Definition at line 155 of file transport.hh.
Definition at line 149 of file transport.hh.
double Ase::TickSignature::samplerate | ( | ) | const |
Definition at line 86 of file transport.hh.
void Ase::TickSignature::set_bpm | ( | double | bpm | ) |
Assign tempo in beats per minute.
Definition at line 59 of file transport.cc.
References assert_return, bpm_, ISLIKELY, samplerate_, and Ase::TRANSPORT_PPQN.
void Ase::TickSignature::set_samplerate | ( | uint | samplerate | ) |
Assign sample rate.
Definition at line 47 of file transport.cc.
References assert_return, bpm_, inv_samplerate_, samplerate_, and Ase::TRANSPORT_PPQN.
Assign time signature and offset for the signature to take effect.
Definition at line 95 of file transport.cc.
References beat_unit_, beats_per_bar_, and CLAMP.
int64 Ase::TickSignature::start_offset | ( | ) | const |
Definition at line 94 of file transport.hh.
double Ase::TickSignature::ticks_per_sample | ( | ) | const |
Definition at line 88 of file transport.hh.
TickSignature::Time Ase::TickSignature::time_from_tick | ( | int64 | tick | ) | const |
Calculate time from tick, requires set_bpm().
Definition at line 74 of file transport.cc.
References Ase::TickSignature::Time::minutes, and Ase::TickSignature::Time::seconds.
Calculate tick from time, requires set_bpm().
Definition at line 85 of file transport.cc.
References time().
|
protected |
Definition at line 67 of file transport.hh.
|
protected |
Definition at line 66 of file transport.hh.
|
protected |
Lower numeral (denominator in [1 2 4 8 16]), note value that represents one beat.
Definition at line 65 of file transport.hh.
Referenced by set_signature().
|
protected |
Upper numeral (numerator), how many beats constitute a bar.
Definition at line 64 of file transport.hh.
Referenced by set_signature().
|
protected |
Current tempo in beats per minute.
Definition at line 69 of file transport.hh.
Referenced by set_bpm(), and set_samplerate().
|
protected |
Precalculated 1.0 / samplerate
.
Definition at line 75 of file transport.hh.
Referenced by set_samplerate().
|
protected |
Definition at line 72 of file transport.hh.
|
staticconstexprprotected |
Definition at line 63 of file transport.hh.
|
protected |
Definition at line 74 of file transport.hh.
|
protected |
Sample rate (mixing frequency) in Hz.
Definition at line 68 of file transport.hh.
Referenced by set_bpm(), and set_samplerate().
|
protected |
Definition at line 70 of file transport.hh.
|
protected |
Definition at line 73 of file transport.hh.
|
protected |
Definition at line 71 of file transport.hh.