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

Return the number of channels

return the sample rate

Start the sound from the begining

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().

Implementors