rockbox/player
Queue-based player with native ReplayGain and Rockbox crossfade.
A Player owns a live audio output device and a background engine
thread, so it only works where an output device exists. The handle is a
NIF resource, freed by the BEAM garbage collector (which stops playback).
ReplayGain mode here uses the player values: 0 off, 1 track, 2 album.
Crossfade mode: 0 off, 1 auto-skip, 2 manual-skip, 3 shuffle,
4 shuffle-or-manual, 5 always. Mix mode: 0 crossfade, 1 mix.
Types
Player configuration. sample_rate: 0 means the output device default.
pub type Config {
Config(
sample_rate: Int,
buffer_seconds: Float,
volume: Float,
replaygain_mode: Int,
replaygain_preamp_db: Float,
replaygain_prevent_clipping: Bool,
crossfade_mode: Int,
fade_out_delay_ms: Int,
fade_out_duration_ms: Int,
fade_in_delay_ms: Int,
fade_in_duration_ms: Int,
mix_mode: Int,
)
}
Constructors
-
Config( sample_rate: Int, buffer_seconds: Float, volume: Float, replaygain_mode: Int, replaygain_preamp_db: Float, replaygain_prevent_clipping: Bool, crossfade_mode: Int, fade_out_delay_ms: Int, fade_out_duration_ms: Int, fade_in_delay_ms: Int, fade_in_duration_ms: Int, mix_mode: Int, )
A snapshot of the player’s status.
pub type Status {
Status(
state: String,
index: option.Option(Int),
position_ms: Int,
duration_ms: Int,
queue_len: Int,
)
}
Constructors
-
Status( state: String, index: option.Option(Int), position_ms: Int, duration_ms: Int, queue_len: Int, )
Values
pub fn default_config() -> Config
Rockbox-default configuration (device sample rate, no crossfade, ReplayGain off, full volume).
pub fn sample_rate(player: Player) -> Int
pub fn set_crossfade(
player: Player,
mode: Int,
fade_out_delay_ms: Int,
fade_out_duration_ms: Int,
fade_in_delay_ms: Int,
fade_in_duration_ms: Int,
mix_mode: Int,
) -> Nil
pub fn set_queue(player: Player, paths: List(String)) -> Nil
Replace the queue with a list of file paths.
pub fn set_replaygain(
player: Player,
mode: Int,
preamp_db: Float,
prevent_clipping: Bool,
) -> Nil
pub fn set_volume(player: Player, volume: Float) -> Nil