aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-09-03 18:51:03 +0530
committerManish Goregaokar <manishsmail@gmail.com>2018-09-03 18:51:03 +0530
commit91b8cbe1db88bef90d280b5cff9bb43b1fb95281 (patch)
tree9ffc2283ee631e0ab3f468cd39502e1f5125bbaf
parenteb6aec37e9bde5aba2a3dc6b6ce5374579219f31 (diff)
downloadservo-91b8cbe1db88bef90d280b5cff9bb43b1fb95281.tar.gz
servo-91b8cbe1db88bef90d280b5cff9bb43b1fb95281.zip
Allow overriding GainNode's settings from the constructor
-rw-r--r--components/script/dom/gainnode.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs
index 5cdbd8a89c9..17c32b00352 100644
--- a/components/script/dom/gainnode.rs
+++ b/components/script/dom/gainnode.rs
@@ -30,14 +30,17 @@ impl GainNode {
pub fn new_inherited(
window: &Window,
context: &BaseAudioContext,
- gain_options: &GainOptions,
+ options: &GainOptions,
) -> GainNode {
let mut node_options = AudioNodeOptions::empty();
- node_options.channelCount = Some(2);
- node_options.channelCountMode = Some(ChannelCountMode::Max);
- node_options.channelInterpretation = Some(ChannelInterpretation::Speakers);
+ 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 = AudioNode::new_inherited(
- AudioNodeInit::GainNode(gain_options.into()),
+ AudioNodeInit::GainNode(options.into()),
context,
&node_options,
1, // inputs