pub trait SampleResource:
Send
+ Sync
+ 'static {
// Required methods
fn num_channels(&self) -> NonZeroUsize;
fn len_frames(&self) -> u64;
fn fill_buffers(
&self,
buffers: &mut [&mut [f32]],
buffer_range: Range<usize>,
start_frame: u64,
);
}Expand description
A resource of audio samples.
Required Methods§
Sourcefn num_channels(&self) -> NonZeroUsize
fn num_channels(&self) -> NonZeroUsize
The number of channels in this resource.
Sourcefn len_frames(&self) -> u64
fn len_frames(&self) -> u64
The length of this resource in samples (of a single channel of audio).
Not to be confused with video frames.
Sourcefn fill_buffers(
&self,
buffers: &mut [&mut [f32]],
buffer_range: Range<usize>,
start_frame: u64,
)
fn fill_buffers( &self, buffers: &mut [&mut [f32]], buffer_range: Range<usize>, start_frame: u64, )
Fill the given buffers with audio data starting from the given starting frame in the resource.
buffers- The buffers to fill with data. If the length ofbuffersis greater than the number of channels in this resource, then ignore the extra buffers.buffer_range- The range inside each buffer slice in which to fill with data. Do not fill any data outside of this range.start_frame- The sample (of a single channel of audio) in the resource at which to start copying from. Not to be confused with video frames.