1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 #[wasm_bindgen(
8 extends = "::js_sys::Object",
9 js_name = "AudioBuffer",
10 typescript_type = "AudioBuffer"
11 )]
12 #[derive(Debug, Clone, PartialEq, Eq)]
13 #[doc = "The `AudioBuffer` class."]
14 #[doc = ""]
15 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer)"]
16 #[doc = ""]
17 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
18 pub type AudioBuffer;
19 #[wasm_bindgen(method, getter, js_class = "AudioBuffer", js_name = "sampleRate")]
20 #[doc = "Getter for the `sampleRate` field of this object."]
21 #[doc = ""]
22 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/sampleRate)"]
23 #[doc = ""]
24 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
25 pub fn sample_rate(this: &AudioBuffer) -> f32;
26 #[wasm_bindgen(method, getter, js_class = "AudioBuffer", js_name = "length")]
27 #[doc = "Getter for the `length` field of this object."]
28 #[doc = ""]
29 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/length)"]
30 #[doc = ""]
31 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
32 pub fn length(this: &AudioBuffer) -> u32;
33 #[wasm_bindgen(method, getter, js_class = "AudioBuffer", js_name = "duration")]
34 #[doc = "Getter for the `duration` field of this object."]
35 #[doc = ""]
36 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/duration)"]
37 #[doc = ""]
38 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
39 pub fn duration(this: &AudioBuffer) -> f64;
40 #[wasm_bindgen(method, getter, js_class = "AudioBuffer", js_name = "numberOfChannels")]
41 #[doc = "Getter for the `numberOfChannels` field of this object."]
42 #[doc = ""]
43 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/numberOfChannels)"]
44 #[doc = ""]
45 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
46 pub fn number_of_channels(this: &AudioBuffer) -> u32;
47 #[cfg(feature = "AudioBufferOptions")]
48 #[wasm_bindgen(catch, constructor, js_class = "AudioBuffer")]
49 #[doc = "The `new AudioBuffer(..)` constructor, creating a new instance of `AudioBuffer`."]
50 #[doc = ""]
51 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/AudioBuffer)"]
52 #[doc = ""]
53 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `AudioBufferOptions`*"]
54 pub fn new(options: &AudioBufferOptions) -> Result<AudioBuffer, JsValue>;
55 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "copyFromChannel")]
56 #[doc = "The `copyFromChannel()` method."]
57 #[doc = ""]
58 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyFromChannel)"]
59 #[doc = ""]
60 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
61 pub fn copy_from_channel(
62 this: &AudioBuffer,
63 destination: &mut [f32],
64 channel_number: i32,
65 ) -> Result<(), JsValue>;
66 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "copyFromChannel")]
67 #[doc = "The `copyFromChannel()` method."]
68 #[doc = ""]
69 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyFromChannel)"]
70 #[doc = ""]
71 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
72 pub fn copy_from_channel_with_f32_array(
73 this: &AudioBuffer,
74 destination: &::js_sys::Float32Array,
75 channel_number: i32,
76 ) -> Result<(), JsValue>;
77 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "copyFromChannel")]
78 #[doc = "The `copyFromChannel()` method."]
79 #[doc = ""]
80 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyFromChannel)"]
81 #[doc = ""]
82 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
83 pub fn copy_from_channel_with_start_in_channel(
84 this: &AudioBuffer,
85 destination: &mut [f32],
86 channel_number: i32,
87 start_in_channel: u32,
88 ) -> Result<(), JsValue>;
89 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "copyFromChannel")]
90 #[doc = "The `copyFromChannel()` method."]
91 #[doc = ""]
92 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyFromChannel)"]
93 #[doc = ""]
94 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
95 pub fn copy_from_channel_with_f32_array_and_start_in_channel(
96 this: &AudioBuffer,
97 destination: &::js_sys::Float32Array,
98 channel_number: i32,
99 start_in_channel: u32,
100 ) -> Result<(), JsValue>;
101 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "copyToChannel")]
102 #[doc = "The `copyToChannel()` method."]
103 #[doc = ""]
104 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyToChannel)"]
105 #[doc = ""]
106 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
107 pub fn copy_to_channel(
108 this: &AudioBuffer,
109 source: &[f32],
110 channel_number: i32,
111 ) -> Result<(), JsValue>;
112 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "copyToChannel")]
113 #[doc = "The `copyToChannel()` method."]
114 #[doc = ""]
115 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyToChannel)"]
116 #[doc = ""]
117 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
118 pub fn copy_to_channel_with_f32_array(
119 this: &AudioBuffer,
120 source: &::js_sys::Float32Array,
121 channel_number: i32,
122 ) -> Result<(), JsValue>;
123 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "copyToChannel")]
124 #[doc = "The `copyToChannel()` method."]
125 #[doc = ""]
126 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyToChannel)"]
127 #[doc = ""]
128 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
129 pub fn copy_to_channel_with_start_in_channel(
130 this: &AudioBuffer,
131 source: &[f32],
132 channel_number: i32,
133 start_in_channel: u32,
134 ) -> Result<(), JsValue>;
135 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "copyToChannel")]
136 #[doc = "The `copyToChannel()` method."]
137 #[doc = ""]
138 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyToChannel)"]
139 #[doc = ""]
140 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
141 pub fn copy_to_channel_with_f32_array_and_start_in_channel(
142 this: &AudioBuffer,
143 source: &::js_sys::Float32Array,
144 channel_number: i32,
145 start_in_channel: u32,
146 ) -> Result<(), JsValue>;
147 #[wasm_bindgen(catch, method, js_class = "AudioBuffer", js_name = "getChannelData")]
148 #[doc = "The `getChannelData()` method."]
149 #[doc = ""]
150 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/getChannelData)"]
151 #[doc = ""]
152 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"]
153 pub fn get_channel_data(
154 this: &AudioBuffer,
155 channel: u32,
156 ) -> Result<::alloc::vec::Vec<f32>, JsValue>;
157}