diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2018-09-03 18:51:03 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2018-09-03 18:51:03 +0530 |
commit | 91b8cbe1db88bef90d280b5cff9bb43b1fb95281 (patch) | |
tree | 9ffc2283ee631e0ab3f468cd39502e1f5125bbaf | |
parent | eb6aec37e9bde5aba2a3dc6b6ce5374579219f31 (diff) | |
download | servo-91b8cbe1db88bef90d280b5cff9bb43b1fb95281.tar.gz servo-91b8cbe1db88bef90d280b5cff9bb43b1fb95281.zip |
Allow overriding GainNode's settings from the constructor
-rw-r--r-- | components/script/dom/gainnode.rs | 13 |
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 |