Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::patterns::timing::BeatClock Class Reference

#include <beat_clock.hpp>

Collaboration diagram for sbl::patterns::timing::BeatClock:

Public Member Functions

 BeatClock (uint16_t tick_rate_hz, uint8_t beats_per_bar=4)
 Construct with tick rate (Hz) and time signature.
 
void set_bpm (uint16_t bpm)
 Set tempo. Recalculates all derived tick counts.
 
void set_gate_percent (uint8_t percent)
 Set gate duration as percentage of bar (0-100). Default 75%.
 
bool advance ()
 Advance one tick. Returns true on bar boundary (tick wraps to 0).
 
bool at_beat () const
 True when current tick is on a beat boundary.
 
bool at_gate_off () const
 True at the gate-off point within the bar.
 
void reset ()
 Reset tick counter to start of bar.
 
uint16_t bpm () const
 
uint32_t tick () const
 
uint32_t ticks_per_bar () const
 
uint32_t ticks_per_beat () const
 
uint8_t beats_per_bar () const
 

Detailed Description

Definition at line 27 of file beat_clock.hpp.

Constructor & Destructor Documentation

◆ BeatClock()

sbl::patterns::timing::BeatClock::BeatClock ( uint16_t  tick_rate_hz,
uint8_t  beats_per_bar = 4 
)
inlineexplicit

Construct with tick rate (Hz) and time signature.

Definition at line 30 of file beat_clock.hpp.

References set_bpm().

Here is the call graph for this function:

Member Function Documentation

◆ advance()

bool sbl::patterns::timing::BeatClock::advance ( )
inline

Advance one tick. Returns true on bar boundary (tick wraps to 0).

Definition at line 54 of file beat_clock.hpp.

◆ at_beat()

bool sbl::patterns::timing::BeatClock::at_beat ( ) const
inline

True when current tick is on a beat boundary.

Definition at line 63 of file beat_clock.hpp.

◆ at_gate_off()

bool sbl::patterns::timing::BeatClock::at_gate_off ( ) const
inline

True at the gate-off point within the bar.

Definition at line 68 of file beat_clock.hpp.

◆ beats_per_bar()

uint8_t sbl::patterns::timing::BeatClock::beats_per_bar ( ) const
inline

Definition at line 78 of file beat_clock.hpp.

◆ bpm()

uint16_t sbl::patterns::timing::BeatClock::bpm ( ) const
inline

Definition at line 74 of file beat_clock.hpp.

Referenced by set_bpm().

Here is the caller graph for this function:

◆ reset()

void sbl::patterns::timing::BeatClock::reset ( )
inline

Reset tick counter to start of bar.

Definition at line 71 of file beat_clock.hpp.

◆ set_bpm()

void sbl::patterns::timing::BeatClock::set_bpm ( uint16_t  bpm)
inline

Set tempo. Recalculates all derived tick counts.

Definition at line 38 of file beat_clock.hpp.

References bpm().

Referenced by BeatClock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_gate_percent()

void sbl::patterns::timing::BeatClock::set_gate_percent ( uint8_t  percent)
inline

Set gate duration as percentage of bar (0-100). Default 75%.

Definition at line 47 of file beat_clock.hpp.

◆ tick()

uint32_t sbl::patterns::timing::BeatClock::tick ( ) const
inline

Definition at line 75 of file beat_clock.hpp.

◆ ticks_per_bar()

uint32_t sbl::patterns::timing::BeatClock::ticks_per_bar ( ) const
inline

Definition at line 76 of file beat_clock.hpp.

◆ ticks_per_beat()

uint32_t sbl::patterns::timing::BeatClock::ticks_per_beat ( ) const
inline

Definition at line 77 of file beat_clock.hpp.


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