esp32-audio-player 0.1.0
Audio player engine for ESP32
Loading...
Searching...
No Matches
resampler.h File Reference

Sample-rate conversion for the Bluetooth path (A2DP runs at 44.1 or 48 kHz). More...

Include dependency graph for resampler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct resampler resampler_t
 

Enumerations

enum  resampler_quality_t { RESAMPLER_FAST = 0 , RESAMPLER_GOOD = 1 }
 

Functions

resampler_t * resampler_create (uint32_t in_rate, uint32_t out_rate, uint8_t channels, resampler_quality_t q)
 Returns NULL if the conversion is not supported. in_rate == out_rate is allowed (copy).
 
void resampler_destroy (resampler_t *r)
 
void resampler_reset (resampler_t *r)
 
uint32_t resampler_process (resampler_t *r, const int32_t *in, uint32_t in_frames, uint32_t *consumed, int32_t *out, uint32_t out_cap)
 Convert interleaved Q31.
 
uint32_t resampler_max_output (const resampler_t *r, uint32_t in_frames)
 Upper bound of output frames for a given input count (for buffer sizing).
 

Detailed Description

Sample-rate conversion for the Bluetooth path (A2DP runs at 44.1 or 48 kHz).

Integer ratios 2:1 and 4:1 use cascaded half-band decimators (cheap, the common hi-res case). Other ratios (48k -> 44.1k = 147/160) use a polyphase windowed-sinc filter. The wired path never resamples.

Typedef Documentation

◆ resampler_t

typedef struct resampler resampler_t

Enumeration Type Documentation

◆ resampler_quality_t

Enumerator
RESAMPLER_FAST 

~16 taps/phase, for weak CPUs

RESAMPLER_GOOD 

~32 taps/phase, default

Function Documentation

◆ resampler_create()

resampler_t * resampler_create ( uint32_t  in_rate,
uint32_t  out_rate,
uint8_t  channels,
resampler_quality_t  q 
)

Returns NULL if the conversion is not supported. in_rate == out_rate is allowed (copy).

◆ resampler_destroy()

void resampler_destroy ( resampler_t *  r)

◆ resampler_max_output()

uint32_t resampler_max_output ( const resampler_t *  r,
uint32_t  in_frames 
)

Upper bound of output frames for a given input count (for buffer sizing).

◆ resampler_process()

uint32_t resampler_process ( resampler_t *  r,
const int32_t *  in,
uint32_t  in_frames,
uint32_t *  consumed,
int32_t *  out,
uint32_t  out_cap 
)

Convert interleaved Q31.

Consumes up to in_frames, writes up to out_cap frames. *consumed receives input frames used. Returns output frames written.

◆ resampler_reset()

void resampler_reset ( resampler_t *  r)