pub struct AudioContextOptions {
    pub latency_hint: AudioContextLatencyCategory,
    pub sample_rate: Option<f32>,
    pub sink_id: String,
    pub render_size_hint: AudioContextRenderSizeCategory,
}
Expand description

Specify the playback configuration for the AudioContext constructor.

All fields are optional and will default to the value best suited for interactive playback on your hardware configuration.

For future compatibility, it is best to construct a default implementation of this struct and set the fields you would like to override:

use web_audio_api::context::AudioContextOptions;

// Request a sample rate of 44.1 kHz, leave other fields to their default values
let opts = AudioContextOptions {
    sample_rate: Some(44100.),
    ..AudioContextOptions::default()
};

Fields§

§latency_hint: AudioContextLatencyCategory

Identify the type of playback, which affects tradeoffs between audio output latency and power consumption.

§sample_rate: Option<f32>

Sample rate of the audio context and audio output hardware. Use None for a default value.

§sink_id: String

The audio output device

  • use "" for the default audio output device
  • use "none" to process the audio graph without playing through an audio output device.
  • use "sinkId" to use the specified audio sink id, obtained with enumerate_devices
§render_size_hint: AudioContextRenderSizeCategory

Option to request a default, optimized or specific render quantum size. It is a hint that might not be honored.

Trait Implementations§

source§

impl Clone for AudioContextOptions

source§

fn clone(&self) -> AudioContextOptions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AudioContextOptions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for AudioContextOptions

source§

fn default() -> AudioContextOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<S> FromSample<S> for S

source§

fn from_sample_(s: S) -> S

source§

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

const: unstable · 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.

§

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

§

fn into_sample(self) -> T

source§

impl<T> ToOwned for Twhere
    T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> ToSample<U> for Twhere
    U: FromSample<T>,

source§

fn to_sample_(self) -> U

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<S, T> Duplex<S> for Twhere
    T: FromSample<S> + ToSample<S>,