Queue-based player with native ReplayGain and Rockbox crossfade.
A player owns a live audio output device and a background engine thread —
construct it only where an output device exists. A handle is an opaque
MemorySegment; every function takes it as the first argument. Free it with
free (or use with-player).
ReplayGain mode here uses the player values (rockbox.ffi.enums/replaygain-mode:
:off :track :album) — distinct from the DSP encoding.
Mutating functions return the player handle, so they thread cleanly with ->:
(-> p
(player/set-queue tracks)
(player/set-shuffle true)
(player/set-repeat :all)
(player/play))
Getters/queries (volume, status, queue, dsp-settings, …) return their
values as usual.
Queue-based player with native ReplayGain and Rockbox crossfade.
A player owns a live audio output device and a background engine thread —
construct it only where an output device exists. A handle is an opaque
MemorySegment; every function takes it as the first argument. Free it with
`free` (or use `with-player`).
ReplayGain `mode` here uses the *player* values (rockbox.ffi.enums/replaygain-mode:
:off :track :album) — distinct from the DSP encoding.
Mutating functions return the player handle, so they thread cleanly with `->`:
(-> p
(player/set-queue tracks)
(player/set-shuffle true)
(player/set-repeat :all)
(player/play))
Getters/queries (`volume`, `status`, `queue`, `dsp-settings`, …) return their
values as usual.(clear-resume p)Delete the player's resume file. Returns p for threading.
Delete the player's resume file. Returns `p` for threading.
(dsp-settings p)A snapshot of the player's DSP settings as a map (keyword keys).
A snapshot of the player's DSP settings as a map (keyword keys).
(enqueue p path)Append one track to the queue. path may be a local file path, an
http(s):// URL to a finite remote file, or a live-radio / streaming URL.
Returns p for threading.
Append one track to the queue. `path` may be a local file path, an http(s):// URL to a finite remote file, or a live-radio / streaming URL. Returns `p` for threading.
(eq-enabled? p)Whether the parametric EQ is currently enabled.
Whether the parametric EQ is currently enabled.
(export-m3u p path)Export the current queue to an .m3u8 at path (atomic). Returns true on
success, false on error.
Export the current queue to an .m3u8 at `path` (atomic). Returns true on success, false on error.
(free p)Free the native handle. Safe to call with nil.
Free the native handle. Safe to call with nil.
(import-m3u p path)(import-m3u p path position)(import-m3u p path position index)Import the playlist file at path into the queue at position
(rockbox.ffi.enums/insert-position; default :insert-last). index is only
used when position is :index. Returns the imported paths as a vector, or
nil on error.
Import the playlist file at `path` into the queue at `position` (rockbox.ffi.enums/insert-position; default :insert-last). `index` is only used when `position` is :index. Returns the imported paths as a vector, or nil on error.
(insert p paths)(insert p paths position)(insert p paths position index)Splice paths (local paths or http(s):// URLs) into the queue at position
(rockbox.ffi.enums/insert-position; default :insert-last). index is only
used when position is :index. Returns p for threading.
Splice `paths` (local paths or http(s):// URLs) into the queue at `position` (rockbox.ffi.enums/insert-position; default :insert-last). `index` is only used when `position` is :index. Returns `p` for threading.
(is-url? s)Whether s looks like an http(s):// URL.
Whether `s` looks like an http(s):// URL.
(load-m3u p path)Replace the queue with the playlist file at path. Returns the loaded paths
as a vector, or nil on error.
Replace the queue with the playlist file at `path`. Returns the loaded paths as a vector, or nil on error.
(load-resume path)Peek at a resume/.m3u8 file at path without a player. Returns a map
{:tracks [...] :index n :elapsed_ms n}, or nil if absent/invalid.
Peek at a resume/.m3u8 file at `path` without a player. Returns a map
{:tracks [...] :index n :elapsed_ms n}, or nil if absent/invalid.(m3u-read path)Parse a playlist file at path into a vector of maps
{:path s :duration_ms n :title s}, or nil on error. No player needed.
Parse a playlist file at `path` into a vector of maps
{:path s :duration_ms n :title s}, or nil on error. No player needed.(m3u-write path paths)Write paths (a seq of path/URL strings) as an .m3u8 at path. Returns true
on success, false on error. No player needed.
Write `paths` (a seq of path/URL strings) as an .m3u8 at `path`. Returns true on success, false on error. No player needed.
(new-player)(new-player config)Create a player. config overrides default-config (see the C ABI's
rb_player_new_with_config / _ex). Throws if no output device is available.
If :resume-file is set, the queue and exact position are auto-persisted to
that .m3u8 every :resume-save-interval-ms ms (0 => 5 s), enabling
resume/save-resume/clear-resume.
Create a player. `config` overrides `default-config` (see the C ABI's rb_player_new_with_config / _ex). Throws if no output device is available. If `:resume-file` is set, the queue and exact position are auto-persisted to that .m3u8 every `:resume-save-interval-ms` ms (0 => 5 s), enabling `resume`/`save-resume`/`clear-resume`.
(next p)Skip to the next track. Returns p for threading.
Skip to the next track. Returns `p` for threading.
(pause p)Pause playback. Returns p for threading.
Pause playback. Returns `p` for threading.
(play p)Start playback. Returns p for threading.
Start playback. Returns `p` for threading.
(previous p)Skip to the previous track. Returns p for threading.
Skip to the previous track. Returns `p` for threading.
(queue p)The current queue as a vector of path/URL strings.
The current queue as a vector of path/URL strings.
(repeat p)The current repeat mode as its raw int (0 off, 1 one, 2 all).
The current repeat mode as its raw int (0 off, 1 one, 2 all).
(resume p)Restore the queue + exact position from the player's resume file (does NOT auto-play). Returns a map {:tracks [...] :index n :elapsed_ms n}, or nil if there was nothing to resume.
Restore the queue + exact position from the player's resume file (does NOT
auto-play). Returns a map {:tracks [...] :index n :elapsed_ms n}, or nil if
there was nothing to resume.(save-resume p)Persist the queue + current position to the player's resume file now.
Returns p for threading.
Persist the queue + current position to the player's resume file now. Returns `p` for threading.
(seek-ms p ms)Seek to ms in the current track. Returns p for threading.
Seek to `ms` in the current track. Returns `p` for threading.
(set-bass p bass-db)Set the bass tone gain in dB. Returns p for threading.
Set the bass tone gain in dB. Returns `p` for threading.
(set-bass-cutoff p hz)Set the bass tone-control cutoff frequency in Hz. Returns p for threading.
Set the bass tone-control cutoff frequency in Hz. Returns `p` for threading.
(set-bass-enhancement p strength precut)Configure bass enhancement: strength and precut. Returns p for
threading.
Configure bass enhancement: `strength` and `precut`. Returns `p` for threading.
(set-channel-mode p mode)Set the channel mode (rockbox.ffi.enums/channel-mode; e.g. :stereo :mono).
Returns p for threading.
Set the channel mode (rockbox.ffi.enums/channel-mode; e.g. :stereo :mono). Returns `p` for threading.
(set-compressor p threshold-db makeup-gain ratio knee attack-ms release-ms)Configure the dynamic-range compressor. Returns p for threading.
Configure the dynamic-range compressor. Returns `p` for threading.
(set-crossfade p
mode
&
{:keys [fade-out-delay-ms fade-out-duration-ms fade-in-delay-ms
fade-in-duration-ms mix-mode]
:or {fade-out-delay-ms 0
fade-out-duration-ms 2000
fade-in-delay-ms 0
fade-in-duration-ms 2000
mix-mode :crossfade}})Configure crossfade. Returns p for threading.
Configure crossfade. Returns `p` for threading.
(set-crossfeed p mode direct-gain cross-gain hf-gain hf-cutoff)Configure the crossfeed effect (headphone spatialization).
mode is rockbox.ffi.enums/crossfeed-mode (:off :meier :custom). The gains
(direct-gain, cross-gain, hf-gain) and hf-cutoff (Hz) are only used in
:custom mode. Returns p for threading.
Configure the crossfeed effect (headphone spatialization). `mode` is rockbox.ffi.enums/crossfeed-mode (:off :meier :custom). The gains (`direct-gain`, `cross-gain`, `hf-gain`) and `hf-cutoff` (Hz) are only used in :custom mode. Returns `p` for threading.
(set-dither p enabled?)Enable or disable dithering. Returns p for threading.
Enable or disable dithering. Returns `p` for threading.
(set-eq-band p band cutoff-hz q gain-db)Configure one EQ band. q and gain-db are plain (not tenths) values.
Returns p for threading.
Configure one EQ band. `q` and `gain-db` are plain (not tenths) values. Returns `p` for threading.
(set-eq-enabled p enabled?)Enable or disable the parametric EQ. Returns p for threading.
Enable or disable the parametric EQ. Returns `p` for threading.
(set-eq-precut p db)Set the EQ pre-cut (attenuation) in dB. Returns p for threading.
Set the EQ pre-cut (attenuation) in dB. Returns `p` for threading.
(set-eq-preset p preset)Apply a built-in EQ preset (rockbox.ffi.enums/eq-preset; e.g. :flat :rock).
Returns p for threading.
Apply a built-in EQ preset (rockbox.ffi.enums/eq-preset; e.g. :flat :rock). Returns `p` for threading.
(set-fatigue-reduction p strength)Set the listening-fatigue reduction strength. Returns p for threading.
Set the listening-fatigue reduction `strength`. Returns `p` for threading.
(set-pitch p ratio)Set the playback pitch ratio. Returns p for threading.
Set the playback pitch ratio. Returns `p` for threading.
(set-queue p paths)Replace the queue. Each entry may be a local file path, an http(s):// URL
to a finite remote file, or a live-radio / streaming URL. Returns p for
threading.
Replace the queue. Each entry may be a local file path, an http(s):// URL to a finite remote file, or a live-radio / streaming URL. Returns `p` for threading.
(set-repeat p mode)Set the repeat mode (rockbox.ffi.enums/repeat-mode; :off :one :all). Returns
p for threading.
Set the repeat mode (rockbox.ffi.enums/repeat-mode; :off :one :all). Returns `p` for threading.
(set-replaygain p mode preamp-db prevent-clipping?)mode: rockbox.ffi.enums/replaygain-mode (:off :track :album). Returns p
for threading.
`mode`: rockbox.ffi.enums/replaygain-mode (:off :track :album). Returns `p` for threading.
(set-shuffle p enabled?)Enable or disable shuffle playback. Returns p for threading.
Enable or disable shuffle playback. Returns `p` for threading.
(set-stereo-width p percent)Set the stereo width as a percentage. Returns p for threading.
Set the stereo width as a percentage. Returns `p` for threading.
(set-surround p delay-ms balance cutoff-low-hz cutoff-high-hz)Configure the surround effect: delay (ms), balance, and low/high cutoffs (Hz).
Returns p for threading.
Configure the surround effect: delay (ms), balance, and low/high cutoffs (Hz). Returns `p` for threading.
(set-tone p bass-db treble-db bass-cutoff-hz treble-cutoff-hz)Set the tone controls: bass/treble gain (dB) and their cutoffs (Hz). Returns
p for threading.
Set the tone controls: bass/treble gain (dB) and their cutoffs (Hz). Returns `p` for threading.
(set-treble p treble-db)Set the treble tone gain in dB. Returns p for threading.
Set the treble tone gain in dB. Returns `p` for threading.
(set-treble-cutoff p hz)Set the treble tone-control cutoff frequency in Hz. Returns p for threading.
Set the treble tone-control cutoff frequency in Hz. Returns `p` for threading.
(set-volume p vol)Set the output volume (0.0–1.0). Returns p for threading.
Set the output volume (0.0–1.0). Returns `p` for threading.
(shuffle-enabled? p)Whether shuffle playback is currently enabled.
Whether shuffle playback is currently enabled.
(skip-to p index)Jump to queue index. Returns p for threading.
Jump to queue `index`. Returns `p` for threading.
(status p)A snapshot of the player's status as a map (keyword keys).
A snapshot of the player's status as a map (keyword keys).
(stop p)Stop playback. Returns p for threading.
Stop playback. Returns `p` for threading.
(toggle p)Toggle play/pause. Returns p for threading.
Toggle play/pause. Returns `p` for threading.
(with-player [sym & [config]] & body)Bind sym to a fresh player (optional config), run body, then free it.
Bind `sym` to a fresh player (optional `config`), run `body`, then free it.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |