Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::control::Scheduler< Slots, Capacity > Class Template Reference

Detailed Description

template<uint8_t Slots, uint8_t Capacity = 16>
class sbl::control::Scheduler< Slots, Capacity >

Definition at line 55 of file scheduler.hpp.

#include <scheduler.hpp>

Public Member Functions

 Scheduler (const uint16_t(&dividers)[Slots])
 
bool subscribe (Stage stage, uint8_t slot, TickFn fn, void *context)
 Add a subscriber. Returns false if full, the slot is out of range, or fn is null.
 
template<typename T , void(T::*)(uint32_t) Method>
bool subscribe (Stage stage, uint8_t slot, T &object)
 Subscribe a member void T::method(uint32_t elapsed_samples).
 
void run (uint32_t sample_clock)
 
uint8_t subscriber_count () const
 
uint16_t divider (uint8_t slot) const
 

Static Public Member Functions

static constexpr uint8_t slots ()
 
static constexpr uint8_t capacity ()
 

Constructor & Destructor Documentation

◆ Scheduler()

template<uint8_t Slots, uint8_t Capacity = 16>
sbl::control::Scheduler< Slots, Capacity >::Scheduler ( const uint16_t(&)  dividers[Slots])
inlineexplicit
Parameters
dividersBase ticks per run, per slot (0 is treated as 1).

Definition at line 61 of file scheduler.hpp.

Member Function Documentation

◆ subscribe() [1/2]

template<uint8_t Slots, uint8_t Capacity = 16>
bool sbl::control::Scheduler< Slots, Capacity >::subscribe ( Stage  stage,
uint8_t  slot,
TickFn  fn,
void *  context 
)
inline

Add a subscriber. Returns false if full, the slot is out of range, or fn is null.

Definition at line 68 of file scheduler.hpp.

Referenced by sbl::control::Scheduler< Slots, Capacity >::subscribe().

◆ subscribe() [2/2]

template<uint8_t Slots, uint8_t Capacity = 16>
template<typename T , void(T::*)(uint32_t) Method>
bool sbl::control::Scheduler< Slots, Capacity >::subscribe ( Stage  stage,
uint8_t  slot,
T &  object 
)
inline

Subscribe a member void T::method(uint32_t elapsed_samples).

Definition at line 76 of file scheduler.hpp.

References sbl::control::Scheduler< Slots, Capacity >::subscribe().

◆ run()

template<uint8_t Slots, uint8_t Capacity = 16>
void sbl::control::Scheduler< Slots, Capacity >::run ( uint32_t  sample_clock)
inline

One base tick. sample_clock is the audio frame count (wrapping). The first call establishes the baseline: every slot runs, told 0.

Definition at line 84 of file scheduler.hpp.

References sbl::control::kStageCount.

◆ subscriber_count()

template<uint8_t Slots, uint8_t Capacity = 16>
uint8_t sbl::control::Scheduler< Slots, Capacity >::subscriber_count ( ) const
inline

Definition at line 113 of file scheduler.hpp.

◆ divider()

template<uint8_t Slots, uint8_t Capacity = 16>
uint16_t sbl::control::Scheduler< Slots, Capacity >::divider ( uint8_t  slot) const
inline

Definition at line 114 of file scheduler.hpp.

◆ slots()

template<uint8_t Slots, uint8_t Capacity = 16>
static constexpr uint8_t sbl::control::Scheduler< Slots, Capacity >::slots ( )
inlinestaticconstexpr

Definition at line 115 of file scheduler.hpp.

◆ capacity()

template<uint8_t Slots, uint8_t Capacity = 16>
static constexpr uint8_t sbl::control::Scheduler< Slots, Capacity >::capacity ( )
inlinestaticconstexpr

Definition at line 116 of file scheduler.hpp.


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