Skip to main content

Crate rockbox_dsp

Crate rockbox_dsp 

Source
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) — q and gain in tenths, cutoff in Hz
replaygain_settings
struct replaygain_settings (dsp_misc.h) — type_ is one of the REPLAYGAIN_* constants, preamp in dB × 10, noclip scales 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

Unions§

dsp_buffer_count
dsp_buffer_ptrs