Skip to main content

web_sys/features/
gen_AudioContextOptions.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AudioContextOptions)]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `AudioContextOptions` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
12    pub type AudioContextOptions;
13    #[doc = "Get the `latencyHint` field of this object."]
14    #[doc = ""]
15    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
16    #[wasm_bindgen(method, getter = "latencyHint")]
17    pub fn get_latency_hint(this: &AudioContextOptions) -> ::wasm_bindgen::JsValue;
18    #[doc = "Change the `latencyHint` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
21    #[wasm_bindgen(method, setter = "latencyHint")]
22    pub fn set_latency_hint(this: &AudioContextOptions, val: &::wasm_bindgen::JsValue);
23    #[cfg(feature = "AudioContextLatencyCategory")]
24    #[doc = "Change the `latencyHint` field of this object."]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
27    #[wasm_bindgen(method, setter = "latencyHint")]
28    pub fn set_latency_hint_audio_context_latency_category(
29        this: &AudioContextOptions,
30        val: AudioContextLatencyCategory,
31    );
32    #[doc = "Change the `latencyHint` field of this object."]
33    #[doc = ""]
34    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
35    #[wasm_bindgen(method, setter = "latencyHint")]
36    pub fn set_latency_hint_f64(this: &AudioContextOptions, val: f64);
37    #[doc = "Get the `sampleRate` field of this object."]
38    #[doc = ""]
39    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
40    #[wasm_bindgen(method, getter = "sampleRate")]
41    pub fn get_sample_rate(this: &AudioContextOptions) -> Option<f32>;
42    #[doc = "Change the `sampleRate` field of this object."]
43    #[doc = ""]
44    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
45    #[wasm_bindgen(method, setter = "sampleRate")]
46    pub fn set_sample_rate(this: &AudioContextOptions, val: f32);
47    #[cfg(web_sys_unstable_apis)]
48    #[doc = "Get the `sinkId` field of this object."]
49    #[doc = ""]
50    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
51    #[doc = ""]
52    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
53    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
54    #[wasm_bindgen(method, getter = "sinkId")]
55    pub fn get_sink_id(this: &AudioContextOptions) -> ::wasm_bindgen::JsValue;
56    #[cfg(web_sys_unstable_apis)]
57    #[doc = "Change the `sinkId` field of this object."]
58    #[doc = ""]
59    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
60    #[doc = ""]
61    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
62    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
63    #[wasm_bindgen(method, setter = "sinkId")]
64    pub fn set_sink_id(this: &AudioContextOptions, val: &str);
65    #[cfg(web_sys_unstable_apis)]
66    #[cfg(feature = "AudioSinkOptions")]
67    #[doc = "Change the `sinkId` field of this object."]
68    #[doc = ""]
69    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
70    #[doc = ""]
71    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
72    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
73    #[wasm_bindgen(method, setter = "sinkId")]
74    pub fn set_sink_id_audio_sink_options(this: &AudioContextOptions, val: &AudioSinkOptions);
75}
76impl AudioContextOptions {
77    #[doc = "Construct a new `AudioContextOptions`."]
78    #[doc = ""]
79    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
80    pub fn new() -> Self {
81        #[allow(unused_mut)]
82        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
83        ret
84    }
85    #[deprecated = "Use `set_latency_hint()` instead."]
86    pub fn latency_hint(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
87        self.set_latency_hint(val);
88        self
89    }
90    #[deprecated = "Use `set_sample_rate()` instead."]
91    pub fn sample_rate(&mut self, val: f32) -> &mut Self {
92        self.set_sample_rate(val);
93        self
94    }
95    #[cfg(web_sys_unstable_apis)]
96    #[deprecated = "Use `set_sink_id()` instead."]
97    pub fn sink_id(&mut self, val: &str) -> &mut Self {
98        self.set_sink_id(val);
99        self
100    }
101}
102impl Default for AudioContextOptions {
103    fn default() -> Self {
104        Self::new()
105    }
106}