[][src]Function spectrusty::audio::carousel::create_carousel

pub fn create_carousel<T>(
    latency: usize,
    sample_frames: usize,
    channels: u8
) -> (AudioFrameProducer<T>, AudioFrameConsumer<T>) where
    T: 'static + AudioSample + Send

Creates an inter-connected pair or AudioFrameProducer and AudioFrameConsumer.

The latency + 1 specifies how many buffers will be circulating in the carousel. The good indicator of how many are needed depends on the size of the target audio buffers provided by the framework. The size of the target audio buffer divided by the size of the produced frame buffers is a good approximation.

Basically, the larger the latency is the more stable the output sound stream will be, but at the cost of more delayed playback. Implementations should set a good default based on experiments but may allow users to adjust this value eventually.

sample_frames and channels determine the size of the allocated buffers.