pub struct BandLimited<T, O = BandLimWide> { /* private fields */ }Expand description
Bandwidth-Limited Pulse Buffer implementation with high-pass and low-pass filtering, for an efficient band-limited synthesis.
T specifies pulse step amplitude unit types. Currently, implementations are provided for:
f32, i16, and i32.
Implementations§
Source§impl<T: Copy + Default, O> BandLimited<T, O>
impl<T: Copy + Default, O> BandLimited<T, O>
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the excessive capacity of the buffer as much as possible.
Sourcepub fn set_frame_time(&mut self, frame_time: f64, margin_time: f64)
pub fn set_frame_time(&mut self, frame_time: f64, margin_time: f64)
Ensures the frame buffer length is large enough to fit data for the specified frame_time
with additional margin_time.
Sets the duration of the average frame to frame_time which should be specified with as much
precision as possible.
margin_time specifies a frame duration fluctuation margin and should be significantly smaller
than frame_time.
Both frame_time and margin_time are specified in the sample time units (1.0 = 1 audio sample).
Sourcepub fn is_frame_ended(&mut self) -> bool
pub fn is_frame_ended(&mut self) -> bool
Returns true if BandLimited::end_frame has been called before the call to BandLimited::next_frame.
It indicates if audio samples can be digitized from the last frame data.
Source§impl<T, O> BandLimited<T, O>
impl<T, O> BandLimited<T, O>
Sourcepub fn new(channels: usize) -> Self
pub fn new(channels: usize) -> Self
Returns a new instance of BandLimited buffer.
channels- specifies the maximum number of audio channels that the sound can be rendered for.
Before any pulse steps are added to the buffer the method BandLimited::set_frame_time or Blep::ensure_frame_time must be called first.
§Panics
Panics if channels equals to 0.
Sourcepub fn next_frame(&mut self)
pub fn next_frame(&mut self)
Prepares the buffer for the next audio frame.
This method must be called after the call to BandLimited::end_frame or to Blep::end_frame and optionally after audio data has been produced with BandLimited::sum_iter.
Source§impl<T, O> BandLimited<T, O>
impl<T, O> BandLimited<T, O>
Sourcepub fn sum_iter<'a, S: 'a>(
&'a self,
channel: usize,
) -> impl Iterator<Item = S> + ExactSizeIterator + 'awhere
T: IntoSample<S>,
pub fn sum_iter<'a, S: 'a>(
&'a self,
channel: usize,
) -> impl Iterator<Item = S> + ExactSizeIterator + 'awhere
T: IntoSample<S>,
Returns an iterator that produces audio samples in the specified sample format S
from the specified channel.
This method must be called after the call to BandLimited::end_frame or Blep::end_frame and before BandLimited::next_frame.
Trait Implementations§
Source§impl<T, O> Blep for BandLimited<T, O>
impl<T, O> Blep for BandLimited<T, O>
Source§type SampleDelta = T
type SampleDelta = T
Auto Trait Implementations§
impl<T, O> Freeze for BandLimited<T, O>where
T: Freeze,
impl<T, O = BandLimWide> !RefUnwindSafe for BandLimited<T, O>
impl<T, O> Send for BandLimited<T, O>
impl<T, O = BandLimWide> !Sync for BandLimited<T, O>
impl<T, O> Unpin for BandLimited<T, O>
impl<T, O> UnwindSafe for BandLimited<T, O>where
O: UnwindSafe,
T: UnwindSafe,
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
Source§impl<S, T> IntoSample<S> for Twhere
S: FromSample<T>,
impl<S, T> IntoSample<S> for Twhere
S: FromSample<T>,
Source§fn into_sample(self) -> S
fn into_sample(self) -> S
S a sample type from self.