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.
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.
(clear-resume p)Delete the player's resume file.
Delete the player's resume file.
(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.
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.
(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`.
(queue p)The current queue as a vector of path/URL strings.
The current queue as a vector of path/URL strings.
(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.
Persist the queue + current position to the player's resume file now.
(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}})(set-replaygain p mode preamp-db prevent-clipping?)mode: rockbox.ffi.enums/replaygain-mode (:off :track :album).
`mode`: rockbox.ffi.enums/replaygain-mode (:off :track :album).
(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).
(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 |