mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Expose more AudioParam methods
This commit is contained in:
parent
97aa142993
commit
986c2f7842
3 changed files with 35 additions and 3 deletions
|
@ -19,6 +19,8 @@ pub trait AudioParamImpl: JSTraceable + MallocSizeOf {
|
||||||
fn set_value_at_time(&self, value: f32, start_time: f64);
|
fn set_value_at_time(&self, value: f32, start_time: f64);
|
||||||
fn ramp_to_value_at_time(&self, ramp_kind: RampKind, value: f32, end_time: f64);
|
fn ramp_to_value_at_time(&self, ramp_kind: RampKind, value: f32, end_time: f64);
|
||||||
fn set_target_at_time(&self, value: f32, start_time: f64, time_constant: f32);
|
fn set_target_at_time(&self, value: f32, start_time: f64, time_constant: f32);
|
||||||
|
fn cancel_scheduled_values(&self, cancel_time: f64);
|
||||||
|
fn cancel_and_hold_at_time(&self, cancel_time: f64);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -118,4 +120,14 @@ impl AudioParamMethods for AudioParam {
|
||||||
self.param_impl.set_target_at_time(*target, *start_time, *time_constant);
|
self.param_impl.set_target_at_time(*target, *start_time, *time_constant);
|
||||||
DomRoot::from_ref(self)
|
DomRoot::from_ref(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn CancelScheduledValues(&self, cancel_time: Finite<f64>) -> DomRoot<AudioParam> {
|
||||||
|
self.param_impl.cancel_scheduled_values(*cancel_time);
|
||||||
|
DomRoot::from_ref(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn CancelAndHoldAtTime(&self, cancel_time: Finite<f64>) -> DomRoot<AudioParam> {
|
||||||
|
self.param_impl.cancel_and_hold_at_time(*cancel_time);
|
||||||
|
DomRoot::from_ref(self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,7 +651,9 @@ macro_rules! audio_param_impl(
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AudioParamImpl for $struct {
|
impl AudioParamImpl for $struct {
|
||||||
fn set_value(&self, _value: f32) {}
|
fn set_value(&self, value: f32) {
|
||||||
|
self.set_value_at_time(value, self.context.current_time());
|
||||||
|
}
|
||||||
|
|
||||||
fn set_value_at_time(&self, value: f32, start_time: f64) {
|
fn set_value_at_time(&self, value: f32, start_time: f64) {
|
||||||
self.context.message_node(
|
self.context.message_node(
|
||||||
|
@ -679,6 +681,24 @@ macro_rules! audio_param_impl(
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn cancel_scheduled_values(&self, cancel_time: f64) {
|
||||||
|
self.context.message_node(
|
||||||
|
self.node,
|
||||||
|
AudioNodeMessage::$node_type($message_type::$setter(
|
||||||
|
UserAutomationEvent::CancelScheduledValues(cancel_time),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cancel_and_hold_at_time(&self, cancel_time: f64) {
|
||||||
|
self.context.message_node(
|
||||||
|
self.node,
|
||||||
|
AudioNodeMessage::$node_type($message_type::$setter(
|
||||||
|
UserAutomationEvent::CancelAndHoldAtTime(cancel_time),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
);
|
);
|
||||||
|
|
|
@ -27,6 +27,6 @@ interface AudioParam {
|
||||||
// AudioParam setValueCurveAtTime(sequence<float> values,
|
// AudioParam setValueCurveAtTime(sequence<float> values,
|
||||||
// double startTime,
|
// double startTime,
|
||||||
// double duration);
|
// double duration);
|
||||||
// AudioParam cancelScheduledValues(double cancelTime);
|
AudioParam cancelScheduledValues(double cancelTime);
|
||||||
// AudioParam cancelAndHoldAtTime(double cancelTime);
|
AudioParam cancelAndHoldAtTime(double cancelTime);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue