1 #![allow(unused_imports)] 2 use super::*; 3 use wasm_bindgen::prelude::*; 4 #[wasm_bindgen] 5 extern "C" { 6 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AudioBufferOptions)] 7 #[derive(Debug, Clone, PartialEq, Eq)] 8 #[doc = "The `AudioBufferOptions` dictionary."] 9 #[doc = ""] 10 #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] 11 pub type AudioBufferOptions; 12 } 13 impl AudioBufferOptions { 14 #[doc = "Construct a new `AudioBufferOptions`."] 15 #[doc = ""] 16 #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] new(length: u32, sample_rate: f32) -> Self17 pub fn new(length: u32, sample_rate: f32) -> Self { 18 #[allow(unused_mut)] 19 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); 20 ret.length(length); 21 ret.sample_rate(sample_rate); 22 ret 23 } 24 #[doc = "Change the `length` field of this object."] 25 #[doc = ""] 26 #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] length(&mut self, val: u32) -> &mut Self27 pub fn length(&mut self, val: u32) -> &mut Self { 28 use wasm_bindgen::JsValue; 29 let r = 30 ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); 31 debug_assert!( 32 r.is_ok(), 33 "setting properties should never fail on our dictionary objects" 34 ); 35 let _ = r; 36 self 37 } 38 #[doc = "Change the `numberOfChannels` field of this object."] 39 #[doc = ""] 40 #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] number_of_channels(&mut self, val: u32) -> &mut Self41 pub fn number_of_channels(&mut self, val: u32) -> &mut Self { 42 use wasm_bindgen::JsValue; 43 let r = ::js_sys::Reflect::set( 44 self.as_ref(), 45 &JsValue::from("numberOfChannels"), 46 &JsValue::from(val), 47 ); 48 debug_assert!( 49 r.is_ok(), 50 "setting properties should never fail on our dictionary objects" 51 ); 52 let _ = r; 53 self 54 } 55 #[doc = "Change the `sampleRate` field of this object."] 56 #[doc = ""] 57 #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] sample_rate(&mut self, val: f32) -> &mut Self58 pub fn sample_rate(&mut self, val: f32) -> &mut Self { 59 use wasm_bindgen::JsValue; 60 let r = ::js_sys::Reflect::set( 61 self.as_ref(), 62 &JsValue::from("sampleRate"), 63 &JsValue::from(val), 64 ); 65 debug_assert!( 66 r.is_ok(), 67 "setting properties should never fail on our dictionary objects" 68 ); 69 let _ = r; 70 self 71 } 72 } 73