pub trait SampleResource: SampleResourceInfo {
// Required method
fn fill_buffers(
&self,
out_buffer: &mut [&mut [f32]],
out_buffer_range: Range<usize>,
start_frame: u64,
) -> usize;
}Expand description
A resource of audio samples.
Required Methods§
Sourcefn fill_buffers(
&self,
out_buffer: &mut [&mut [f32]],
out_buffer_range: Range<usize>,
start_frame: u64,
) -> usize
fn fill_buffers( &self, out_buffer: &mut [&mut [f32]], out_buffer_range: Range<usize>, start_frame: u64, ) -> usize
Fill the given buffers with audio data starting from the given starting frame in the resource.
out_buffer- The buffers to fill with data. If the length ofbuffersis greater than the number of channels in this resource, then ignore the extra buffers.out_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.
If the length of out_buffer_range is all or partly out of bounds of
the resource, then the frames which are out of bounds will be left
untouched.
Returns the number of frames that were successfully filled. This may
be less than the length of out_buffer_range if the range is all or
partly out of bounds of the resource
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".