BaseAudioContext.CreateGain()

This commit is contained in:
Fernando Jiménez Moreno 2018-06-29 16:41:55 +02:00
parent 02c39eb9ef
commit 0e92efbb79
2 changed files with 11 additions and 1 deletions

View file

@ -8,6 +8,7 @@ use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation};
use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods;
use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState;
use dom::bindings::codegen::Bindings::GainNodeBinding::GainOptions;
use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorOptions;
use dom::bindings::error::{Error, ErrorResult};
use dom::bindings::inheritance::Castable;
@ -16,6 +17,7 @@ use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject;
use dom::bindings::root::DomRoot;
use dom::eventtarget::EventTarget;
use dom::gainnode::GainNode;
use dom::globalscope::GlobalScope;
use dom::oscillatornode::OscillatorNode;
use dom::promise::Promise;
@ -267,6 +269,14 @@ impl BaseAudioContextMethods for BaseAudioContext {
let options = unsafe { OscillatorOptions::empty(window.get_cx()) };
OscillatorNode::new(&window, &self, &options)
}
#[allow(unsafe_code)]
fn CreateGain(&self) -> DomRoot<GainNode> {
let global = self.global();
let window = global.as_window();
let options = unsafe { GainOptions::empty(window.get_cx()) };
GainNode::new(&window, &self, &options)
}
}
impl From<ProcessingState> for AudioContextState {

View file

@ -36,7 +36,7 @@ interface BaseAudioContext : EventTarget {
// optional unsigned long numberOfInputChannels = 2,
// optional unsigned long numberOfOutputChannels = 2);
// AnalyserNode createAnalyser();
// GainNode createGain();
GainNode createGain();
// DelayNode createDelay(optional double maxDelayTime = 1);
// BiquadFilterNode createBiquadFilter();
// IIRFilterNode createIIRFilter(sequence<double> feedforward,