Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AudioListener/AudioPanner DOM interfaces #21502

Merged
merged 12 commits into from Aug 25, 2018
Next

Upgrade to latest servo-media

  • Loading branch information
Manishearth committed Aug 23, 2018
commit 4b48cfa3ecd95298428a2d1d377a5a16020cc65b

Some generated files are not rendered by default. Learn more.

@@ -10,7 +10,6 @@ use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::root::DomRoot;
use dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
use servo_media::audio::node::AudioNodeInit;

#[dom_struct]
pub struct AudioDestinationNode {
@@ -23,9 +22,8 @@ impl AudioDestinationNode {
options: &AudioNodeOptions,
) -> AudioDestinationNode {
AudioDestinationNode {
node: AudioNode::new_inherited(
AudioNodeInit::DestinationNode,
Some(context.destination_node()),
node: AudioNode::new_inherited_for_id(
context.destination_node(),
context,
options,
1,
@@ -36,17 +36,26 @@ pub struct AudioNode {
channel_interpretation: Cell<ChannelInterpretation>,
}


impl AudioNode {
pub fn new_inherited(
node_type: AudioNodeInit,
node_id: Option<NodeId>,
context: &BaseAudioContext,
options: &AudioNodeOptions,
number_of_inputs: u32,
number_of_outputs: u32,
) -> AudioNode {
let node_id =
node_id.unwrap_or_else(|| context.audio_context_impl().create_node(node_type));
let node_id = context.audio_context_impl().create_node(node_type);
AudioNode::new_inherited_for_id(node_id, context, options, number_of_inputs, number_of_outputs)
}

pub fn new_inherited_for_id(
node_id: NodeId,
context: &BaseAudioContext,
options: &AudioNodeOptions,
number_of_inputs: u32,
number_of_outputs: u32,
) -> AudioNode {
AudioNode {
eventtarget: EventTarget::new_inherited(),
node_id,
@@ -34,7 +34,6 @@ impl AudioScheduledSourceNode {
AudioScheduledSourceNode {
node: AudioNode::new_inherited(
node_type,
None, /* node_id */
context,
options,
number_of_inputs,
@@ -38,7 +38,6 @@ impl GainNode {
node_options.channelInterpretation = Some(ChannelInterpretation::Speakers);
let node = AudioNode::new_inherited(
AudioNodeInit::GainNode(gain_options.into()),
None,
context,
&node_options,
1, // inputs
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.