Skip to content

Commit

Permalink
Add createAnalyser
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Sep 18, 2018
1 parent aa2ccb3 commit 9dfc578
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions components/script/dom/baseaudiocontext.rs
Expand Up @@ -2,13 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::analysernode::AnalyserNode;
use dom::audiobuffer::AudioBuffer;
use dom::audiobuffersourcenode::AudioBufferSourceNode;
use dom::audiodestinationnode::AudioDestinationNode;
use dom::audiolistener::AudioListener;
use dom::audionode::MAX_CHANNEL_COUNT;
use dom::bindings::callback::ExceptionHandling;
use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::AnalyserNodeBinding::AnalyserOptions;
use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions;
use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation};
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
Expand Down Expand Up @@ -337,6 +339,11 @@ impl BaseAudioContextMethods for BaseAudioContext {
PannerNode::new(&self.global().as_window(), &self, &PannerOptions::empty())
}

/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createanalyser
fn CreateAnalyser(&self) -> Fallible<DomRoot<AnalyserNode>> {
AnalyserNode::new(&self.global().as_window(), &self, &AnalyserOptions::empty())
}

/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createchannelmerger
fn CreateChannelMerger(&self, count: u32) -> Fallible<DomRoot<ChannelMergerNode>> {
let mut opts = ChannelMergerOptions::empty();
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/BaseAudioContext.webidl
Expand Up @@ -35,7 +35,7 @@ interface BaseAudioContext : EventTarget {
// ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
// optional unsigned long numberOfInputChannels = 2,
// optional unsigned long numberOfOutputChannels = 2);
// AnalyserNode createAnalyser();
[Throws] AnalyserNode createAnalyser();
[Throws] GainNode createGain();
// DelayNode createDelay(optional double maxDelayTime = 1);
// BiquadFilterNode createBiquadFilter();
Expand Down

0 comments on commit 9dfc578

Please sign in to comment.