mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Get destination node engine from context
This commit is contained in:
parent
1c2d872e33
commit
07c0450e29
4 changed files with 15 additions and 3 deletions
|
@ -21,7 +21,9 @@ impl AudioDestinationNode {
|
|||
fn new_inherited(context: &BaseAudioContext,
|
||||
options: &AudioNodeOptions) -> AudioDestinationNode {
|
||||
AudioDestinationNode {
|
||||
node: AudioNode::new_inherited(AudioNodeType::DestinationNode, context, options, 1, 1),
|
||||
node: AudioNode::new_inherited(AudioNodeType::DestinationNode,
|
||||
Some(context.destination_node()),
|
||||
context, options, 1, 1),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,13 +34,17 @@ pub struct AudioNode {
|
|||
|
||||
impl AudioNode {
|
||||
pub fn new_inherited(node_type: AudioNodeType,
|
||||
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)
|
||||
});
|
||||
AudioNode {
|
||||
reflector_: Reflector::new(),
|
||||
node_id: context.audio_context_impl().create_node(node_type),
|
||||
node_id,
|
||||
context: DomRoot::from_ref(context),
|
||||
number_of_inputs,
|
||||
number_of_outputs,
|
||||
|
|
|
@ -21,7 +21,8 @@ impl AudioScheduledSourceNode {
|
|||
number_of_inputs: u32,
|
||||
number_of_outputs: u32) -> AudioScheduledSourceNode {
|
||||
AudioScheduledSourceNode {
|
||||
node: AudioNode::new_inherited(node_type, context, options, number_of_inputs, number_of_outputs),
|
||||
node: AudioNode::new_inherited(node_type, None /* node_id */,
|
||||
context, options, number_of_inputs, number_of_outputs),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ use dom_struct::dom_struct;
|
|||
use servo_media::ServoMedia;
|
||||
use servo_media::audio::context::{AudioContext, ProcessingState};
|
||||
use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioContextOptions};
|
||||
use servo_media::audio::graph::NodeId;
|
||||
use std::cell::Cell;
|
||||
use std::collections::VecDeque;
|
||||
use std::mem;
|
||||
|
@ -96,6 +97,10 @@ impl BaseAudioContext {
|
|||
&self.audio_context_impl
|
||||
}
|
||||
|
||||
pub fn destination_node(&self) -> NodeId {
|
||||
self.audio_context_impl.dest_node()
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#allowed-to-start
|
||||
pub fn is_allowed_to_start(&self) -> bool {
|
||||
self.state.get() == AudioContextState::Suspended
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue