Skip to main content

RawSink

Struct RawSink 

Source
pub struct RawSink { /* private fields */ }
Expand description

Sink for passing raw interleaved f32 frames from a backend to the core.

Holds a RawProducer internally. push writes without blocking and is RT-safe (drops data when full). This is the SPSC producer side; call push only from the backend’s RT callback thread.

Implementations§

Source§

impl RawSink

Source

pub fn new( producer: RawProducer, native_rate: u32, native_channels: u16, ) -> Self

Create a raw-frame sink with the backend native format.

Source

pub fn push(&mut self, interleaved: &[f32], pts_ns: i64) -> usize

Send raw interleaved f32 frames without blocking.

pts_ns is a device-provided presentation timestamp. Never block; increment the internal overflow counter and drop data when full.

PTS normalization and 20 ms chunking belong to the ingest thread. This sends only raw frames; the raw ring carries samples only, so the wiring layer handles pts_ns separately (backends that can provide it should do so for future frame association).

push is intended for backend RT callbacks. Custom backends must not allocate, lock, block, or make system calls along the path that calls push.

Source

pub fn native_rate(&self) -> u32

Backend native sample rate (Hz).

Source

pub fn native_channels(&self) -> u16

Backend native channel count.

Source

pub fn overflow_count(&self) -> u64

Cumulative samples dropped because the buffer was full.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.