Something went wrong. Try again.
A modern, network-enabled music player platform built on Rockbox technology. rockboxd.tsiry-sandratraina.com
rust deno navidrome airplay libadwaita zig mpris snapcast mpd rockbox audio subsonic
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263"""End-to-end smoke test for the Python bindings.
Run: `uv run python examples/smoke.py`"""
from __future__ import annotations
import timefrom pathlib import Path
import rockbox_ffi as rbfrom rockbox_ffi import Dsp, Player, metadatafrom rockbox_ffi.enums import DspReplayGainMode, ReplayGainMode
REPO = Path(__file__).resolve().parents[3]FIXTURE = REPO / "crates" / "rocksky" / "fixtures" / "08 - Internet Money - Speak(Explicit).m4a"
def main() -> None: print(f"ABI version: {rb.abi_version()}")
# -- metadata --------------------------------------------------------- meta = metadata.read(str(FIXTURE)) print(f"codec={meta['codec']!r} title={meta['title']!r} " f"artist={meta['artist']!r} duration_ms={meta['duration_ms']} " f"sample_rate={meta['sample_rate']}") assert meta["codec"], "codec label should not be empty"
probe = metadata.probe("song.flac") print(f"probe('song.flac') = {probe!r}") assert probe, "flac probe should return a label"
# -- DSP: -6.0206 dB track gain should HALVE amplitude ---------------- rate = 44100 with Dsp(rate) as dsp: dsp.set_replaygain(DspReplayGainMode.TRACK, noclip=False, preamp_db=0.0) dsp.set_replaygain_gains(track_gain_db=-6.0206) # x0.5
sine = rb.sine_stereo(1000.0, 1.0, rate, amplitude=16000) out = dsp.process(sine) peak = max(abs(s) for s in out) print(f"DSP peak after -6.02 dB track gain: {peak} (expected ~8000)") assert 7600 <= peak <= 8400, f"peak {peak} out of range"
# -- Player (construct only, no audible playback) --------------------- with Player(volume=0.0) as player: rate = player.sample_rate() print(f"Player sample_rate={rate}") assert rate > 0 player.set_volume(0.0) player.set_queue([str(FIXTURE)]) time.sleep(0.1) # the queue command is applied asynchronously by the engine thread st = player.status() print(f"Player status: state={st['state']!r} queue_len={st['queue_len']}") assert st["state"] == "stopped" assert st["queue_len"] == 1
print("\nALL CHECKS PASSED ✔")
if __name__ == "__main__": main()