pub struct AudioBlock {
pub start_sample: i64,
pub sample_rate: u32,
pub speakers: SpeakerLayout,
pub channels: Vec<Vec<f32>>,
}Expand description
Planar floating-point audio at the project sample rate.
Positions are sample indices at sample_rate, never ticks: a tick is not a
whole number of samples at 44.1 kHz, so a start in ticks cannot say which
sample a block begins with, and every conversion between the two would need
a rounding rule both sides agree on. Sample n is at n / sample_rate
seconds on the block’s timeline, the source’s for a decoder and the
project’s for a mixer.
A block from a decoder or an AudioBlockProvider keeps its source’s
channels, 1 to MAX_AUDIO_CHANNELS planes, and says which speaker each
feeds; the mixer folds them into the project’s layout by those speakers.
A mixer’s own blocks have the project’s channels.
Fields§
§start_sample: i64Index of the first sample, at sample_rate.
sample_rate: u32Project sample rate used by every returned block.
speakers: SpeakerLayoutThe speaker each of channels feeds, one per plane.
channels: Vec<Vec<f32>>One vector per channel, all with equal lengths, in speakers’ order.
Implementations§
Source§impl AudioBlock
impl AudioBlock
Sourcepub fn end_sample(&self) -> i64
pub fn end_sample(&self) -> i64
Index one past the last sample.
Sourcepub fn start_time(&self) -> MediaTime
pub fn start_time(&self) -> MediaTime
The first sample’s time, at or before it on the tick grid.
For display and for APIs that take a MediaTime; positions within
audio stay in samples.