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}
14impl AudioContextOptions {
15 #[doc = "Construct a new `AudioContextOptions`."]
16 #[doc = ""]
17 #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
18 pub fn new() -> Self {
19 #[allow(unused_mut)]
20 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
21 ret
22 }
23 #[doc = "Change the `latencyHint` field of this object."]
24 #[doc = ""]
25 #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
26 pub fn latency_hint(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
27 use wasm_bindgen::JsValue;
28 let r = ::js_sys::Reflect::set(
29 self.as_ref(),
30 &JsValue::from("latencyHint"),
31 &JsValue::from(val),
32 );
33 debug_assert!(
34 r.is_ok(),
35 "setting properties should never fail on our dictionary objects"
36 );
37 let _ = r;
38 self
39 }
40 #[doc = "Change the `sampleRate` field of this object."]
41 #[doc = ""]
42 #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
43 pub fn sample_rate(&mut self, val: f32) -> &mut Self {
44 use wasm_bindgen::JsValue;
45 let r = ::js_sys::Reflect::set(
46 self.as_ref(),
47 &JsValue::from("sampleRate"),
48 &JsValue::from(val),
49 );
50 debug_assert!(
51 r.is_ok(),
52 "setting properties should never fail on our dictionary objects"
53 );
54 let _ = r;
55 self
56 }
57 #[cfg(web_sys_unstable_apis)]
58 #[doc = "Change the `sinkId` field of this object."]
59 #[doc = ""]
60 #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"]
61 #[doc = ""]
62 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
63 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
64 pub fn sink_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
65 use wasm_bindgen::JsValue;
66 let r =
67 ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sinkId"), &JsValue::from(val));
68 debug_assert!(
69 r.is_ok(),
70 "setting properties should never fail on our dictionary objects"
71 );
72 let _ = r;
73 self
74 }
75}
76impl Default for AudioContextOptions {
77 fn default() -> Self {
78 Self::new()
79 }
80}
81