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::dsp::types Namespace Reference

Sample rate, sample formats, blocks and frames. More...

Detailed Description

Sample rate, sample formats, blocks and frames.

Classes

struct  Frame
 
struct  MonoBlock
 Mono audio buffer with static allocation. More...
 
struct  StereoBlock
 Stereo audio buffer with static allocation. More...
 

Functions

float to_float (Sample s)
 
Sample to_sample (float f)
 
void to_float (const Sample *in, float *out, uint16_t frames)
 
void to_sample (const float *in, Sample *out, uint16_t frames)
 
void deinterleave_to_float (const int32_t *interleaved, float *left, float *right, uint16_t frames)
 
void interleave_from_float (const float *left, const float *right, int32_t *interleaved, uint16_t frames)
 
constexpr int32_t saturate_24 (int32_t x)
 Clamp value to 24-bit audio range.
 

Variables

constexpr float SAMPLE_SCALE_F = 8388607.0f
 
constexpr float SAMPLE_SCALE_INV_F = 1.0f / 8388607.0f
 
uint32_t SAMPLE_RATE = 48000
 
float SAMPLE_RATE_F = 48000.0f
 
constexpr int32_t SAMPLE_MAX_24 = 8388607
 
constexpr int32_t SAMPLE_MIN_24 = -8388607
 

Function Documentation

◆ to_float() [1/2]

float sbl::dsp::types::to_float ( Sample  s)
inline

Definition at line 34 of file convert.hpp.

References SAMPLE_SCALE_INV_F.

◆ to_sample() [1/2]

Sample sbl::dsp::types::to_sample ( float  f)
inline

Definition at line 38 of file convert.hpp.

References SAMPLE_SCALE_F.

◆ to_float() [2/2]

void sbl::dsp::types::to_float ( const Sample *  in,
float *  out,
uint16_t  frames 
)
inline

Definition at line 44 of file convert.hpp.

References SAMPLE_SCALE_INV_F.

◆ to_sample() [2/2]

void sbl::dsp::types::to_sample ( const float *  in,
Sample *  out,
uint16_t  frames 
)
inline

Definition at line 50 of file convert.hpp.

References SAMPLE_SCALE_F.

◆ deinterleave_to_float()

void sbl::dsp::types::deinterleave_to_float ( const int32_t *  interleaved,
float *  left,
float *  right,
uint16_t  frames 
)
inline

Definition at line 61 of file convert.hpp.

References SAMPLE_SCALE_INV_F.

◆ interleave_from_float()

void sbl::dsp::types::interleave_from_float ( const float *  left,
const float *  right,
int32_t *  interleaved,
uint16_t  frames 
)
inline

Definition at line 96 of file convert.hpp.

References SAMPLE_SCALE_F, and SBL_NAN_DETECTED.

Referenced by sbl::dsp::types::Frame< MaxFrames >::end().

◆ saturate_24()

constexpr int32_t sbl::dsp::types::saturate_24 ( int32_t  x)
inlineconstexpr

Clamp value to 24-bit audio range.

Definition at line 24 of file fixed.hpp.

References SAMPLE_MAX_24, and SAMPLE_MIN_24.

Variable Documentation

◆ SAMPLE_SCALE_F

constexpr float sbl::dsp::types::SAMPLE_SCALE_F = 8388607.0f
inlineconstexpr

Definition at line 29 of file convert.hpp.

Referenced by interleave_from_float(), to_sample(), and to_sample().

◆ SAMPLE_SCALE_INV_F

constexpr float sbl::dsp::types::SAMPLE_SCALE_INV_F = 1.0f / 8388607.0f
inlineconstexpr

Definition at line 30 of file convert.hpp.

Referenced by deinterleave_to_float(), to_float(), and to_float().

◆ SAMPLE_RATE

uint32_t sbl::dsp::types::SAMPLE_RATE = 48000
inline

Definition at line 16 of file fixed.hpp.

◆ SAMPLE_RATE_F

◆ SAMPLE_MAX_24

constexpr int32_t sbl::dsp::types::SAMPLE_MAX_24 = 8388607
inlineconstexpr

Definition at line 20 of file fixed.hpp.

Referenced by saturate_24().

◆ SAMPLE_MIN_24

constexpr int32_t sbl::dsp::types::SAMPLE_MIN_24 = -8388607
inlineconstexpr

Definition at line 21 of file fixed.hpp.

Referenced by saturate_24().