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 |
26 [ | 32 [ |
27 GarbageCollected, | 33 GarbageCollected, |
28 ActiveDOMObject, | 34 ActiveDOMObject, |
29 Conditional=WEB_AUDIO, | 35 Conditional=WEB_AUDIO, |
30 Constructor, | 36 Constructor, |
31 ConstructorCallWith=Document, | 37 ConstructorCallWith=Document, |
32 NoInterfaceObject, | 38 NoInterfaceObject, |
33 RaisesException=Constructor, | 39 RaisesException=Constructor, |
34 ] interface AudioContext : EventTarget { | 40 ] interface AudioContext : EventTarget { |
35 | |
36 // All rendered audio ultimately connects to destination, which represents t
he audio hardware. | 41 // All rendered audio ultimately connects to destination, which represents t
he audio hardware. |
37 readonly attribute AudioDestinationNode destination; | 42 readonly attribute AudioDestinationNode destination; |
38 | 43 |
39 // All scheduled times are relative to this time in seconds. | 44 // All scheduled times are relative to this time in seconds. |
40 readonly attribute double currentTime; | 45 readonly attribute double currentTime; |
41 | 46 |
42 // All AudioNodes in the context run at this sample-rate (sample-frames per
second). | 47 // All AudioNodes in the context run at this sample-rate (sample-frames per
second). |
43 readonly attribute float sampleRate; | 48 readonly attribute float sampleRate; |
44 | 49 |
45 // All panning is relative to this listener. | 50 // All panning is relative to this listener. |
46 readonly attribute AudioListener listener; | 51 readonly attribute AudioListener listener; |
47 | 52 |
| 53 // Current state of the AudioContext |
| 54 readonly attribute AudioContextState state; |
| 55 |
48 [RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, u
nsigned long numberOfFrames, float sampleRate); | 56 [RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, u
nsigned long numberOfFrames, float sampleRate); |
49 | 57 |
50 // Asynchronous audio file data decoding. | 58 // Asynchronous audio file data decoding. |
51 // FIXMEDART(ager): Auto-generate this custom method when the info about | 59 [RaisesException, MeasureAs=AudioContextDecodeAudioData] void decodeAudioDat
a(ArrayBuffer audioData, AudioBufferCallback successCallback, optional AudioBuff
erCallback errorCallback); |
52 // retaining typed arrays is in the IDL. | |
53 [RaisesException, DartCustom] void decodeAudioData(ArrayBuffer audioData, Au
dioBufferCallback successCallback, optional AudioBufferCallback errorCallback); | |
54 | 60 |
55 // Sources | 61 // Sources |
56 AudioBufferSourceNode createBufferSource(); | 62 [RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourc
eNode createBufferSource(); |
57 | 63 |
58 [RaisesException] MediaElementAudioSourceNode createMediaElementSource(HTMLM
ediaElement mediaElement); | 64 [RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaEleme
ntAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); |
59 | 65 |
60 [RaisesException] MediaStreamAudioSourceNode createMediaStreamSource(MediaSt
ream mediaStream); | 66 [RaisesException, MeasureAs=AudioContextCreateMediaStreamSource, RaisesExcep
tion] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream
); |
61 MediaStreamAudioDestinationNode createMediaStreamDestination(); | 67 [RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaS
treamAudioDestinationNode createMediaStreamDestination(); |
62 | 68 |
63 // Processing nodes | 69 // Processing nodes |
64 GainNode createGain(); | 70 [RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain(); |
65 [RaisesException] DelayNode createDelay(optional double maxDelayTime); | 71 [RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(o
ptional double maxDelayTime); |
66 BiquadFilterNode createBiquadFilter(); | 72 [RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode
createBiquadFilter(); |
67 WaveShaperNode createWaveShaper(); | 73 [RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode cre
ateWaveShaper(); |
68 PannerNode createPanner(); | 74 [RaisesException, MeasureAs=AudioContextCreatePanner] PannerNode createPanne
r(); |
69 ConvolverNode createConvolver(); | 75 [RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode creat
eConvolver(); |
70 DynamicsCompressorNode createDynamicsCompressor(); | 76 [RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCo
mpressorNode createDynamicsCompressor(); |
71 AnalyserNode createAnalyser(); | 77 [RaisesException, MeasureAs=AudioContextCreateAnalyser] AnalyserNode createA
nalyser(); |
72 [RaisesException] ScriptProcessorNode createScriptProcessor(optional unsigne
d long bufferSize, optional unsigned long numberOfInputChannels, optional unsign
ed long numberOfOutputChannels); | 78 [RaisesException, MeasureAs=AudioContextCreateScriptProcessor, RaisesExcepti
on] ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize,
optional unsigned long numberOfInputChannels, optional unsigned long numberOfOu
tputChannels); |
73 OscillatorNode createOscillator(); | 79 [RaisesException, MeasureAs=AudioContextCreateStereoPanner] StereoPannerNode
createStereoPanner(); |
74 [RaisesException] PeriodicWave createPeriodicWave(Float32Array real, Float32
Array imag); | 80 [RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode cre
ateOscillator(); |
| 81 [RaisesException, MeasureAs=AudioContextCreatePeriodicWave, RaisesException]
PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag); |
75 | 82 |
76 // Channel splitting and merging | 83 // Channel splitting and merging |
77 [RaisesException] ChannelSplitterNode createChannelSplitter(optional unsigne
d long numberOfOutputs); | 84 [RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitt
erNode createChannelSplitter(optional unsigned long numberOfOutputs); |
78 [RaisesException] ChannelMergerNode createChannelMerger(optional unsigned lo
ng numberOfInputs); | 85 [RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNo
de createChannelMerger(optional unsigned long numberOfInputs); |
79 | 86 |
80 // Offline rendering | 87 // Close |
81 // void prepareOfflineBufferRendering(unsigned long numberOfChannels, unsign
ed long numberOfFrames, float sampleRate); | 88 [MeasureAs=AudioContextClose, CallWith=ScriptState, ImplementedAs=closeConte
xt] Promise<void> close(); |
82 attribute EventHandler oncomplete; | 89 |
83 void startRendering(); | 90 // Pause/resume |
| 91 [MeasureAs=AudioContextSuspend, CallWith=ScriptState, ImplementedAs=suspendC
ontext] Promise<void> suspend(); |
| 92 [MeasureAs=AudioContextResume, CallWith=ScriptState, ImplementedAs=resumeCon
text] Promise<void> resume(); |
| 93 |
| 94 attribute EventHandler onstatechange; |
84 }; | 95 }; |
OLD | NEW |