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 buffer.

Return how many samples was written. If it return a value less thand the length of buffer, this indicate that the sound ended.

The buffer length and the returned length should always be a multiple of self.channels().

Implementations on Foreign Types

Implementors