diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2018-07-09 23:10:20 -0700 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2018-07-30 14:21:44 +0200 |
commit | f0d04249f9fe7a9ee78a868e27268708b6ec0cf1 (patch) | |
tree | c5a852152462e00e1b2d17876b247ca3bc56fbf4 /components/script/dom/macros.rs | |
parent | 8f9a081ff0395e84bf303c1baa68447c087f6243 (diff) | |
download | servo-f0d04249f9fe7a9ee78a868e27268708b6ec0cf1.tar.gz servo-f0d04249f9fe7a9ee78a868e27268708b6ec0cf1.zip |
Use new params impl (#4)
* AudioNodeType -> AudioNodeInit
* Use new param type system, clean up
Diffstat (limited to 'components/script/dom/macros.rs')
-rw-r--r-- | components/script/dom/macros.rs | 75 |
1 files changed, 1 insertions, 74 deletions
diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 923d0bb9873..7d9172cbe7b 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -628,77 +628,4 @@ macro_rules! handle_potential_webgl_error { ($context:expr, $call:expr) => { handle_potential_webgl_error!($context, $call, ()); }; -} - -macro_rules! audio_param_impl( - ($struct:ident, $node_type:ident, $message_type:ident, $setter:ident) => ( - #[derive(JSTraceable, MallocSizeOf)] - struct $struct { - #[ignore_malloc_size_of = "Rc"] - context: Rc<AudioContext>, - #[ignore_malloc_size_of = "servo_media"] - node: NodeId, - } - - impl $struct { - pub fn new(context: Rc<AudioContext>, - node: NodeId) -> Self { - Self { - context, - node, - } - } - } - - impl AudioParamImpl for $struct { - 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) { - self.context.message_node( - self.node, - AudioNodeMessage::$node_type($message_type::$setter( - UserAutomationEvent::SetValueAtTime(value, start_time), - )), - ); - } - - fn ramp_to_value_at_time(&self, ramp_kind: RampKind, value: f32, end_time: f64) { - self.context.message_node( - self.node, - AudioNodeMessage::$node_type($message_type::$setter( - UserAutomationEvent::RampToValueAtTime(ramp_kind, value, end_time), - )), - ); - } - - fn set_target_at_time(&self, target: f32, start_time: f64, time_constant: f32) { - self.context.message_node( - self.node, - AudioNodeMessage::$node_type($message_type::$setter( - UserAutomationEvent::SetTargetAtTime(target, start_time, time_constant.into()), - )), - ); - } - - 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), - )), - ); - } - } - ); -); +}
\ No newline at end of file |