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    #[doc = "Get the `sampleRate` field of this object."]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
26    #[wasm_bindgen(method, getter = "sampleRate")]
27    pub fn get_sample_rate(this: &AudioContextOptions) -> Option<f32>;
28    #[doc = "Change the `sampleRate` field of this object."]
29    #[doc = ""]
30    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
31    #[wasm_bindgen(method, setter = "sampleRate")]
32    pub fn set_sample_rate(this: &AudioContextOptions, val: f32);
33    #[cfg(web_sys_unstable_apis)]
34    #[doc = "Get the `sinkId` field of this object."]
35    #[doc = ""]
36    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
37    #[doc = ""]
38    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
39    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
40    #[wasm_bindgen(method, getter = "sinkId")]
41    pub fn get_sink_id(this: &AudioContextOptions) -> ::wasm_bindgen::JsValue;
42    #[cfg(web_sys_unstable_apis)]
43    #[doc = "Change the `sinkId` field of this object."]
44    #[doc = ""]
45    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
46    #[doc = ""]
47    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
48    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
49    #[wasm_bindgen(method, setter = "sinkId")]
50    pub fn set_sink_id(this: &AudioContextOptions, val: &::wasm_bindgen::JsValue);
51}
52impl AudioContextOptions {
53    #[doc = "Construct a new `AudioContextOptions`."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
56    pub fn new() -> Self {
57        #[allow(unused_mut)]
58        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
59        ret
60    }
61    #[deprecated = "Use `set_latency_hint()` instead."]
62    pub fn latency_hint(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
63        self.set_latency_hint(val);
64        self
65    }
66    #[deprecated = "Use `set_sample_rate()` instead."]
67    pub fn sample_rate(&mut self, val: f32) -> &mut Self {
68        self.set_sample_rate(val);
69        self
70    }
71    #[cfg(web_sys_unstable_apis)]
72    #[deprecated = "Use `set_sink_id()` instead."]
73    pub fn sink_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
74        self.set_sink_id(val);
75        self
76    }
77}
78impl Default for AudioContextOptions {
79    fn default() -> Self {
80        Self::new()
81    }
82}