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://wasm-bindgen.github.io/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://wasm-bindgen.github.io/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://wasm-bindgen.github.io/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 #[doc = "Change the `data` field of this object."]
37 #[doc = ""]
38 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
39 #[doc = ""]
40 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
41 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
42 #[wasm_bindgen(method, setter = "data")]
43 pub fn set_data_u8_slice(this: &AudioDataInit, val: &mut [u8]);
44 #[cfg(web_sys_unstable_apis)]
45 #[doc = "Change the `data` field of this object."]
46 #[doc = ""]
47 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
48 #[doc = ""]
49 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
50 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
51 #[wasm_bindgen(method, setter = "data")]
52 pub fn set_data_u8_array(this: &AudioDataInit, val: &::js_sys::Uint8Array);
53 #[cfg(web_sys_unstable_apis)]
54 #[cfg(feature = "AudioSampleFormat")]
55 #[doc = "Get the `format` field of this object."]
56 #[doc = ""]
57 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"]
58 #[doc = ""]
59 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
60 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
61 #[wasm_bindgen(method, getter = "format")]
62 pub fn get_format(this: &AudioDataInit) -> AudioSampleFormat;
63 #[cfg(web_sys_unstable_apis)]
64 #[cfg(feature = "AudioSampleFormat")]
65 #[doc = "Change the `format` field of this object."]
66 #[doc = ""]
67 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
71 #[wasm_bindgen(method, setter = "format")]
72 pub fn set_format(this: &AudioDataInit, val: AudioSampleFormat);
73 #[cfg(web_sys_unstable_apis)]
74 #[doc = "Get the `numberOfChannels` 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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
80 #[wasm_bindgen(method, getter = "numberOfChannels")]
81 pub fn get_number_of_channels(this: &AudioDataInit) -> u32;
82 #[cfg(web_sys_unstable_apis)]
83 #[doc = "Change the `numberOfChannels` 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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
89 #[wasm_bindgen(method, setter = "numberOfChannels")]
90 pub fn set_number_of_channels(this: &AudioDataInit, val: u32);
91 #[cfg(web_sys_unstable_apis)]
92 #[doc = "Get the `numberOfFrames` 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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
98 #[wasm_bindgen(method, getter = "numberOfFrames")]
99 pub fn get_number_of_frames(this: &AudioDataInit) -> u32;
100 #[cfg(web_sys_unstable_apis)]
101 #[doc = "Change the `numberOfFrames` 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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
107 #[wasm_bindgen(method, setter = "numberOfFrames")]
108 pub fn set_number_of_frames(this: &AudioDataInit, val: u32);
109 #[cfg(web_sys_unstable_apis)]
110 #[doc = "Get the `sampleRate` 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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
116 #[wasm_bindgen(method, getter = "sampleRate")]
117 pub fn get_sample_rate(this: &AudioDataInit) -> f32;
118 #[cfg(web_sys_unstable_apis)]
119 #[doc = "Change the `sampleRate` 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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
125 #[wasm_bindgen(method, setter = "sampleRate")]
126 pub fn set_sample_rate(this: &AudioDataInit, val: f32);
127 #[cfg(web_sys_unstable_apis)]
128 #[doc = "Get the `timestamp` field of this object."]
129 #[doc = ""]
130 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
131 #[doc = ""]
132 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
133 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
134 #[wasm_bindgen(method, getter = "timestamp")]
135 pub fn get_timestamp(this: &AudioDataInit) -> f64;
136 #[cfg(web_sys_unstable_apis)]
137 #[doc = "Change the `timestamp` field of this object."]
138 #[doc = ""]
139 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
140 #[doc = ""]
141 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
142 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
143 #[wasm_bindgen(method, setter = "timestamp")]
144 pub fn set_timestamp(this: &AudioDataInit, val: i32);
145 #[cfg(web_sys_unstable_apis)]
146 #[doc = "Change the `timestamp` field of this object."]
147 #[doc = ""]
148 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
149 #[doc = ""]
150 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
151 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
152 #[wasm_bindgen(method, setter = "timestamp")]
153 pub fn set_timestamp_f64(this: &AudioDataInit, val: f64);
154 #[cfg(web_sys_unstable_apis)]
155 #[doc = "Get the `transfer` field of this object."]
156 #[doc = ""]
157 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
158 #[doc = ""]
159 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
160 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
161 #[wasm_bindgen(method, getter = "transfer")]
162 pub fn get_transfer(this: &AudioDataInit) -> Option<::js_sys::Array<::js_sys::ArrayBuffer>>;
163 #[cfg(web_sys_unstable_apis)]
164 #[doc = "Change the `transfer` field of this object."]
165 #[doc = ""]
166 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"]
167 #[doc = ""]
168 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
169 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
170 #[wasm_bindgen(method, setter = "transfer")]
171 pub fn set_transfer(this: &AudioDataInit, val: &[::js_sys::ArrayBuffer]);
172}
173#[cfg(web_sys_unstable_apis)]
174impl AudioDataInit {
175 #[cfg(feature = "AudioSampleFormat")]
176 #[doc = "Construct a new `AudioDataInit`."]
177 #[doc = ""]
178 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"]
179 #[doc = ""]
180 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
181 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
182 pub fn new(
183 data: &::js_sys::Object,
184 format: AudioSampleFormat,
185 number_of_channels: u32,
186 number_of_frames: u32,
187 sample_rate: f32,
188 timestamp: i32,
189 ) -> Self {
190 #[allow(unused_mut)]
191 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
192 ret.set_data(data);
193 ret.set_format(format);
194 ret.set_number_of_channels(number_of_channels);
195 ret.set_number_of_frames(number_of_frames);
196 ret.set_sample_rate(sample_rate);
197 ret.set_timestamp(timestamp);
198 ret
199 }
200 #[cfg(feature = "AudioSampleFormat")]
201 #[doc = "Construct a new `AudioDataInit`."]
202 #[doc = ""]
203 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"]
204 #[doc = ""]
205 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
206 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
207 pub fn new_with_u8_slice(
208 data: &mut [u8],
209 format: AudioSampleFormat,
210 number_of_channels: u32,
211 number_of_frames: u32,
212 sample_rate: f32,
213 timestamp: i32,
214 ) -> Self {
215 #[allow(unused_mut)]
216 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
217 ret.set_data_u8_slice(data);
218 ret.set_format(format);
219 ret.set_number_of_channels(number_of_channels);
220 ret.set_number_of_frames(number_of_frames);
221 ret.set_sample_rate(sample_rate);
222 ret.set_timestamp(timestamp);
223 ret
224 }
225 #[cfg(feature = "AudioSampleFormat")]
226 #[doc = "Construct a new `AudioDataInit`."]
227 #[doc = ""]
228 #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"]
229 #[doc = ""]
230 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
231 #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
232 pub fn new_with_u8_array(
233 data: &::js_sys::Uint8Array,
234 format: AudioSampleFormat,
235 number_of_channels: u32,
236 number_of_frames: u32,
237 sample_rate: f32,
238 timestamp: i32,
239 ) -> Self {
240 #[allow(unused_mut)]
241 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
242 ret.set_data_u8_array(data);
243 ret.set_format(format);
244 ret.set_number_of_channels(number_of_channels);
245 ret.set_number_of_frames(number_of_frames);
246 ret.set_sample_rate(sample_rate);
247 ret.set_timestamp(timestamp);
248 ret
249 }
250 #[cfg(web_sys_unstable_apis)]
251 #[deprecated = "Use `set_data()` instead."]
252 pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self {
253 self.set_data(val);
254 self
255 }
256 #[cfg(web_sys_unstable_apis)]
257 #[cfg(feature = "AudioSampleFormat")]
258 #[deprecated = "Use `set_format()` instead."]
259 pub fn format(&mut self, val: AudioSampleFormat) -> &mut Self {
260 self.set_format(val);
261 self
262 }
263 #[cfg(web_sys_unstable_apis)]
264 #[deprecated = "Use `set_number_of_channels()` instead."]
265 pub fn number_of_channels(&mut self, val: u32) -> &mut Self {
266 self.set_number_of_channels(val);
267 self
268 }
269 #[cfg(web_sys_unstable_apis)]
270 #[deprecated = "Use `set_number_of_frames()` instead."]
271 pub fn number_of_frames(&mut self, val: u32) -> &mut Self {
272 self.set_number_of_frames(val);
273 self
274 }
275 #[cfg(web_sys_unstable_apis)]
276 #[deprecated = "Use `set_sample_rate()` instead."]
277 pub fn sample_rate(&mut self, val: f32) -> &mut Self {
278 self.set_sample_rate(val);
279 self
280 }
281 #[cfg(web_sys_unstable_apis)]
282 #[deprecated = "Use `set_timestamp()` instead."]
283 pub fn timestamp(&mut self, val: i32) -> &mut Self {
284 self.set_timestamp(val);
285 self
286 }
287 #[cfg(web_sys_unstable_apis)]
288 #[deprecated = "Use `set_transfer()` instead."]
289 pub fn transfer(&mut self, val: &[::js_sys::ArrayBuffer]) -> &mut Self {
290 self.set_transfer(val);
291 self
292 }
293}