16#define DSP_MAX_BANDS 10
17#define DSP_PRESET_NAME_MAX 48
88#define DSP_DRAIN_MAX 128u
106 float b0, b1, b2,
a1, a2;
Audio formats and PCM conventions.
@ DSP_FLAG_EQ
Definition dsp.h:70
@ DSP_FLAG_LIMITER
Definition dsp.h:73
@ DSP_FLAG_RG
Definition dsp.h:69
@ DSP_FLAG_CROSSFEED
Definition dsp.h:71
@ DSP_FLAG_DITHER
Definition dsp.h:74
@ DSP_FLAG_RESAMPLE
set by the player, not by dsp
Definition dsp.h:75
@ DSP_FLAG_SW_VOLUME
Definition dsp.h:72
void dsp_configure(dsp_t *d, const dsp_config_t *cfg, uint32_t sample_rate, uint8_t channels)
(Re)configure for a format. Keeps filter state when only gains change.
#define DSP_PRESET_NAME_MAX
Definition dsp.h:17
void biquad_design(biquad_coef_t *c, peq_type_t type, float fs, float f0, float gain_db, float q)
RBJ Audio EQ Cookbook designs.
float lin_to_db(float lin)
void dsp_config_defaults(dsp_config_t *c)
float db_to_lin(float db)
struct dsp dsp_t
Definition dsp.h:78
int eq_preset_parse_autoeq(const char *text, eq_preset_t *out)
Parse AutoEQ "ParametricEQ.txt" (lines like "Preamp: -6.3 dB" and "Filter 1: ON PK Fc 105 Hz Gain -2....
uint32_t eq_builtin_count(void)
Built-in presets: "Flat", "Bass", "Treble", "Vocal", "Loudness". Index 0 is Flat.
rg_mode_t
Definition dsp.h:47
@ RG_TRACK
Definition dsp.h:47
@ RG_AUTO
Definition dsp.h:47
@ RG_ALBUM
Definition dsp.h:47
@ RG_OFF
Definition dsp.h:47
void pcm_mono_to_stereo(const int32_t *in, int32_t *out, size_t frames)
Upmix mono Q31 to stereo. in == out is allowed (the buffer must hold 2*frames samples).
void pcm_f32_to_q31(const float *in, int32_t *out, size_t samples)
saturating
void dsp_process(dsp_t *d, int32_t *pcm, uint32_t frames)
in place
int eq_preset_format_autoeq(const eq_preset_t *p, char *out, size_t out_size)
Write the same text format (so presets round-trip). Returns bytes written or <0.
const eq_preset_t * eq_builtin_get(uint32_t index)
void pcm_q31_to_s16_dither(const int32_t *in, int16_t *out, size_t samples, uint32_t *state)
Reduce to 16 bits with TPDF dither (state = LCG seed, keep per stream).
peq_type_t
Definition dsp.h:19
@ PEQ_LOW_SHELF
Definition dsp.h:19
@ PEQ_HIGH_SHELF
Definition dsp.h:19
@ PEQ_PEAK
Definition dsp.h:19
@ PEQ_HIGH_PASS
Definition dsp.h:19
@ PEQ_LOW_PASS
Definition dsp.h:19
void dsp_set_replaygain(dsp_t *d, float track_gain_db, float track_peak, float album_gain_db, float album_peak, bool album_context)
ReplayGain values of the current track (NAN when absent). Call on track change.
uint32_t dsp_active_flags(const dsp_t *d)
void dsp_reset(dsp_t *d)
clear filter state (seek, track change)
uint32_t dsp_process_out(dsp_t *d, int32_t *pcm, uint32_t frames, uint32_t cap_frames)
dsp_process() with room for more output.
float biquad_response_db(const biquad_coef_t *c, float fs, float f)
Magnitude response in dB at frequency f (for EQ curve drawing and tests).
void dsp_destroy(dsp_t *d)
bool dsp_is_bypass(const dsp_t *d)
void pcm_q31_to_f32(const int32_t *in, float *out, size_t samples)
Q31 <-> float.
#define DSP_MAX_BANDS
Definition dsp.h:16
Low-level building blocks, exported for tests and for the Bluetooth path.
Definition dsp.h:105
float a1
Definition dsp.h:106
uint16_t crossfeed_fcut_hz
300..2000, default 700
Definition dsp.h:57
bool limiter_enabled
soft limiter when gains can exceed 0 dBFS
Definition dsp.h:61
float volume_db
used only if sw_volume; <= 0
Definition dsp.h:60
uint8_t out_bits
sink resolution for dither: 16, 24 or 32 (32 = no dither)
Definition dsp.h:62
bool crossfeed_enabled
Definition dsp.h:56
rg_mode_t rg_mode
Definition dsp.h:52
eq_preset_t eq
Definition dsp.h:51
float rg_preamp_db
added to RG gain, default 0
Definition dsp.h:53
bool rg_prevent_clip
limit gain by peak
Definition dsp.h:55
bool eq_enabled
Definition dsp.h:50
float rg_fallback_db
gain for files without RG tags, default 0
Definition dsp.h:54
float crossfeed_level_db
1..15, default 4.5
Definition dsp.h:58
bool sw_volume
true when the sink has no hardware volume
Definition dsp.h:59
float preamp_db
usually negative to avoid clipping
Definition dsp.h:31
uint8_t band_count
Definition dsp.h:32
bool enabled
Definition dsp.h:26
float freq_hz
Definition dsp.h:23
float q
Definition dsp.h:25
peq_type_t type
Definition dsp.h:22
float gain_db
ignored for pass filters
Definition dsp.h:24