maxcountryman_web_sys/features/
gen_AudioBufferSourceOptions.rs1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AudioBufferSourceOptions)]
7 #[derive(Debug, Clone, PartialEq, Eq)]
8 #[doc = "The `AudioBufferSourceOptions` dictionary."]
9 #[doc = ""]
10 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
11 pub type AudioBufferSourceOptions;
12}
13impl AudioBufferSourceOptions {
14 #[doc = "Construct a new `AudioBufferSourceOptions`."]
15 #[doc = ""]
16 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
17 pub fn new() -> Self {
18 #[allow(unused_mut)]
19 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
20 ret
21 }
22 #[cfg(feature = "AudioBuffer")]
23 #[doc = "Change the `buffer` field of this object."]
24 #[doc = ""]
25 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `AudioBufferSourceOptions`*"]
26 pub fn buffer(&mut self, val: Option<&AudioBuffer>) -> &mut Self {
27 use wasm_bindgen::JsValue;
28 let r =
29 ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("buffer"), &JsValue::from(val));
30 debug_assert!(
31 r.is_ok(),
32 "setting properties should never fail on our dictionary objects"
33 );
34 let _ = r;
35 self
36 }
37 #[doc = "Change the `detune` field of this object."]
38 #[doc = ""]
39 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
40 pub fn detune(&mut self, val: f32) -> &mut Self {
41 use wasm_bindgen::JsValue;
42 let r =
43 ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detune"), &JsValue::from(val));
44 debug_assert!(
45 r.is_ok(),
46 "setting properties should never fail on our dictionary objects"
47 );
48 let _ = r;
49 self
50 }
51 #[doc = "Change the `loop` field of this object."]
52 #[doc = ""]
53 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
54 pub fn loop_(&mut self, val: bool) -> &mut Self {
55 use wasm_bindgen::JsValue;
56 let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("loop"), &JsValue::from(val));
57 debug_assert!(
58 r.is_ok(),
59 "setting properties should never fail on our dictionary objects"
60 );
61 let _ = r;
62 self
63 }
64 #[doc = "Change the `loopEnd` field of this object."]
65 #[doc = ""]
66 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
67 pub fn loop_end(&mut self, val: f64) -> &mut Self {
68 use wasm_bindgen::JsValue;
69 let r = ::js_sys::Reflect::set(
70 self.as_ref(),
71 &JsValue::from("loopEnd"),
72 &JsValue::from(val),
73 );
74 debug_assert!(
75 r.is_ok(),
76 "setting properties should never fail on our dictionary objects"
77 );
78 let _ = r;
79 self
80 }
81 #[doc = "Change the `loopStart` field of this object."]
82 #[doc = ""]
83 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
84 pub fn loop_start(&mut self, val: f64) -> &mut Self {
85 use wasm_bindgen::JsValue;
86 let r = ::js_sys::Reflect::set(
87 self.as_ref(),
88 &JsValue::from("loopStart"),
89 &JsValue::from(val),
90 );
91 debug_assert!(
92 r.is_ok(),
93 "setting properties should never fail on our dictionary objects"
94 );
95 let _ = r;
96 self
97 }
98 #[doc = "Change the `playbackRate` field of this object."]
99 #[doc = ""]
100 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
101 pub fn playback_rate(&mut self, val: f32) -> &mut Self {
102 use wasm_bindgen::JsValue;
103 let r = ::js_sys::Reflect::set(
104 self.as_ref(),
105 &JsValue::from("playbackRate"),
106 &JsValue::from(val),
107 );
108 debug_assert!(
109 r.is_ok(),
110 "setting properties should never fail on our dictionary objects"
111 );
112 let _ = r;
113 self
114 }
115}
116impl Default for AudioBufferSourceOptions {
117 fn default() -> Self {
118 Self::new()
119 }
120}