OLD | NEW |
---|---|
1 /* | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 // Use of this source code is governed by a BSD-style license that can be |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 // found in the LICENSE file. |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * | |
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 | |
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 | |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
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 | |
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 | |
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 */ | |
25 | 4 |
26 enum AudioContextState { | 5 enum AudioContextState { |
27 "suspended", | 6 "suspended", |
28 "running", | 7 "running", |
29 "closed" | 8 "closed" |
30 }; | 9 }; |
31 | 10 |
32 [ | 11 [ |
33 ActiveScriptWrappable, | 12 ActiveScriptWrappable, |
34 Constructor, | |
35 ConstructorCallWith=Document, | |
36 DependentLifetime, | 13 DependentLifetime, |
37 ImplementedAs=BaseAudioContext, | |
38 NoInterfaceObject, | 14 NoInterfaceObject, |
39 RaisesException=Constructor, | 15 ] interface BaseAudioContext : EventTarget { |
40 ] interface AudioContext : EventTarget { | |
41 // All rendered audio ultimately connects to destination, which represents t he audio hardware. | 16 // All rendered audio ultimately connects to destination, which represents t he audio hardware. |
42 readonly attribute AudioDestinationNode destination; | 17 readonly attribute AudioDestinationNode destination; |
43 | 18 |
44 // All scheduled times are relative to this time in seconds. | 19 // All scheduled times are relative to this time in seconds. |
45 readonly attribute double currentTime; | 20 readonly attribute double currentTime; |
46 | 21 |
47 // All AudioNodes in the context run at this sample-rate (sample-frames per second). | 22 // All AudioNodes in the context run at this sample-rate (sample-frames per second). |
48 readonly attribute float sampleRate; | 23 readonly attribute float sampleRate; |
49 | 24 |
50 // All panning is relative to this listener. | 25 // All panning is relative to this listener. |
51 readonly attribute AudioListener listener; | 26 readonly attribute AudioListener listener; |
52 | 27 |
53 // Current state of the AudioContext | 28 // Current state of the AudioContext |
54 readonly attribute AudioContextState state; | 29 readonly attribute AudioContextState state; |
55 | 30 |
56 [RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, u nsigned long numberOfFrames, float sampleRate); | 31 [RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, u nsigned long numberOfFrames, float sampleRate); |
57 | 32 |
58 // Asynchronous audio file data decoding. | 33 // Asynchronous audio file data decoding. |
59 [RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptStat e] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional AudioBuf ferCallback successCallback, optional AudioBufferCallback errorCallback); | 34 [RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptStat e] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional AudioBuf ferCallback successCallback, optional AudioBufferCallback errorCallback); |
60 | 35 |
61 // Sources | 36 // Sources |
62 [RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourc eNode createBufferSource(); | 37 [RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourc eNode createBufferSource(); |
63 | 38 |
64 [RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaEleme ntAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); | |
65 | |
66 [RaisesException, MeasureAs=AudioContextCreateMediaStreamSource] MediaStream AudioSourceNode createMediaStreamSource(MediaStream mediaStream); | |
67 [RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaS treamAudioDestinationNode createMediaStreamDestination(); | |
68 | |
69 // Processing nodes | 39 // Processing nodes |
70 [RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain(); | 40 [RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain(); |
71 [RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(o ptional double maxDelayTime); | 41 [RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(o ptional double maxDelayTime); |
72 [RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode createBiquadFilter(); | 42 [RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode createBiquadFilter(); |
73 [RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode creat eIIRFilter(sequence<double> feedForward, sequence<double> feedBack); | 43 [RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode creat eIIRFilter(sequence<double> feedForward, sequence<double> feedBack); |
74 [RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode cre ateWaveShaper(); | 44 [RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode cre ateWaveShaper(); |
75 [RaisesException, MeasureAs=AudioContextCreatePannerAutomated] PannerNode cr eatePanner(); | 45 [RaisesException, MeasureAs=AudioContextCreatePannerAutomated] PannerNode cr eatePanner(); |
76 [RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode creat eConvolver(); | 46 [RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode creat eConvolver(); |
77 [RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCo mpressorNode createDynamicsCompressor(); | 47 [RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCo mpressorNode createDynamicsCompressor(); |
78 [RaisesException, MeasureAs=AudioContextCreateAnalyser] AnalyserNode createA nalyser(); | 48 [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); | 49 [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(); | 50 [RaisesException, MeasureAs=AudioContextCreateStereoPanner] StereoPannerNode createStereoPanner(); |
81 [RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode cre ateOscillator(); | 51 [RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode cre ateOscillator(); |
82 [RaisesException, MeasureAs=AudioContextCreatePeriodicWave] PeriodicWave cre atePeriodicWave(Float32Array real, Float32Array imag, optional PeriodicWaveConst raints options); | 52 [RaisesException, MeasureAs=AudioContextCreatePeriodicWave] PeriodicWave cre atePeriodicWave(Float32Array real, Float32Array imag, optional PeriodicWaveConst raints options); |
83 | 53 |
84 // Channel splitting and merging | 54 // Channel splitting and merging |
85 [RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitt erNode createChannelSplitter(optional unsigned long numberOfOutputs); | 55 [RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitt erNode createChannelSplitter(optional unsigned long numberOfOutputs); |
86 [RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNo de createChannelMerger(optional unsigned long numberOfInputs); | 56 [RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNo de createChannelMerger(optional unsigned long numberOfInputs); |
87 | 57 |
88 // Close | 58 // Close |
89 [MeasureAs=AudioContextClose, CallWith=ScriptState, ImplementedAs=closeConte xt] Promise<void> close(); | 59 [MeasureAs=AudioContextClose, CallWith=ScriptState, ImplementedAs=closeConte xt] Promise<void> close(); |
90 | 60 |
91 // Pause/resume | 61 // Pause/resume |
92 [MeasureAs=AudioContextSuspend, CallWith=ScriptState, ImplementedAs=suspendC ontext] Promise<void> suspend(); | 62 [MeasureAs=AudioContextSuspend, CallWith=ScriptState, ImplementedAs=suspendC ontext] Promise<void> suspend(); |
93 [MeasureAs=AudioContextResume, CallWith=ScriptState, ImplementedAs=resumeCon text] Promise<void> resume(); | 63 [MeasureAs=AudioContextResume, CallWith=ScriptState, ImplementedAs=resumeCon text] Promise<void> resume(); |
94 | 64 |
65 // TODO(rtoy): These really belong to the AudioContext, but we need them | |
66 // here so we can use an offline audio context to test these. | |
hongchan
2016/09/01 20:39:44
I think the tests in this CL is using AudioContext
Raymond Toy
2016/09/01 20:51:37
It's the CORS tests that use the offline audio con
| |
67 [RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaEleme ntAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); | |
68 [RaisesException, MeasureAs=AudioContextCreateMediaStreamSource] MediaStream AudioSourceNode createMediaStreamSource(MediaStream mediaStream); | |
69 [RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaS treamAudioDestinationNode createMediaStreamDestination(); | |
70 | |
95 attribute EventHandler onstatechange; | 71 attribute EventHandler onstatechange; |
96 }; | 72 }; |
OLD | NEW |