mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Use new params impl (#4)
* AudioNodeType -> AudioNodeInit * Use new param type system, clean up
This commit is contained in:
parent
8f9a081ff0
commit
f0d04249f9
9 changed files with 113 additions and 146 deletions
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::audionode::AudioNode;
|
||||
use dom::audioparam::{AudioParam, AudioParamImpl};
|
||||
use dom::audioparam::AudioParam;
|
||||
use dom::baseaudiocontext::BaseAudioContext;
|
||||
use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
|
@ -14,15 +14,10 @@ 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::gain_node::{GainNodeMessage, GainNodeOptions};
|
||||
use servo_media::audio::graph::NodeId;
|
||||
use servo_media::audio::node::{AudioNodeMessage, AudioNodeType};
|
||||
use servo_media::audio::param::{UserAutomationEvent, RampKind};
|
||||
use servo_media::audio::gain_node::GainNodeOptions;
|
||||
use servo_media::audio::node::AudioNodeInit;
|
||||
use servo_media::audio::param::ParamType;
|
||||
use std::f32;
|
||||
use std::rc::Rc;
|
||||
|
||||
audio_param_impl!(Gain, GainNode, GainNodeMessage, SetGain);
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GainNode {
|
||||
|
@ -42,16 +37,17 @@ impl GainNode {
|
|||
node_options.channelCountMode = Some(ChannelCountMode::Max);
|
||||
node_options.channelInterpretation = Some(ChannelInterpretation::Speakers);
|
||||
let node = AudioNode::new_inherited(
|
||||
AudioNodeType::GainNode(gain_options.into()),
|
||||
AudioNodeInit::GainNode(gain_options.into()),
|
||||
None,
|
||||
context,
|
||||
&node_options,
|
||||
1, // inputs
|
||||
1, // outputs
|
||||
);
|
||||
let gain = Gain::new(context.audio_context_impl(), node.node_id());
|
||||
let gain = AudioParam::new(window,
|
||||
Box::new(gain),
|
||||
context,
|
||||
node.node_id(),
|
||||
ParamType::Gain,
|
||||
AutomationRate::A_rate,
|
||||
1., // default value
|
||||
f32::MIN, // min value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue