Skip to main content

SignalBuffer

Trait SignalBuffer 

Source
pub trait SignalBuffer<T: Transcendental> {
    // Required methods
    fn capacity(&self) -> usize;
    fn len(&self) -> usize;
    fn clear(&mut self);
    fn stats(&self) -> BufferStats;
    fn reset_stats(&mut self);

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn is_full(&self) -> bool { ... }
}
Expand description

Common trait for all signal buffers

This trait defines the standard interface that all buffer types implement. It provides methods for querying capacity, current length, and statistics.

§Type Parameters

  • T: The sample type (must implement Transcendental)

Required Methods§

Source

fn capacity(&self) -> usize

Get the total capacity of the buffer in samples

For block-based buffers, this is the number of samples per block. For ring buffers, this is the total number of samples that can be stored.

Source

fn len(&self) -> usize

Get the current number of items in the buffer

For PipeBuffer and FanOutBuffer, this is either 0 or 1. For RingBuffer, this is the number of samples available. For DelayLine, this is always the maximum delay.

Source

fn clear(&mut self)

Clear all items from the buffer

After calling this, the buffer should be empty. Note that this may not actually zero the memory for performance reasons.

Source

fn stats(&self) -> BufferStats

Get a snapshot of current buffer statistics

Source

fn reset_stats(&mut self)

Reset all statistics to zero

This does not clear the buffer contents, only the performance counters.

Provided Methods§

Source

fn is_empty(&self) -> bool

Check if the buffer is empty

Source

fn is_full(&self) -> bool

Check if the buffer is full

Implementors§

Source§

impl<T: Transcendental, const MAX_DELAY: usize> SignalBuffer<T> for DelayLine<T, MAX_DELAY>

Source§

impl<T: Transcendental, const N: usize> SignalBuffer<T> for PipeBuffer<T, N>

Source§

impl<T: Transcendental, const N: usize, const CONSUMERS: usize> SignalBuffer<T> for FanOutBuffer<T, N, CONSUMERS>

Source§

impl<T: Transcendental, const N: usize, const PRODUCERS: usize> SignalBuffer<T> for FanInBuffer<T, N, PRODUCERS>