bbx_player

Crates.iobbx_player
lib.rsbbx_player
version0.4.3
created_at2026-01-15 17:30:03.500774+00
updated_at2026-01-15 17:30:03.500774+00
descriptionAudio playback abstractions for bbx_audio
homepage
repositoryhttps://github.com/blackboxaudio/bbx_audio
max_upload_size
id2046128
size48,132
Matthew Maxwell (maxwellmattryan)

documentation

README

bbx_player

Audio playback abstractions for bbx_audio.

Features

  • Simple API: Create a player, call play(), get a handle to stop playback
  • Non-blocking: Playback runs in a background thread
  • Multiple backends: Choose between high-level (rodio) or low-level (cpal) backends
  • f32/f64 support: Works with both sample types, converts to f32 at output

Usage

Default Backend (rodio)

use bbx_player::Player;
use std::time::Duration;

let player = Player::new(graph)?;
let handle = player.play()?;

std::thread::sleep(Duration::from_secs(5));
handle.stop();

Custom Backend (cpal)

use bbx_player::{Player, backends::CpalBackend};

let backend = CpalBackend::try_default()?;
let player = Player::with_backend(graph, backend);
let handle = player.play()?;

Feature Flags

Feature Default Description
rodio Yes High-level backend using rodio
cpal No Low-level backend using cpal directly

Backend Comparison

Backend Pros Cons
RodioBackend Simple, automatic device handling Less control
CpalBackend Direct device access, more control More setup required

API Reference

Player<S>

  • Player::new(graph) - Create player with default rodio backend
  • Player::with_backend(graph, backend) - Create player with custom backend
  • player.play() - Start playback, returns PlayHandle

PlayHandle

  • handle.stop() - Stop playback
  • handle.is_stopped() - Check if playback has stopped
Commit count: 155

cargo fmt