pub struct StreamWriterState { /* private fields */ }Implementations§
Source§impl StreamWriterState
impl StreamWriterState
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns true if there is there is currently an active stream on this node.
Sourcepub fn underflow_occurred(&self) -> bool
pub fn underflow_occurred(&self) -> bool
Returns true if an underflow occured (due to the output stream
running faster than the input stream).
If this happens excessively in Release mode, you may want to consider
increasing ResamplingChannelConfig::latency_seconds.
(Calling this will also reset the flag indicating whether an underflow occurred.)
Sourcepub fn overflow_occurred(&self) -> bool
pub fn overflow_occurred(&self) -> bool
Returns true if an overflow occured (due to the input stream
running faster than the output stream).
If this happens excessively in Release mode, you may want to consider
increasing ResamplingChannelConfig::capacity_seconds. For
example, if you are streaming data from a network, you may want to
increase the capacity to several seconds.
(Calling this will also reset the flag indicating whether an overflow occurred.)
Sourcepub fn available_frames(&self) -> usize
pub fn available_frames(&self) -> usize
The total number of frames (not samples) that can currently be pushed to the stream.
If there is no active stream, the stream is paused, or the processor end
is not ready to receive samples, then this will return 0.
Sourcepub fn occupied_seconds(&self) -> Option<f64>
pub fn occupied_seconds(&self) -> Option<f64>
The amount of data in seconds that is currently occupied in the channel.
This value will be in the range [0.0, ResamplingChannelConfig::capacity_seconds].
If there is no active stream, then this will return None.
Sourcepub fn num_channels(&self) -> NonZeroChannelCount
pub fn num_channels(&self) -> NonZeroChannelCount
The number of channels in this node.
Sourcepub fn sample_rate(&self) -> Option<NonZeroU32>
pub fn sample_rate(&self) -> Option<NonZeroU32>
The sample rate of the active stream.
Returns None if there is no active stream.
Sourcepub fn start_stream(
&mut self,
sample_rate: NonZeroU32,
output_stream_sample_rate: NonZeroU32,
channel_config: ResamplingChannelConfig,
) -> Result<NewInputStreamEvent, ()>
pub fn start_stream( &mut self, sample_rate: NonZeroU32, output_stream_sample_rate: NonZeroU32, channel_config: ResamplingChannelConfig, ) -> Result<NewInputStreamEvent, ()>
Begin the input audio stream on this node.
The returned event must be sent to the node’s processor for this to take effect.
sample_rate- The sample rate of this node.output_stream_sample_rate- The sample rate of the active output audio stream.channel_config- The configuration of the input to output channel.
If there is already an active stream running on this node, then this will return an error.
Sourcepub fn push_interleaved(&mut self, data: &[f32]) -> PushStatus
pub fn push_interleaved(&mut self, data: &[f32]) -> PushStatus
Push the given data in interleaved format.
Returns the number of frames (not samples) that were successfully pushed.
If this number is less than the number of frames in data, then it means
an overflow has occured.
If there is no active stream, the stream is paused, or the processor end
is not ready to receive samples, then no data will be sent and this will
return 0.
Sourcepub fn push<Vin: AsRef<[f32]>>(
&mut self,
data: &[Vin],
range: Range<usize>,
) -> PushStatus
pub fn push<Vin: AsRef<[f32]>>( &mut self, data: &[Vin], range: Range<usize>, ) -> PushStatus
Push the given data in de-interleaved format.
data- The channels of data to push to the channel.range- The range in each slice ininputto read data from.
Returns the number of frames (not samples) that were successfully pushed.
If this number is less than the number of frames in data, then it means
an overflow has occured.
b
If there is no active stream, the stream is paused, or the processor end
is not ready to receive samples, then no data will be sent and this will
return 0.
Sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&self) -> bool
Returns true if the processor end of the stream is ready to start receiving
data.
Sourcepub fn pause_stream(&mut self)
pub fn pause_stream(&mut self)
Pause any active audio streams.
Sourcepub fn autocorrect_underflows(&mut self) -> Option<usize>
pub fn autocorrect_underflows(&mut self) -> Option<usize>
Correct for any underflows.
This returns the number of extra zero frames (samples in a single channel of audio)
that were added due to an underflow occurring. If no underflow occured, then None
is returned.
Note, this method is already automatically called in StreamWriterState::push and
StreamWriterState::push_interleaved.
This will have no effect if ResamplingChannelConfig::underflow_autocorrect_percent_threshold
was set to None.
This method is realtime-safe.
pub fn stop_stream(&mut self)
pub fn handle(&self) -> Mutex<Self>
Trait Implementations§
Source§impl Clone for StreamWriterState
impl Clone for StreamWriterState
Source§fn clone(&self) -> StreamWriterState
fn clone(&self) -> StreamWriterState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for StreamWriterState
impl RefUnwindSafe for StreamWriterState
impl Send for StreamWriterState
impl Sync for StreamWriterState
impl Unpin for StreamWriterState
impl UnwindSafe for StreamWriterState
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.