1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/AudioContext.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,83 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + * 1.9 + * The origin of this IDL file is 1.10 + * https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html 1.11 + * 1.12 + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C 1.13 + * liability, trademark and document use rules apply. 1.14 + */ 1.15 + 1.16 +callback DecodeSuccessCallback = void (AudioBuffer decodedData); 1.17 +callback DecodeErrorCallback = void (); 1.18 + 1.19 +[Constructor, 1.20 + Constructor(AudioChannel audioChannelType)] 1.21 +interface AudioContext : EventTarget { 1.22 + 1.23 + readonly attribute AudioDestinationNode destination; 1.24 + readonly attribute float sampleRate; 1.25 + readonly attribute double currentTime; 1.26 + readonly attribute AudioListener listener; 1.27 + 1.28 + [NewObject, Throws] 1.29 + AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate); 1.30 + 1.31 + void decodeAudioData(ArrayBuffer audioData, 1.32 + DecodeSuccessCallback successCallback, 1.33 + optional DecodeErrorCallback errorCallback); 1.34 + 1.35 + // AudioNode creation 1.36 + [NewObject] 1.37 + AudioBufferSourceNode createBufferSource(); 1.38 + 1.39 + [NewObject, Throws] 1.40 + MediaStreamAudioDestinationNode createMediaStreamDestination(); 1.41 + 1.42 + [NewObject, Throws] 1.43 + ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, 1.44 + optional unsigned long numberOfInputChannels = 2, 1.45 + optional unsigned long numberOfOutputChannels = 2); 1.46 + 1.47 + [NewObject] 1.48 + AnalyserNode createAnalyser(); 1.49 + [NewObject, Throws] 1.50 + MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); 1.51 + [NewObject, Throws] 1.52 + MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); 1.53 + [NewObject] 1.54 + GainNode createGain(); 1.55 + [NewObject, Throws] 1.56 + DelayNode createDelay(optional double maxDelayTime = 1); 1.57 + [NewObject] 1.58 + BiquadFilterNode createBiquadFilter(); 1.59 + [NewObject] 1.60 + WaveShaperNode createWaveShaper(); 1.61 + [NewObject] 1.62 + PannerNode createPanner(); 1.63 + [NewObject] 1.64 + ConvolverNode createConvolver(); 1.65 + 1.66 + [NewObject, Throws] 1.67 + ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); 1.68 + [NewObject, Throws] 1.69 + ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); 1.70 + 1.71 + [NewObject] 1.72 + DynamicsCompressorNode createDynamicsCompressor(); 1.73 + 1.74 + [NewObject] 1.75 + OscillatorNode createOscillator(); 1.76 + [NewObject, Throws] 1.77 + PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag); 1.78 + 1.79 +}; 1.80 + 1.81 +// Mozilla extensions 1.82 +partial interface AudioContext { 1.83 + // Read AudioChannel.webidl for more information about this attribute. 1.84 + [Pref="media.useAudioChannelService", SetterThrows] 1.85 + attribute AudioChannel mozAudioChannelType; 1.86 +};