michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * The origin of this IDL file is michael@0: * https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html michael@0: * michael@0: * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C michael@0: * liability, trademark and document use rules apply. michael@0: */ michael@0: michael@0: callback DecodeSuccessCallback = void (AudioBuffer decodedData); michael@0: callback DecodeErrorCallback = void (); michael@0: michael@0: [Constructor, michael@0: Constructor(AudioChannel audioChannelType)] michael@0: interface AudioContext : EventTarget { michael@0: michael@0: readonly attribute AudioDestinationNode destination; michael@0: readonly attribute float sampleRate; michael@0: readonly attribute double currentTime; michael@0: readonly attribute AudioListener listener; michael@0: michael@0: [NewObject, Throws] michael@0: AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate); michael@0: michael@0: void decodeAudioData(ArrayBuffer audioData, michael@0: DecodeSuccessCallback successCallback, michael@0: optional DecodeErrorCallback errorCallback); michael@0: michael@0: // AudioNode creation michael@0: [NewObject] michael@0: AudioBufferSourceNode createBufferSource(); michael@0: michael@0: [NewObject, Throws] michael@0: MediaStreamAudioDestinationNode createMediaStreamDestination(); michael@0: michael@0: [NewObject, Throws] michael@0: ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, michael@0: optional unsigned long numberOfInputChannels = 2, michael@0: optional unsigned long numberOfOutputChannels = 2); michael@0: michael@0: [NewObject] michael@0: AnalyserNode createAnalyser(); michael@0: [NewObject, Throws] michael@0: MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); michael@0: [NewObject, Throws] michael@0: MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); michael@0: [NewObject] michael@0: GainNode createGain(); michael@0: [NewObject, Throws] michael@0: DelayNode createDelay(optional double maxDelayTime = 1); michael@0: [NewObject] michael@0: BiquadFilterNode createBiquadFilter(); michael@0: [NewObject] michael@0: WaveShaperNode createWaveShaper(); michael@0: [NewObject] michael@0: PannerNode createPanner(); michael@0: [NewObject] michael@0: ConvolverNode createConvolver(); michael@0: michael@0: [NewObject, Throws] michael@0: ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); michael@0: [NewObject, Throws] michael@0: ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); michael@0: michael@0: [NewObject] michael@0: DynamicsCompressorNode createDynamicsCompressor(); michael@0: michael@0: [NewObject] michael@0: OscillatorNode createOscillator(); michael@0: [NewObject, Throws] michael@0: PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag); michael@0: michael@0: }; michael@0: michael@0: // Mozilla extensions michael@0: partial interface AudioContext { michael@0: // Read AudioChannel.webidl for more information about this attribute. michael@0: [Pref="media.useAudioChannelService", SetterThrows] michael@0: attribute AudioChannel mozAudioChannelType; michael@0: };