mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Allow overriding GainNode's settings from the constructor
This commit is contained in:
parent
eb6aec37e9
commit
91b8cbe1db
1 changed files with 8 additions and 5 deletions
|
@ -30,14 +30,17 @@ impl GainNode {
|
||||||
pub fn new_inherited(
|
pub fn new_inherited(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
gain_options: &GainOptions,
|
options: &GainOptions,
|
||||||
) -> GainNode {
|
) -> GainNode {
|
||||||
let mut node_options = AudioNodeOptions::empty();
|
let mut node_options = AudioNodeOptions::empty();
|
||||||
node_options.channelCount = Some(2);
|
let count = options.parent.channelCount.unwrap_or(2);
|
||||||
node_options.channelCountMode = Some(ChannelCountMode::Max);
|
let mode = options.parent.channelCountMode.unwrap_or(ChannelCountMode::Max);
|
||||||
node_options.channelInterpretation = Some(ChannelInterpretation::Speakers);
|
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(
|
let node = AudioNode::new_inherited(
|
||||||
AudioNodeInit::GainNode(gain_options.into()),
|
AudioNodeInit::GainNode(options.into()),
|
||||||
context,
|
context,
|
||||||
&node_options,
|
&node_options,
|
||||||
1, // inputs
|
1, // inputs
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue