[−][src]Struct blip_buf::BlipBuf
Sample buffer that resamples from input clock rate to output sample rate
Implementations
impl BlipBuf
[src]
pub fn new(sample_count: u32) -> BlipBuf
[src]
Creates new buffer that can hold at most sample_count samples. Sets rates
so that there are MAX_RATIO
clocks per sample. Returns pointer to new
buffer, or panics if insufficient memory.
pub fn set_rates(&mut self, clock_rate: f64, sample_rate: f64)
[src]
Sets approximate input clock rate and output sample rate. For every
clock_rate
input clocks, approximately sample_rate
samples are generated.
pub fn clear(&mut self)
[src]
Clears entire buffer. Afterwards, samples_avail() == 0
.
pub fn add_delta(&mut self, clock_time: u32, delta: i32)
[src]
Adds positive/negative delta into buffer at specified clock time.
pub fn add_delta_fast(&mut self, clock_time: u32, delta: i32)
[src]
Same as add_delta()
, but uses faster, lower-quality synthesis.
pub fn clocks_needed(&self, sample_count: u32) -> u32
[src]
Length of time frame, in clocks, needed to make sample_count
additional
samples available.
pub fn end_frame(&mut self, clock_duration: u32)
[src]
Makes input clocks before clock_duration
available for reading as output
samples. Also begins new time frame at clock_duration
, so that clock time 0 in
the new time frame specifies the same clock as clock_duration
in the old time
frame specified. Deltas can have been added slightly past clock_duration
(up to
however many clocks there are in two output samples).
pub fn samples_avail(&self) -> u32
[src]
Number of buffered samples available for reading.
pub fn read_samples(&mut self, buf: &mut [i16], stereo: bool) -> usize
[src]
Reads and removes at most buf.len()
samples and writes them to buf
. If
stereo
is true, writes output to every other element of buf
, allowing easy
interleaving of two buffers into a stereo sample stream. Outputs 16-bit signed
samples. Returns number of samples actually read.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BlipBuf
impl !Sync for BlipBuf
impl Unpin for BlipBuf
impl UnwindSafe for BlipBuf
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,