Skip to main content

AudioConfig

Struct AudioConfig 

Source
#[non_exhaustive]
pub struct AudioConfig<T: StreamType> {
Show 16 fields pub stream: T::Config, pub decoder_backend: DecoderBackend, pub gapless_mode: GaplessMode, pub preload_chunks: NonZeroUsize, pub bus: Option<EventBus>, pub byte_pool: Option<BytePool>, pub cancel: Option<CancellationToken>, pub hint: Option<String>, pub host_sample_rate: Option<NonZeroU32>, pub media_info: Option<MediaInfo>, pub pcm_pool: Option<PcmPool>, pub playback_rate: Option<Arc<AtomicF32>>, pub worker: Option<AudioWorkerHandle>, pub resampler_quality: ResamplerQuality, pub effects: Vec<Box<dyn AudioEffect>>, pub pcm_buffer_chunks: usize,
}
Expand description

Configuration for audio pipeline with stream config.

Generic over StreamType to include stream-specific configuration. Combines stream config and audio pipeline settings into a single builder.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§stream: T::Config

Stream configuration (HlsConfig, FileConfig, etc.)

§decoder_backend: DecoderBackend

Decoder backend selection. See DecoderBackend.

§gapless_mode: GaplessMode

How leading/trailing PCM is trimmed after the decode.

§preload_chunks: NonZeroUsize

Number of chunks to buffer before signaling preload readiness.

§bus: Option<EventBus>

Unified event bus (optional — if not provided, one is created internally).

§byte_pool: Option<BytePool>

Shared byte pool for temporary buffers (probe, etc.).

§cancel: Option<CancellationToken>

Master cancel token for the audio pipeline.

§hint: Option<String>

Optional format hint (file extension like “mp3”, “wav”)

§host_sample_rate: Option<NonZeroU32>

Target sample rate of the audio host (for resampling).

§media_info: Option<MediaInfo>

Media info hint for format detection

§pcm_pool: Option<PcmPool>

Shared PCM pool for temporary buffers.

§playback_rate: Option<Arc<AtomicF32>>

Shared atomic for dynamic playback rate (1.0 = normal speed).

§worker: Option<AudioWorkerHandle>

Optional shared audio worker handle.

§resampler_quality: ResamplerQuality

Resampling quality preset.

§effects: Vec<Box<dyn AudioEffect>>

Additional effects to append after resampler in the processing chain.

§pcm_buffer_chunks: usize

PCM buffer size in chunks (~100ms per chunk = 10 chunks ≈ 1s). Default: 10 on native, 32 on wasm32.

Implementations§

Source§

impl<T: StreamType> AudioConfig<T>

Source

pub fn builder() -> AudioConfigBuilder<T>

Create an instance of AudioConfig using the builder syntax

Source§

impl<T: StreamType> AudioConfig<T>

Source

pub fn new(stream: T::Config) -> Self

Create config with stream config and default audio settings.

Source

pub fn for_stream(stream: T::Config) -> AudioConfigBuilder<T, SetStream>

Chainable counterpart to AudioConfig::new: returns a builder with stream set so callers can attach further setters.

Auto Trait Implementations§

§

impl<T> Freeze for AudioConfig<T>
where <T as StreamType>::Config: Freeze,

§

impl<T> !RefUnwindSafe for AudioConfig<T>

§

impl<T> Send for AudioConfig<T>

§

impl<T> !Sync for AudioConfig<T>

§

impl<T> Unpin for AudioConfig<T>
where <T as StreamType>::Config: Unpin,

§

impl<T> UnsafeUnpin for AudioConfig<T>
where <T as StreamType>::Config: UnsafeUnpin,

§

impl<T> !UnwindSafe for AudioConfig<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T
where T: Send,