bbx_player/lib.rs
1//! Audio playback abstractions for bbx_audio.
2//!
3//! This crate provides a simple, flexible API for playing DSP graphs
4//! through the system's audio output. It supports multiple backends
5//! through feature flags.
6//!
7//! # Features
8//!
9//! - `rodio` (default) - High-level backend using rodio, easiest to use
10//! - `cpal` - Low-level backend using cpal directly, more control
11//!
12//! # Quick Start
13//!
14//! ```ignore
15//! use bbx_player::Player;
16//! use std::time::Duration;
17//!
18//! // Create a player with the default backend
19//! let player = Player::new(graph)?;
20//!
21//! // Start non-blocking playback
22//! let handle = player.play()?;
23//!
24//! // Do other work while audio plays...
25//! std::thread::sleep(Duration::from_secs(5));
26//!
27//! // Stop playback
28//! handle.stop();
29//! ```
30//!
31//! # Using a Different Backend
32//!
33//! ```ignore
34//! use bbx_player::{Player, backends::CpalBackend};
35//!
36//! let backend = CpalBackend::try_default()?;
37//! let player = Player::with_backend(graph, backend);
38//! let handle = player.play()?;
39//! ```
40
41mod backend;
42pub mod backends;
43mod error;
44mod player;
45mod signal;
46
47pub use backend::{Backend, PlayHandle};
48pub use error::{PlayerError, Result};
49pub use player::Player;
50pub use signal::Signal;