web_sys/features/
gen_AudioDataInit.rs1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[cfg(web_sys_unstable_apis)]
6#[wasm_bindgen]
7extern "C" {
8 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AudioDataInit)]
9 #[derive(Debug, Clone, PartialEq, Eq)]
10 #[doc = "The `AudioDataInit` dictionary."]
11 #[doc = ""]
12 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
13 #[doc = ""]
14 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
15 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
16 pub type AudioDataInit;
17 #[cfg(web_sys_unstable_apis)]
18 #[doc = "Get the `data` field of this object."]
19 #[doc = ""]
20 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
21 #[doc = ""]
22 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
23 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
24 #[wasm_bindgen(method, getter = "data")]
25 pub fn get_data(this: &AudioDataInit) -> ::js_sys::Object;
26 #[cfg(web_sys_unstable_apis)]
27 #[doc = "Change the `data` field of this object."]
28 #[doc = ""]
29 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
30 #[doc = ""]
31 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
32 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
33 #[wasm_bindgen(method, setter = "data")]
34 pub fn set_data(this: &AudioDataInit, val: &::js_sys::Object);
35 #[cfg(web_sys_unstable_apis)]
36 #[cfg(feature = "AudioSampleFormat")]
37 #[doc = "Get the `format` field of this object."]
38 #[doc = ""]
39 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"]
40 #[doc = ""]
41 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
42 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
43 #[wasm_bindgen(method, getter = "format")]
44 pub fn get_format(this: &AudioDataInit) -> AudioSampleFormat;
45 #[cfg(web_sys_unstable_apis)]
46 #[cfg(feature = "AudioSampleFormat")]
47 #[doc = "Change the `format` field of this object."]
48 #[doc = ""]
49 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"]
50 #[doc = ""]
51 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
52 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
53 #[wasm_bindgen(method, setter = "format")]
54 pub fn set_format(this: &AudioDataInit, val: AudioSampleFormat);
55 #[cfg(web_sys_unstable_apis)]
56 #[doc = "Get the `numberOfChannels` field of this object."]
57 #[doc = ""]
58 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
59 #[doc = ""]
60 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
61 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
62 #[wasm_bindgen(method, getter = "numberOfChannels")]
63 pub fn get_number_of_channels(this: &AudioDataInit) -> u32;
64 #[cfg(web_sys_unstable_apis)]
65 #[doc = "Change the `numberOfChannels` field of this object."]
66 #[doc = ""]
67 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
68 #[doc = ""]
69 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
70 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
71 #[wasm_bindgen(method, setter = "numberOfChannels")]
72 pub fn set_number_of_channels(this: &AudioDataInit, val: u32);
73 #[cfg(web_sys_unstable_apis)]
74 #[doc = "Get the `numberOfFrames` field of this object."]
75 #[doc = ""]
76 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
77 #[doc = ""]
78 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
79 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
80 #[wasm_bindgen(method, getter = "numberOfFrames")]
81 pub fn get_number_of_frames(this: &AudioDataInit) -> u32;
82 #[cfg(web_sys_unstable_apis)]
83 #[doc = "Change the `numberOfFrames` field of this object."]
84 #[doc = ""]
85 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
86 #[doc = ""]
87 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
88 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
89 #[wasm_bindgen(method, setter = "numberOfFrames")]
90 pub fn set_number_of_frames(this: &AudioDataInit, val: u32);
91 #[cfg(web_sys_unstable_apis)]
92 #[doc = "Get the `sampleRate` field of this object."]
93 #[doc = ""]
94 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
95 #[doc = ""]
96 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
97 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
98 #[wasm_bindgen(method, getter = "sampleRate")]
99 pub fn get_sample_rate(this: &AudioDataInit) -> f32;
100 #[cfg(web_sys_unstable_apis)]
101 #[doc = "Change the `sampleRate` field of this object."]
102 #[doc = ""]
103 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
104 #[doc = ""]
105 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
106 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
107 #[wasm_bindgen(method, setter = "sampleRate")]
108 pub fn set_sample_rate(this: &AudioDataInit, val: f32);
109 #[cfg(web_sys_unstable_apis)]
110 #[doc = "Get the `timestamp` field of this object."]
111 #[doc = ""]
112 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
113 #[doc = ""]
114 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
115 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
116 #[wasm_bindgen(method, getter = "timestamp")]
117 pub fn get_timestamp(this: &AudioDataInit) -> f64;
118 #[cfg(web_sys_unstable_apis)]
119 #[doc = "Change the `timestamp` field of this object."]
120 #[doc = ""]
121 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
122 #[doc = ""]
123 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
124 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
125 #[wasm_bindgen(method, setter = "timestamp")]
126 pub fn set_timestamp(this: &AudioDataInit, val: f64);
127}
128#[cfg(web_sys_unstable_apis)]
129impl AudioDataInit {
130 #[cfg(feature = "AudioSampleFormat")]
131 #[doc = "Construct a new `AudioDataInit`."]
132 #[doc = ""]
133 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"]
134 #[doc = ""]
135 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
136 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
137 pub fn new(
138 data: &::js_sys::Object,
139 format: AudioSampleFormat,
140 number_of_channels: u32,
141 number_of_frames: u32,
142 sample_rate: f32,
143 timestamp: f64,
144 ) -> Self {
145 #[allow(unused_mut)]
146 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
147 ret.set_data(data);
148 ret.set_format(format);
149 ret.set_number_of_channels(number_of_channels);
150 ret.set_number_of_frames(number_of_frames);
151 ret.set_sample_rate(sample_rate);
152 ret.set_timestamp(timestamp);
153 ret
154 }
155 #[cfg(web_sys_unstable_apis)]
156 #[deprecated = "Use `set_data()` instead."]
157 pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self {
158 self.set_data(val);
159 self
160 }
161 #[cfg(web_sys_unstable_apis)]
162 #[cfg(feature = "AudioSampleFormat")]
163 #[deprecated = "Use `set_format()` instead."]
164 pub fn format(&mut self, val: AudioSampleFormat) -> &mut Self {
165 self.set_format(val);
166 self
167 }
168 #[cfg(web_sys_unstable_apis)]
169 #[deprecated = "Use `set_number_of_channels()` instead."]
170 pub fn number_of_channels(&mut self, val: u32) -> &mut Self {
171 self.set_number_of_channels(val);
172 self
173 }
174 #[cfg(web_sys_unstable_apis)]
175 #[deprecated = "Use `set_number_of_frames()` instead."]
176 pub fn number_of_frames(&mut self, val: u32) -> &mut Self {
177 self.set_number_of_frames(val);
178 self
179 }
180 #[cfg(web_sys_unstable_apis)]
181 #[deprecated = "Use `set_sample_rate()` instead."]
182 pub fn sample_rate(&mut self, val: f32) -> &mut Self {
183 self.set_sample_rate(val);
184 self
185 }
186 #[cfg(web_sys_unstable_apis)]
187 #[deprecated = "Use `set_timestamp()` instead."]
188 pub fn timestamp(&mut self, val: f64) -> &mut Self {
189 self.set_timestamp(val);
190 self
191 }
192}