| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // See https://webaudio.github.io/web-audio-api/#BaseAudioContext | 5 // See https://webaudio.github.io/web-audio-api/#BaseAudioContext |
| 6 | |
| 7 enum AudioContextState { | 6 enum AudioContextState { |
| 8 "suspended", | 7 "suspended", |
| 9 "running", | 8 "running", |
| 10 "closed" | 9 "closed" |
| 11 }; | 10 }; |
| 12 | 11 |
| 13 callback DecodeErrorCallback = void (DOMException error); | |
| 14 callback DecodeSuccessCallback = void (AudioBuffer decodedData); | |
| 15 | |
| 16 [ | 12 [ |
| 17 ActiveScriptWrappable, | 13 ActiveScriptWrappable, |
| 18 DependentLifetime, | 14 DependentLifetime, |
| 19 ] interface BaseAudioContext : EventTarget { | 15 ] interface BaseAudioContext : EventTarget { |
| 20 // 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. |
| 21 readonly attribute AudioDestinationNode destination; | 17 readonly attribute AudioDestinationNode destination; |
| 22 | 18 |
| 23 // All scheduled times are relative to this time in seconds. | 19 // All scheduled times are relative to this time in seconds. |
| 24 readonly attribute double currentTime; | 20 readonly attribute double currentTime; |
| 25 | 21 |
| 26 // 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). |
| 27 readonly attribute float sampleRate; | 23 readonly attribute float sampleRate; |
| 28 | 24 |
| 29 // All panning is relative to this listener. | 25 // All panning is relative to this listener. |
| 30 readonly attribute AudioListener listener; | 26 readonly attribute AudioListener listener; |
| 31 | 27 |
| 32 // Current state of the AudioContext | 28 // Current state of the AudioContext |
| 33 readonly attribute AudioContextState state; | 29 readonly attribute AudioContextState state; |
| 34 | 30 |
| 35 [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); |
| 36 | 32 |
| 37 // Asynchronous audio file data decoding. | 33 // Asynchronous audio file data decoding. |
| 38 [RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptStat
e] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional DecodeSu
ccessCallback successCallback, optional DecodeErrorCallback errorCallback); | 34 [RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptStat
e] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional AudioBuf
ferCallback successCallback, optional AudioBufferCallback errorCallback); |
| 39 | 35 |
| 40 // Sources | 36 // Sources |
| 41 [RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourc
eNode createBufferSource(); | 37 [RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourc
eNode createBufferSource(); |
| 42 [RaisesException, MeasureAs=AudioContextCreateConstantSource] ConstantSource
Node createConstantSource(); | 38 [RaisesException, MeasureAs=AudioContextCreateConstantSource] ConstantSource
Node createConstantSource(); |
| 43 | 39 |
| 44 // Processing nodes | 40 // Processing nodes |
| 45 [RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain(); | 41 [RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain(); |
| 46 [RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(o
ptional double maxDelayTime); | 42 [RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(o
ptional double maxDelayTime); |
| 47 [RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode
createBiquadFilter(); | 43 [RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode
createBiquadFilter(); |
| 48 [RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode creat
eIIRFilter(sequence<double> feedForward, sequence<double> feedBack); | 44 [RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode creat
eIIRFilter(sequence<double> feedForward, sequence<double> feedBack); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 [MeasureAs=AudioContextResume, CallWith=ScriptState, ImplementedAs=resumeCon
text] Promise<void> resume(); | 60 [MeasureAs=AudioContextResume, CallWith=ScriptState, ImplementedAs=resumeCon
text] Promise<void> resume(); |
| 65 | 61 |
| 66 // TODO(rtoy): These really belong to the AudioContext, but we need them | 62 // TODO(rtoy): These really belong to the AudioContext, but we need them |
| 67 // here so we can use an offline audio context to test these. | 63 // here so we can use an offline audio context to test these. |
| 68 [RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaEleme
ntAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); | 64 [RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaEleme
ntAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); |
| 69 [RaisesException, MeasureAs=AudioContextCreateMediaStreamSource] MediaStream
AudioSourceNode createMediaStreamSource(MediaStream mediaStream); | 65 [RaisesException, MeasureAs=AudioContextCreateMediaStreamSource] MediaStream
AudioSourceNode createMediaStreamSource(MediaStream mediaStream); |
| 70 [RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaS
treamAudioDestinationNode createMediaStreamDestination(); | 66 [RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaS
treamAudioDestinationNode createMediaStreamDestination(); |
| 71 | 67 |
| 72 attribute EventHandler onstatechange; | 68 attribute EventHandler onstatechange; |
| 73 }; | 69 }; |
| OLD | NEW |