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/oscillatornode.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/oscillatornode.rs')
-rw-r--r-- | components/script/dom/oscillatornode.rs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index adb9cc778bc..131b76fd616 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -2,7 +2,7 @@ * License, v.2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::audioparam::{AudioParam, AudioParamImpl}; +use dom::audioparam::AudioParam; use dom::audioscheduledsourcenode::AudioScheduledSourceNode; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; @@ -15,18 +15,11 @@ use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::{Dom, DomRoot}; use dom::window::Window; use dom_struct::dom_struct; -use servo_media::audio::context::AudioContext; -use servo_media::audio::graph::NodeId; -use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; +use servo_media::audio::node::AudioNodeInit; use servo_media::audio::oscillator_node::OscillatorNodeOptions as ServoMediaOscillatorOptions; use servo_media::audio::oscillator_node::OscillatorType as ServoMediaOscillatorType; -use servo_media::audio::oscillator_node::OscillatorNodeMessage; -use servo_media::audio::param::{UserAutomationEvent, RampKind}; +use servo_media::audio::param::ParamType; use std::f32; -use std::rc::Rc; - -audio_param_impl!(Frequency, OscillatorNode, OscillatorNodeMessage, SetFrequency); -audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune); #[dom_struct] pub struct OscillatorNode { @@ -48,21 +41,23 @@ impl OscillatorNode { node_options.channelCountMode = Some(ChannelCountMode::Max); node_options.channelInterpretation = Some(ChannelInterpretation::Speakers); let source_node = AudioScheduledSourceNode::new_inherited( - AudioNodeType::OscillatorNode(oscillator_options.into()), + AudioNodeInit::OscillatorNode(oscillator_options.into()), context, &node_options, 0, /* inputs */ 1, /* outputs */ ); let node_id = source_node.node().node_id(); - let frequency = Frequency::new(context.audio_context_impl(), node_id); let frequency = AudioParam::new(window, - Box::new(frequency), + context, + node_id, + ParamType::Frequency, AutomationRate::A_rate, 440., f32::MIN, f32::MAX); - let detune = Detune::new(context.audio_context_impl(), node_id); let detune = AudioParam::new(window, - Box::new(detune), + context, + node_id, + ParamType::Detune, AutomationRate::A_rate, 0., -440. / 2., 440. / 2.); |