pub struct TimelineAudioRead { /* private fields */ }Expand description
Answers a session’s super::Need::TimelineAudio from the project mix, on every surface.
Per need: Self::begin, then every block Self::wanted names, mixed in stereo at exact
continuity (the master output, or the need’s tap) and handed to Self::push, then
Self::finish. A need that reads on continues the mix; one that reads earlier restarts it
a second before, so a backward pass mixes each second once. Another rate is the mix through
Resampler, and a mono need the mean of its left and right.
Implementations§
Source§impl TimelineAudioRead
impl TimelineAudioRead
Sourcepub fn new(project_rate: u32, rate: u32) -> Result<Self, ResampleError>
pub fn new(project_rate: u32, rate: u32) -> Result<Self, ResampleError>
A read of a mix at project_rate, delivered at rate.
§Errors
ResampleError for rates the resampler does not convert between.
Sourcepub fn begin(&mut self, start_sample: i64, frames: u32, channels: AudioChannels)
pub fn begin(&mut self, start_sample: i64, frames: u32, channels: AudioChannels)
Begins the answer to a need of frames frames from start_sample, in channels.
Sourcepub fn wanted(&self) -> Option<(i64, usize)>
pub fn wanted(&self) -> Option<(i64, usize)>
The next block of the mix Self::push takes, as its first project-rate sample and its
length (at most TIMELINE_MIX_BLOCK); None once the need begun can be answered.
Sourcepub fn push(&mut self, left: &[f32], right: &[f32]) -> Result<(), String>
pub fn push(&mut self, left: &[f32], right: &[f32]) -> Result<(), String>
Takes the block Self::wanted named: its left and right planes.
§Errors
When no block is wanted, or the planes are not its length.
Sourcepub fn finish(&mut self) -> Result<SuppliedAudio, String>
pub fn finish(&mut self) -> Result<SuppliedAudio, String>
Auto Trait Implementations§
impl Forget for TimelineAudioRead
impl Freeze for TimelineAudioRead
impl Move for TimelineAudioRead
impl RefUnwindSafe for TimelineAudioRead
impl Send for TimelineAudioReadwhere
RawVecInner: Send,
impl Sync for TimelineAudioReadwhere
RawVecInner: Sync,
impl Unpin for TimelineAudioRead
impl UnsafeUnpin for TimelineAudioRead
impl UnwindSafe for TimelineAudioReadwhere
RawVecInner: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more