1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
use super::*;
/// The AudioParam class.
/// [`AudioParam`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct AudioParam {
inner: Any,
}
impl FromVal for AudioParam {
fn from_val(v: &Any) -> Self {
AudioParam {
inner: Any::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for AudioParam {
type Target = Any;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for AudioParam {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for AudioParam {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for AudioParam {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<AudioParam> for Any {
fn from(s: AudioParam) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&AudioParam> for Any {
fn from(s: &AudioParam) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(AudioParam);
impl AudioParam {
/// Getter of the `value` attribute.
/// [`AudioParam.value`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/value)
pub fn value(&self) -> f32 {
self.inner.get("value").as_::<f32>()
}
/// Setter of the `value` attribute.
/// [`AudioParam.value`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/value)
pub fn set_value(&mut self, value: f32) {
self.inner.set("value", value);
}
}
impl AudioParam {
/// Getter of the `automationRate` attribute.
/// [`AudioParam.automationRate`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/automationRate)
pub fn automation_rate(&self) -> AutomationRate {
self.inner.get("automationRate").as_::<AutomationRate>()
}
/// Setter of the `automationRate` attribute.
/// [`AudioParam.automationRate`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/automationRate)
pub fn set_automation_rate(&mut self, value: &AutomationRate) {
self.inner.set("automationRate", value);
}
}
impl AudioParam {
/// Getter of the `defaultValue` attribute.
/// [`AudioParam.defaultValue`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/defaultValue)
pub fn default_value(&self) -> f32 {
self.inner.get("defaultValue").as_::<f32>()
}
}
impl AudioParam {
/// Getter of the `minValue` attribute.
/// [`AudioParam.minValue`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/minValue)
pub fn min_value(&self) -> f32 {
self.inner.get("minValue").as_::<f32>()
}
}
impl AudioParam {
/// Getter of the `maxValue` attribute.
/// [`AudioParam.maxValue`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/maxValue)
pub fn max_value(&self) -> f32 {
self.inner.get("maxValue").as_::<f32>()
}
}
impl AudioParam {
/// The setValueAtTime method.
/// [`AudioParam.setValueAtTime`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setValueAtTime)
pub fn set_value_at_time(&self, value: f32, start_time: f64) -> AudioParam {
self.inner
.call("setValueAtTime", &[value.into(), start_time.into()])
.as_::<AudioParam>()
}
}
impl AudioParam {
/// The linearRampToValueAtTime method.
/// [`AudioParam.linearRampToValueAtTime`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/linearRampToValueAtTime)
pub fn linear_ramp_to_value_at_time(&self, value: f32, end_time: f64) -> AudioParam {
self.inner
.call("linearRampToValueAtTime", &[value.into(), end_time.into()])
.as_::<AudioParam>()
}
}
impl AudioParam {
/// The exponentialRampToValueAtTime method.
/// [`AudioParam.exponentialRampToValueAtTime`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/exponentialRampToValueAtTime)
pub fn exponential_ramp_to_value_at_time(&self, value: f32, end_time: f64) -> AudioParam {
self.inner
.call(
"exponentialRampToValueAtTime",
&[value.into(), end_time.into()],
)
.as_::<AudioParam>()
}
}
impl AudioParam {
/// The setTargetAtTime method.
/// [`AudioParam.setTargetAtTime`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setTargetAtTime)
pub fn set_target_at_time(
&self,
target: f32,
start_time: f64,
time_constant: f32,
) -> AudioParam {
self.inner
.call(
"setTargetAtTime",
&[target.into(), start_time.into(), time_constant.into()],
)
.as_::<AudioParam>()
}
}
impl AudioParam {
/// The setValueCurveAtTime method.
/// [`AudioParam.setValueCurveAtTime`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setValueCurveAtTime)
pub fn set_value_curve_at_time(
&self,
values: TypedArray<f32>,
start_time: f64,
duration: f64,
) -> AudioParam {
self.inner
.call(
"setValueCurveAtTime",
&[values.into(), start_time.into(), duration.into()],
)
.as_::<AudioParam>()
}
}
impl AudioParam {
/// The cancelScheduledValues method.
/// [`AudioParam.cancelScheduledValues`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/cancelScheduledValues)
pub fn cancel_scheduled_values(&self, cancel_time: f64) -> AudioParam {
self.inner
.call("cancelScheduledValues", &[cancel_time.into()])
.as_::<AudioParam>()
}
}
impl AudioParam {
/// The cancelAndHoldAtTime method.
/// [`AudioParam.cancelAndHoldAtTime`](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/cancelAndHoldAtTime)
pub fn cancel_and_hold_at_time(&self, cancel_time: f64) -> AudioParam {
self.inner
.call("cancelAndHoldAtTime", &[cancel_time.into()])
.as_::<AudioParam>()
}
}