Expand description
FFI bindings to the Rockbox DSP pipeline (lib/rbcodec/dsp/), compiled
standalone by build.rs — no firmware, no kernel, no SDL.
Pipeline stages (fixed order, each individually enable-able): pre-gain (replaygain / EQ precut) → timestretch → resampler → crossfeed → 10-band EQ → tone controls → bass enhancement (PBE) → auditory fatigue reduction → Haas surround → channel modes → compressor.
The raw API mirrors dsp_core.h; Dsp is a minimal safe wrapper for
the common case (interleaved 16-bit stereo in → interleaved 16-bit
stereo out), suitable for feeding a cpal output callback.
Unit conventions (see dsp_filter.c): EQ/tone gains and Q are in
tenths (gain = -80 → −8.0 dB, q = 7 → Q 0.7 — pass q * 10).
Structs§
- Dsp
- Safe wrapper around the audio DSP instance for interleaved 16-bit stereo.
- compressor_
settings struct compressor_settings(compressor.h) — threshold in dB (0 = off), makeup_gain 0 = off / 1 = auto, ratio index (0 = 2:1 … 4 = limit), knee index (0 = hard … 2 = soft), attack/release in ms- dsp_
buffer struct dsp_buffer(dsp_core.h)- dsp_
config - Opaque
struct dsp_config - eq_
band_ setting struct eq_band_setting(eq.h) —qandgainin tenths,cutoffin Hz- replaygain_
settings struct replaygain_settings(dsp_misc.h) —type_is one of theREPLAYGAIN_*constants,preampin dB × 10,noclipscales down to prevent clipping (works even without gain tags if a peak is known)- sample_
format struct sample_format(dsp_core.h)
Constants§
- CODEC_
IDX_ AUDIO - CODEC_
IDX_ VOICE - DSP_
FLUSH - DSP_
GET_ OUT_ FREQUENCY - DSP_
RESET - DSP_
SET_ FREQUENCY - DSP_
SET_ OUT_ FREQUENCY - DSP_
SET_ PITCH - DSP_
SET_ SAMPLE_ DEPTH - DSP_
SET_ STEREO_ MODE - EQ_
NUM_ BANDS - REPLAYGAIN_
ALBUM - REPLAYGAIN_
OFF - REPLAYGAIN_
SHUFFLE - REPLAYGAIN_
TRACK - SOUND_
CHAN_ CUSTOM - SOUND_
CHAN_ KARAOKE - SOUND_
CHAN_ MONO - SOUND_
CHAN_ MONO_ LEFT - SOUND_
CHAN_ MONO_ RIGHT - SOUND_
CHAN_ STEREO - SOUND_
CHAN_ SWAP - STEREO_
INTERLEAVED - STEREO_
MONO - STEREO_
NONINTERLEAVED
Functions§
- channel_
mode_ ⚠custom_ set_ width - channel_
mode_ ⚠set_ config - dsp_
configure ⚠ - dsp_
dither_ ⚠enable - dsp_
eq_ ⚠enable - dsp_
get_ ⚠config - dsp_
get_ ⚠id - dsp_
get_ ⚠output_ frequency - dsp_
get_ ⚠pitch - dsp_
init ⚠ - dsp_
process ⚠ - dsp_
replaygain_ ⚠set_ settings - dsp_
set_ ⚠all_ output_ frequency - dsp_
set_ ⚠compressor - dsp_
set_ ⚠eq_ coefs - dsp_
set_ ⚠eq_ precut - dsp_
set_ ⚠pitch - dsp_
surround_ ⚠enable - dsp_
surround_ ⚠mix - dsp_
surround_ ⚠set_ balance - dsp_
surround_ ⚠set_ cutoff - dsp_
surround_ ⚠side_ only - get_
replaygain_ ⚠int - rbdsp_
replaygain_ ⚠set_ gains - tone_
set_ ⚠bass - tone_
set_ ⚠bass_ cutoff - tone_
set_ ⚠prescale - tone_
set_ ⚠treble - tone_
set_ ⚠treble_ cutoff