pub struct SnapServer { /* private fields */ }Expand description
The embeddable Snapcast server.
Implementations§
Source§impl SnapServer
Convert f32 samples to PCM bytes at the given bit depth.
impl SnapServer
Convert f32 samples to PCM bytes at the given bit depth.
Sourcepub fn new(config: ServerConfig) -> (Self, Receiver<ServerEvent>)
pub fn new(config: ServerConfig) -> (Self, Receiver<ServerEvent>)
Create a new server. Returns the server and event receiver.
Sourcepub fn add_stream(&mut self, name: &str) -> Sender<AudioFrame>
pub fn add_stream(&mut self, name: &str) -> Sender<AudioFrame>
Add a named audio stream. Returns a sender for pushing audio frames.
Uses the server’s default codec and sample format.
Sourcepub fn add_f32_stream(&mut self, name: &str) -> Result<F32AudioSender, String>
pub fn add_f32_stream(&mut self, name: &str) -> Result<F32AudioSender, String>
Add a named F32 audio stream with automatic chunking and timestamping.
Returns an F32AudioSender that accepts variable-size F32 sample buffers
and handles 20ms chunking, monotonic timestamps, and gap detection internally.
§Errors
Returns an error if the server’s sample_format cannot be parsed.
Sourcepub fn add_stream_with_config(
&mut self,
name: &str,
config: StreamConfig,
) -> Sender<AudioFrame>
pub fn add_stream_with_config( &mut self, name: &str, config: StreamConfig, ) -> Sender<AudioFrame>
Add a named audio stream with per-stream codec/format overrides.
Sourcepub fn command_sender(&self) -> Sender<ServerCommand>
pub fn command_sender(&self) -> Sender<ServerCommand>
Get a cloneable command sender.
Sourcepub fn config(&self) -> &ServerConfig
pub fn config(&self) -> &ServerConfig
Access the server configuration.
Auto Trait Implementations§
impl Freeze for SnapServer
impl !RefUnwindSafe for SnapServer
impl Send for SnapServer
impl Sync for SnapServer
impl Unpin for SnapServer
impl UnsafeUnpin for SnapServer
impl !UnwindSafe for SnapServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more