:json module —
no jason dependency). The NIF links the Rust static archive
(target/release/librockbox_ffi.a); mix compile builds it automatically
through elixir_make (running cargo build --release -p rockbox-ffi first if
the archive is missing).
Quick start
Decode a file to PCM
Rockbox.Decoder runs the Rockbox codec engine directly, yielding interleaved
stereo S16LE PCM one chunk at a time — no output device required.
API
Rockbox.Player — every mutating function returns the handle (pipe-friendly),
so setup chains with |>; getters/queries return their values:
- Transport:
play/1,pause/1,toggle/1,stop/1,next/1,previous/1,skip_to/2,seek_ms/2,set_volume/2/volume/1,set_balance/2/balance/1(stereo balance,-100full left …+100full right,0= centre),sample_rate/1,status/1. - Sources / queue:
set_queue/2andenqueue/2accept local file paths,http(s)://URLs, and live-radio / streaming URLs; plusinsert/4,queue/1,import_m3u/4,load_m3u/2,export_m3u/2, and resume viaresume/1/save_resume/1/clear_resume/1. - Shuffle & repeat:
set_shuffle/2/shuffle_enabled?/1;set_repeat/2/repeat/1(Rockbox.RepeatMode). - DSP chain:
set_eq_enabled/2/eq_enabled?/1,set_eq_preset/2(21Rockbox.EqPresetpresets),set_eq_band/5,set_eq_precut/2,set_tone/5/set_bass/2/set_treble/2/set_bass_cutoff/2/set_treble_cutoff/2,set_crossfeed/6(Rockbox.CrossfeedMode),set_surround/5,set_channel_mode/2(Rockbox.ChannelMode) /set_stereo_width/2,set_bass_enhancement/3,set_fatigue_reduction/2,set_compressor/7,set_dither/2,set_pitch/2, anddsp_settings/1(full DSP state as a map). - Crossfade / ReplayGain:
set_crossfade/7,set_replaygain/4.
- Handles (
Rockbox.Dsp/Rockbox.Player) are NIF resources freed by the BEAM garbage collector — no explicit close. - PCM crosses the boundary as an int16 LE binary.
- Rich values come back as maps with atom keys.
- The DSP chain mirrors Rockbox’s own; see the official Rockbox sound-settings manual for what each control does.
Docs
Generate API docs locally withmix docs (→ doc/index.html), or read the
published ones at hexdocs.pm/rockbox_ex_ffi.
The Elixir and Gleam bindings share the exact same
rockbox_ffi_nif.{c,erl} NIF, vendored into each project.