Liking cljdoc? Tell your friends :D

rockbox.ffi.player

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.
raw docstring

clear-resumeclj

(clear-resume p)

Delete the player's resume file. Returns p for threading.

Delete the player's resume file. Returns `p` for threading.
sourceraw docstring

default-configclj

source

dsp-settingsclj

(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).
sourceraw docstring

enqueueclj

(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.
sourceraw docstring

eq-enabled?clj

(eq-enabled? p)

Whether the parametric EQ is currently enabled.

Whether the parametric EQ is currently enabled.
sourceraw docstring

export-m3uclj

(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.
sourceraw docstring

freeclj

(free p)

Free the native handle. Safe to call with nil.

Free the native handle. Safe to call with nil.
sourceraw docstring

import-m3uclj

(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.
sourceraw docstring

insertclj

(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.
sourceraw docstring

is-url?clj

(is-url? s)

Whether s looks like an http(s):// URL.

Whether `s` looks like an http(s):// URL.
sourceraw docstring

load-m3uclj

(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.
sourceraw docstring

load-resumeclj

(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.
sourceraw docstring

m3u-readclj

(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.
sourceraw docstring

m3u-writeclj

(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.
sourceraw docstring

new-playerclj

(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`.
sourceraw docstring

nextclj

(next p)

Skip to the next track. Returns p for threading.

Skip to the next track. Returns `p` for threading.
sourceraw docstring

pauseclj

(pause p)

Pause playback. Returns p for threading.

Pause playback. Returns `p` for threading.
sourceraw docstring

playclj

(play p)

Start playback. Returns p for threading.

Start playback. Returns `p` for threading.
sourceraw docstring

previousclj

(previous p)

Skip to the previous track. Returns p for threading.

Skip to the previous track. Returns `p` for threading.
sourceraw docstring

queueclj

(queue p)

The current queue as a vector of path/URL strings.

The current queue as a vector of path/URL strings.
sourceraw docstring

repeatclj

(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).
sourceraw docstring

resumeclj

(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.
sourceraw docstring

sample-rateclj

(sample-rate p)
source

save-resumeclj

(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.
sourceraw docstring

seek-msclj

(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.
sourceraw docstring

set-bassclj

(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.
sourceraw docstring

set-bass-cutoffclj

(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.
sourceraw docstring

set-bass-enhancementclj

(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.
sourceraw docstring

set-channel-modeclj

(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.
sourceraw docstring

set-compressorclj

(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.
sourceraw docstring

set-crossfadeclj

(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.
sourceraw docstring

set-crossfeedclj

(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.
sourceraw docstring

set-ditherclj

(set-dither p enabled?)

Enable or disable dithering. Returns p for threading.

Enable or disable dithering. Returns `p` for threading.
sourceraw docstring

set-eq-bandclj

(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.
sourceraw docstring

set-eq-enabledclj

(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.
sourceraw docstring

set-eq-precutclj

(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.
sourceraw docstring

set-eq-presetclj

(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.
sourceraw docstring

set-fatigue-reductionclj

(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.
sourceraw docstring

set-pitchclj

(set-pitch p ratio)

Set the playback pitch ratio. Returns p for threading.

Set the playback pitch ratio. Returns `p` for threading.
sourceraw docstring

set-queueclj

(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.
sourceraw docstring

set-repeatclj

(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.
sourceraw docstring

set-replaygainclj

(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.
sourceraw docstring

set-shuffleclj

(set-shuffle p enabled?)

Enable or disable shuffle playback. Returns p for threading.

Enable or disable shuffle playback. Returns `p` for threading.
sourceraw docstring

set-stereo-widthclj

(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.
sourceraw docstring

set-surroundclj

(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.
sourceraw docstring

set-toneclj

(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.
sourceraw docstring

set-trebleclj

(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.
sourceraw docstring

set-treble-cutoffclj

(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.
sourceraw docstring

set-volumeclj

(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.
sourceraw docstring

shuffle-enabled?clj

(shuffle-enabled? p)

Whether shuffle playback is currently enabled.

Whether shuffle playback is currently enabled.
sourceraw docstring

skip-toclj

(skip-to p index)

Jump to queue index. Returns p for threading.

Jump to queue `index`. Returns `p` for threading.
sourceraw docstring

statusclj

(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).
sourceraw docstring

stopclj

(stop p)

Stop playback. Returns p for threading.

Stop playback. Returns `p` for threading.
sourceraw docstring

toggleclj

(toggle p)

Toggle play/pause. Returns p for threading.

Toggle play/pause. Returns `p` for threading.
sourceraw docstring

volumeclj

(volume p)
source

with-playercljmacro

(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.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close