aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/oscillatornode.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-09-11 17:07:10 +0530
committerManish Goregaokar <manishsmail@gmail.com>2018-09-11 19:24:01 +0530
commit9254606b014cdfed6f4a1eaf6eb8e656e1c2422b (patch)
tree0e6daa55ba816cea03814ca7892fc278f789d17d /components/script/dom/oscillatornode.rs
parent9779ce3b88f9c1e15e0ab785740e6a630ba5cbb1 (diff)
downloadservo-9254606b014cdfed6f4a1eaf6eb8e656e1c2422b.tar.gz
servo-9254606b014cdfed6f4a1eaf6eb8e656e1c2422b.zip
Pass down ChannelInfo to create_node
Diffstat (limited to 'components/script/dom/oscillatornode.rs')
-rw-r--r--components/script/dom/oscillatornode.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs
index 662724c4438..6f6ce8b9f72 100644
--- a/components/script/dom/oscillatornode.rs
+++ b/components/script/dom/oscillatornode.rs
@@ -6,7 +6,6 @@ use dom::audioparam::AudioParam;
use dom::audioscheduledsourcenode::AudioScheduledSourceNode;
use dom::baseaudiocontext::BaseAudioContext;
use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation};
-use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
use dom::bindings::codegen::Bindings::OscillatorNodeBinding::{self, OscillatorOptions, OscillatorType};
use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorNodeMethods;
@@ -34,16 +33,15 @@ impl OscillatorNode {
pub fn new_inherited(
window: &Window,
context: &BaseAudioContext,
- oscillator_options: &OscillatorOptions,
+ options: &OscillatorOptions,
) -> Fallible<OscillatorNode> {
- let mut node_options = AudioNodeOptions::empty();
- node_options.channelCount = Some(2);
- node_options.channelCountMode = Some(ChannelCountMode::Max);
- node_options.channelInterpretation = Some(ChannelInterpretation::Speakers);
+ let node_options = options.parent
+ .unwrap_or(2, ChannelCountMode::Max,
+ ChannelInterpretation::Speakers);
let source_node = AudioScheduledSourceNode::new_inherited(
- AudioNodeInit::OscillatorNode(oscillator_options.into()),
+ AudioNodeInit::OscillatorNode(options.into()),
context,
- &node_options,
+ node_options,
0, /* inputs */
1, /* outputs */
)?;
@@ -71,7 +69,7 @@ impl OscillatorNode {
Ok(OscillatorNode {
source_node,
- oscillator_type: oscillator_options.type_,
+ oscillator_type: options.type_,
frequency: Dom::from_ref(&frequency),
detune: Dom::from_ref(&detune),
})