diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-09-12 19:11:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 19:11:03 -0400 |
commit | cd02ca6c191f61865eafb4c62af532b19db53030 (patch) | |
tree | b4098ec83b2da1682393edcda295348c9e14ff54 /components/script/dom/gainnode.rs | |
parent | 26745b27419f687dec1e23434a5be827d4342768 (diff) | |
parent | 831201cc1b1665d082d931ac77a5aec13cd333a6 (diff) | |
download | servo-cd02ca6c191f61865eafb4c62af532b19db53030.tar.gz servo-cd02ca6c191f61865eafb4c62af532b19db53030.zip |
Auto merge of #21674 - Manishearth:channel-count, r=ferjm
Pass through channel settings in AudioNode constructor
Most audionodes let you pass in channel count/etc settings in their
constructors, and have different defaults. Using the `create_node`
argument added in https://github.com/servo/media/pull/124 , this passes
that information through.
r? @ferjm.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21674)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/gainnode.rs')
-rw-r--r-- | components/script/dom/gainnode.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index a48cdc7c86b..1b4859e28e5 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -6,7 +6,6 @@ use dom::audionode::AudioNode; use dom::audioparam::AudioParam; 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::GainNodeBinding::{self, GainNodeMethods, GainOptions}; use dom::bindings::error::Fallible; @@ -32,17 +31,13 @@ impl GainNode { context: &BaseAudioContext, options: &GainOptions, ) -> Fallible<GainNode> { - let mut node_options = AudioNodeOptions::empty(); - let count = options.parent.channelCount.unwrap_or(2); - let mode = options.parent.channelCountMode.unwrap_or(ChannelCountMode::Max); - let interpretation = options.parent.channelInterpretation.unwrap_or(ChannelInterpretation::Speakers); - node_options.channelCount = Some(count); - node_options.channelCountMode = Some(mode); - node_options.channelInterpretation = Some(interpretation); + let node_options = options.parent + .unwrap_or(2, ChannelCountMode::Max, + ChannelInterpretation::Speakers); let node = AudioNode::new_inherited( AudioNodeInit::GainNode(options.into()), context, - &node_options, + node_options, 1, // inputs 1, // outputs )?; |