Trait audio_engine::SoundSource
source · [−]pub trait SoundSource {
fn channels(&self) -> u16;
fn sample_rate(&self) -> u32;
fn reset(&mut self);
fn write_samples(&mut self, buffer: &mut [i16]) -> usize;
}Expand description
A source of sound samples.
Sound samples of each channel must be interleaved.
Required Methods
fn sample_rate(&self) -> u32
fn sample_rate(&self) -> u32
return the sample rate
Write the samples to the buffer.
Return how many samples was written. If it return a value less thand the length of the buffer, this indicate that the sound ended.
buffer length and ouput will always be a multiple of self.channels().