ProcInfo

Struct ProcInfo 

Source
pub struct ProcInfo {
    pub frames: usize,
    pub in_silence_mask: SilenceMask,
    pub out_silence_mask: SilenceMask,
    pub in_connected_mask: ConnectedMask,
    pub out_connected_mask: ConnectedMask,
    pub sample_rate: NonZeroU32,
    pub sample_rate_recip: f64,
    pub clock_samples: InstantSamples,
    pub duration_since_stream_start: Duration,
    pub stream_status: StreamStatus,
    pub dropped_frames: u32,
    pub transport_info: Option<TransportInfo>,
}
Expand description

Fields§

§frames: usize

The number of frames (samples in a single channel of audio) in this processing block.

Not to be confused with video frames.

§in_silence_mask: SilenceMask

An optional optimization hint on which input channels contain all zeros (silence). The first bit (0b1) is the first channel, the second bit is the second channel, and so on.

§out_silence_mask: SilenceMask

An optional optimization hint on which output channels contain all zeros (silence). The first bit (0b1) is the first channel, the second bit is the second channel, and so on.

§in_connected_mask: ConnectedMask

An optional hint on which input channels are connected to other nodes in the graph.

§out_connected_mask: ConnectedMask

An optional hint on which output channels are connected to other nodes in the graph.

§sample_rate: NonZeroU32

The sample rate of the audio stream in samples per second.

§sample_rate_recip: f64

The reciprocal of the sample rate. This can be used to avoid a division and improve performance.

§clock_samples: InstantSamples

The current time of the audio clock at the first frame in this processing block, equal to the total number of frames (samples in a single channel of audio) that have been processed since this Firewheel context was first started.

Note, this value does NOT account for any output underflows (underruns) that may have occured.

Note, generally this value will always count up, but there may be a few edge cases that cause this value to be less than the previous block, such as when the sample rate of the stream has been changed.

§duration_since_stream_start: Duration

The duration between when the stream was started an when the Firewheel processor’s process method was called.

Note, this clock is not as accurate as the audio clock.

§stream_status: StreamStatus

Flags indicating the current status of the audio stream

§dropped_frames: u32

If an output underflow (underrun) occured, then this will contain an estimate for the number of frames (samples in a single channel of audio) that were dropped.

This can be used to correct the timing of events if desired.

Note, this is just an estimate, and may not always be perfectly accurate.

If an underrun did not occur, then this will be 0.

§transport_info: Option<TransportInfo>

Information about the musical transport.

This will be None if no musical transport is currently active, or if the current transport is currently paused.

Implementations§

Source§

impl ProcInfo

Source

pub fn clock_seconds(&self) -> InstantSeconds

The current time of the audio clock at the first frame in this processing block, equal to the total number of seconds of data that have been processed since this Firewheel context was first started.

Note, this value does NOT account for any output underflows (underruns) that may have occured.

Note, generally this value will always count up, but there may be a few edge cases that cause this value to be less than the previous block, such as when the sample rate of the stream has been changed.

Source

pub fn clock_samples_range(&self) -> Range<InstantSamples>

Get the current time of the audio clock in frames as a range for this processing block.

Source

pub fn clock_seconds_range(&self) -> Range<InstantSeconds>

Get the current time of the audio clock in frames as a range for this processing block.

Source

pub fn playhead(&self) -> Option<InstantMusical>

Get the playhead of the transport at the first frame in this processing block.

If there is no active transport, or if the transport is not currently playing, then this will return None.

Source

pub fn playhead_range(&self) -> Option<Range<InstantMusical>>

Get the playhead of the transport as a range for this processing block.

If there is no active transport, or if the transport is not currently playing, then this will return None.

Source

pub fn transport_is_playing(&self) -> bool

Returns true if there is a transport and that transport is playing, false otherwise.

Source

pub fn musical_to_samples( &self, musical: InstantMusical, ) -> Option<InstantSamples>

Converts the given musical time to the corresponding time in samples.

If there is no musical transport or the transport is not currently playing, then this will return None.

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> ConditionalSend for T
where T: Send,