Skip to main content

spawn_player

Function spawn_player 

Source
pub fn spawn_player() -> (Sender<PlayerCommand>, Receiver<PlayerEvent>, JoinHandle<()>, Arc<Mutex<VecDeque<f32>>>)
Expand description

Spawn the player thread.

Returns (cmd_tx, evt_rx, join_handle, sample_buffer). The caller should send PlayerCommand::Quit and then join the handle (with a timeout) on shutdown to ensure the audio device is released cleanly.

sample_buffer is a ring buffer of the most recent decoded f32 samples; the TUI reads it each frame to drive the visualizer FFT.