Function resampling_channel_custom

Source
pub fn resampling_channel_custom<T: Sample>(
    resampler: impl Into<ResamplerType<T>>,
    in_sample_rate: u32,
    out_sample_rate: u32,
    num_channels: usize,
    config: ResamplingChannelConfig,
) -> (ResamplingProd<T>, ResamplingCons<T>)
Expand description

Create a new realtime-safe spsc channel for sending samples across streams using the custom resampler.

If the input and output samples rates differ, then this will automatically resample the input stream to match the output stream. If the sample rates match, then no resampling will occur.

Internally this uses the ringbuf crate.

  • resampler - The custom rubato resampler.
  • in_sample_rate - The sample rate of the input stream.
  • out_sample_rate - The sample rate of the output stream.
  • num_channels - The number of channels in the stream.
  • config - Additional options for the resampling channel. Note that config.quality will be ignored.

ยงPanics

Panics when any of the following are true:

  • resampler.num_channels() != num_channels
  • in_sample_rate == 0
  • out_sample_rate == 0
  • num_channels == 0
  • config.latency_seconds <= 0.0
  • config.capacity_seconds <= 0.0