mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
createBufferSource and buffer setter on buffer source node
This commit is contained in:
parent
25a74a75ea
commit
356d7fd7a6
9 changed files with 152 additions and 62 deletions
|
@ -30,7 +30,7 @@ audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune);
|
|||
|
||||
#[dom_struct]
|
||||
pub struct OscillatorNode {
|
||||
node: AudioScheduledSourceNode,
|
||||
source_node: AudioScheduledSourceNode,
|
||||
oscillator_type: OscillatorType,
|
||||
frequency: DomRoot<AudioParam>,
|
||||
detune: DomRoot<AudioParam>,
|
||||
|
@ -48,26 +48,27 @@ impl OscillatorNode {
|
|||
node_options.channelCount = Some(2);
|
||||
node_options.channelCountMode = Some(ChannelCountMode::Max);
|
||||
node_options.channelInterpretation = Some(ChannelInterpretation::Speakers);
|
||||
let node = AudioScheduledSourceNode::new_inherited(
|
||||
let source_node = AudioScheduledSourceNode::new_inherited(
|
||||
AudioNodeType::OscillatorNode(oscillator_options.into()),
|
||||
context,
|
||||
&node_options,
|
||||
0, /* inputs */
|
||||
1, /* outputs */
|
||||
);
|
||||
let frequency = Frequency::new(context.audio_context_impl(), node.node_id());
|
||||
let node_id = source_node.node().node_id();
|
||||
let frequency = Frequency::new(context.audio_context_impl(), node_id);
|
||||
let frequency = AudioParam::new(window,
|
||||
Box::new(frequency),
|
||||
AutomationRate::A_rate,
|
||||
440., f32::MIN, f32::MAX);
|
||||
let detune = Detune::new(context.audio_context_impl(), node.node_id());
|
||||
let detune = Detune::new(context.audio_context_impl(), node_id);
|
||||
let detune = AudioParam::new(window,
|
||||
Box::new(detune),
|
||||
AutomationRate::A_rate,
|
||||
0., -440. / 2., 440. / 2.);
|
||||
|
||||
OscillatorNode {
|
||||
node,
|
||||
source_node,
|
||||
oscillator_type: oscillator_options.type_,
|
||||
frequency,
|
||||
detune,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue