OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 enum AudioContextState { | |
27 "suspended", | |
28 "running", | |
29 "closed" | |
30 }; | |
31 | |
32 [ | 26 [ |
33 ActiveScriptWrappable, | 27 ActiveScriptWrappable, |
34 Constructor, | 28 Constructor, |
35 ConstructorCallWith=Document, | 29 ConstructorCallWith=Document, |
36 DependentLifetime, | 30 DependentLifetime, |
37 ImplementedAs=BaseAudioContext, | |
38 NoInterfaceObject, | 31 NoInterfaceObject, |
39 RaisesException=Constructor, | 32 RaisesException=Constructor, |
40 ] interface AudioContext : EventTarget { | 33 ] interface AudioContext : BaseAudioContext { |
41 // All rendered audio ultimately connects to destination, which represents t
he audio hardware. | |
42 readonly attribute AudioDestinationNode destination; | |
43 | |
44 // All scheduled times are relative to this time in seconds. | |
45 readonly attribute double currentTime; | |
46 | |
47 // All AudioNodes in the context run at this sample-rate (sample-frames per
second). | |
48 readonly attribute float sampleRate; | |
49 | |
50 // All panning is relative to this listener. | |
51 readonly attribute AudioListener listener; | |
52 | |
53 // Current state of the AudioContext | |
54 readonly attribute AudioContextState state; | |
55 | |
56 [RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, u
nsigned long numberOfFrames, float sampleRate); | |
57 | |
58 // Asynchronous audio file data decoding. | |
59 [RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptStat
e] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional AudioBuf
ferCallback successCallback, optional AudioBufferCallback errorCallback); | |
60 | |
61 // Sources | 34 // Sources |
62 [RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourc
eNode createBufferSource(); | 35 // TODO(rtoy): The following methods should be here instead of in BaseAudioC
ontext: |
63 | 36 // |
64 [RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaEleme
ntAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); | 37 // createMediaElementSource(HTMLMediaElement mediaElement) |
65 | 38 // createMediaStreamSource(MediaStream mediaStream) |
66 [RaisesException, MeasureAs=AudioContextCreateMediaStreamSource] MediaStream
AudioSourceNode createMediaStreamSource(MediaStream mediaStream); | 39 // createMediaStreamDestination() |
67 [RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaS
treamAudioDestinationNode createMediaStreamDestination(); | |
68 | |
69 // Processing nodes | |
70 [RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain(); | |
71 [RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(o
ptional double maxDelayTime); | |
72 [RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode
createBiquadFilter(); | |
73 [RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode creat
eIIRFilter(sequence<double> feedForward, sequence<double> feedBack); | |
74 [RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode cre
ateWaveShaper(); | |
75 [RaisesException, MeasureAs=AudioContextCreatePannerAutomated] PannerNode cr
eatePanner(); | |
76 [RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode creat
eConvolver(); | |
77 [RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCo
mpressorNode createDynamicsCompressor(); | |
78 [RaisesException, MeasureAs=AudioContextCreateAnalyser] AnalyserNode createA
nalyser(); | |
79 [RaisesException, MeasureAs=AudioContextCreateScriptProcessor] ScriptProcess
orNode createScriptProcessor(optional unsigned long bufferSize, optional unsigne
d long numberOfInputChannels, optional unsigned long numberOfOutputChannels); | |
80 [RaisesException, MeasureAs=AudioContextCreateStereoPanner] StereoPannerNode
createStereoPanner(); | |
81 [RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode cre
ateOscillator(); | |
82 [RaisesException, MeasureAs=AudioContextCreatePeriodicWave] PeriodicWave cre
atePeriodicWave(Float32Array real, Float32Array imag, optional PeriodicWaveConst
raints options); | |
83 | |
84 // Channel splitting and merging | |
85 [RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitt
erNode createChannelSplitter(optional unsigned long numberOfOutputs); | |
86 [RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNo
de createChannelMerger(optional unsigned long numberOfInputs); | |
87 | |
88 // Close | |
89 [MeasureAs=AudioContextClose, CallWith=ScriptState, ImplementedAs=closeConte
xt] Promise<void> close(); | |
90 | |
91 // Pause/resume | |
92 [MeasureAs=AudioContextSuspend, CallWith=ScriptState, ImplementedAs=suspendC
ontext] Promise<void> suspend(); | |
93 [MeasureAs=AudioContextResume, CallWith=ScriptState, ImplementedAs=resumeCon
text] Promise<void> resume(); | |
94 | |
95 attribute EventHandler onstatechange; | |
96 }; | 40 }; |
OLD | NEW |