Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
sbl::dsp::SegmentGenerator< CurveEngine > Class Template Reference

#include <segment.hpp>

Inheritance diagram for sbl::dsp::SegmentGenerator< CurveEngine >:
Collaboration diagram for sbl::dsp::SegmentGenerator< CurveEngine >:

Public Member Functions

void configure (const Segment *segments, uint8_t count, int8_t sustain_index=-1)
 
void set_sample_rate (uint32_t sr)
 
void gate_on ()
 
void gate_off ()
 
void retrigger ()
 Retrigger: restart from current level without requiring gate_off first.
 
void process (float *out, uint16_t frames)
 Fill output buffer with envelope levels (float [0.0, 1.0]).
 
float level () const
 
bool active () const
 
SegmentState state () const
 
uint8_t current_segment_index () const
 

Static Public Attributes

static constexpr uint8_t MAX_SEGMENTS = 8
 

Detailed Description

template<typename CurveEngine = FloatDefaultWarp>
class sbl::dsp::SegmentGenerator< CurveEngine >

Definition at line 46 of file segment.hpp.

Member Function Documentation

◆ active()

template<typename CurveEngine = FloatDefaultWarp>
bool sbl::dsp::SegmentGenerator< CurveEngine >::active ( ) const
inline

Definition at line 130 of file segment.hpp.

References sbl::dsp::Complete, and sbl::dsp::Idle.

◆ configure()

template<typename CurveEngine = FloatDefaultWarp>
void sbl::dsp::SegmentGenerator< CurveEngine >::configure ( const Segment segments,
uint8_t  count,
int8_t  sustain_index = -1 
)
inline

Configure the segment sequence.

Parameters
segmentsArray of segments (copied internally, up to MAX_SEGMENTS)
countNumber of segments
sustain_indexSegment index to hold at (-1 = no sustain)

Definition at line 58 of file segment.hpp.

References sbl::dsp::SegmentGenerator< CurveEngine >::MAX_SEGMENTS.

◆ current_segment_index()

template<typename CurveEngine = FloatDefaultWarp>
uint8_t sbl::dsp::SegmentGenerator< CurveEngine >::current_segment_index ( ) const
inline

Definition at line 135 of file segment.hpp.

◆ gate_off()

template<typename CurveEngine = FloatDefaultWarp>
void sbl::dsp::SegmentGenerator< CurveEngine >::gate_off ( )
inline

Release the envelope. If in sustain, jumps to the next segment (typically release). If running pre-sustain, jumps to release. If no sustain configured, does nothing.

Definition at line 83 of file segment.hpp.

References sbl::dsp::Running, and sbl::dsp::Sustain.

◆ gate_on()

template<typename CurveEngine = FloatDefaultWarp>
void sbl::dsp::SegmentGenerator< CurveEngine >::gate_on ( )
inline

Start the envelope from segment 0. If already running, restarts from the current level (retrigger behavior).

Definition at line 73 of file segment.hpp.

References sbl::dsp::Idle, and sbl::dsp::Running.

◆ level()

template<typename CurveEngine = FloatDefaultWarp>
float sbl::dsp::SegmentGenerator< CurveEngine >::level ( ) const
inline

Definition at line 128 of file segment.hpp.

◆ process()

template<typename CurveEngine = FloatDefaultWarp>
void sbl::dsp::SegmentGenerator< CurveEngine >::process ( float *  out,
uint16_t  frames 
)
inline

Fill output buffer with envelope levels (float [0.0, 1.0]).

Definition at line 108 of file segment.hpp.

References sbl::dsp::Running, and sbl::dsp::Segment::target.

◆ retrigger()

template<typename CurveEngine = FloatDefaultWarp>
void sbl::dsp::SegmentGenerator< CurveEngine >::retrigger ( )
inline

Retrigger: restart from current level without requiring gate_off first.

Definition at line 98 of file segment.hpp.

References sbl::dsp::Running.

◆ set_sample_rate()

template<typename CurveEngine = FloatDefaultWarp>
void sbl::dsp::SegmentGenerator< CurveEngine >::set_sample_rate ( uint32_t  sr)
inline

Definition at line 67 of file segment.hpp.

◆ state()

template<typename CurveEngine = FloatDefaultWarp>
SegmentState sbl::dsp::SegmentGenerator< CurveEngine >::state ( ) const
inline

Definition at line 134 of file segment.hpp.

Member Data Documentation

◆ MAX_SEGMENTS

template<typename CurveEngine = FloatDefaultWarp>
constexpr uint8_t sbl::dsp::SegmentGenerator< CurveEngine >::MAX_SEGMENTS = 8
staticconstexpr
Note
All public methods are ISR-safe — bounded computation, no I/O.

Definition at line 50 of file segment.hpp.

Referenced by sbl::dsp::SegmentGenerator< CurveEngine >::configure().


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