Bug 1324352 - Implement BaseAudioContext, r=padenot

This commit is contained in:
Andrea Marchesini 2016-12-20 20:20:41 +01:00
Родитель 3bcbbdcf40
Коммит ad79ef8d0a
32 изменённых файлов: 307 добавлений и 307 удалений

Просмотреть файл

@ -103,6 +103,10 @@ DOMInterfaces = {
'headerFile': 'mozilla/dom/BarProps.h',
},
'BaseAudioContext': {
'nativeType': 'mozilla::dom::AudioContext',
},
'Blob': {
'headerFile': 'mozilla/dom/File.h',
},

Просмотреть файл

@ -24,7 +24,7 @@
#include "AudioNodeExternalInputStream.h"
#include "MediaStreamListener.h"
#include "MediaStreamVideoSink.h"
#include "mozilla/dom/AudioContextBinding.h"
#include "mozilla/dom/BaseAudioContextBinding.h"
#include "mozilla/media/MediaUtils.h"
#include <algorithm>
#include "GeckoProfiler.h"

Просмотреть файл

@ -15,6 +15,7 @@
#include "mozilla/dom/AnalyserNodeBinding.h"
#include "mozilla/dom/AudioBufferSourceNodeBinding.h"
#include "mozilla/dom/AudioContextBinding.h"
#include "mozilla/dom/BaseAudioContextBinding.h"
#include "mozilla/dom/BiquadFilterNodeBinding.h"
#include "mozilla/dom/ChannelMergerNodeBinding.h"
#include "mozilla/dom/ChannelSplitterNodeBinding.h"
@ -29,6 +30,7 @@
#include "mozilla/dom/OfflineAudioContextBinding.h"
#include "mozilla/dom/OscillatorNodeBinding.h"
#include "mozilla/dom/PannerNodeBinding.h"
#include "mozilla/dom/PeriodicWaveBinding.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/StereoPannerNodeBinding.h"
#include "mozilla/dom/WaveShaperNodeBinding.h"

Просмотреть файл

@ -7,6 +7,7 @@
#include "MediaBufferDecoder.h"
#include "BufferDecoder.h"
#include "mozilla/dom/AudioContextBinding.h"
#include "mozilla/dom/BaseAudioContextBinding.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/ScriptSettings.h"
#include <speex/speex_resampler.h>

Просмотреть файл

@ -42,10 +42,6 @@ addLoadEvent(function() {
}
}
expectException(function() {
ctx.createMediaStreamDestination();
}, DOMException.NOT_SUPPORTED_ERR);
expectException(function() {
new OfflineAudioContext(2, 100, 0);
}, DOMException.NOT_SUPPORTED_ERR);

Просмотреть файл

@ -326,9 +326,7 @@ function testOfflineAudioContext() {
var o = new OfflineAudioContext(1, 44100, 44100);
is(o.state, "suspended", "OfflineAudioContext should start in suspended state.");
expectRejectedPromise(o, "suspend", "NotSupportedError");
expectRejectedPromise(o, "resume", "NotSupportedError");
expectRejectedPromise(o, "close", "NotSupportedError");
var previousState = o.state,
finishedRendering = false;

Просмотреть файл

@ -18,7 +18,7 @@ dictionary AnalyserOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional AnalyserOptions options)]
Constructor(BaseAudioContext context, optional AnalyserOptions options)]
interface AnalyserNode : AudioNode {
// Real-time frequency-domain data

Просмотреть файл

@ -17,7 +17,7 @@ dictionary AudioBufferOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, AudioBufferOptions options)]
Constructor(BaseAudioContext context, AudioBufferOptions options)]
interface AudioBuffer {
readonly attribute float sampleRate;

Просмотреть файл

@ -20,7 +20,7 @@ dictionary AudioBufferSourceOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional AudioBufferSourceOptions options)]
Constructor(BaseAudioContext context, optional AudioBufferSourceOptions options)]
interface AudioBufferSourceNode : AudioNode {
attribute AudioBuffer? buffer;

Просмотреть файл

@ -10,96 +10,29 @@
* liability, trademark and document use rules apply.
*/
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
callback DecodeErrorCallback = void (DOMException error);
enum AudioContextState {
"suspended",
"running",
"closed"
};
dictionary PeriodicWaveConstraints {
boolean disableNormalization = false;
};
[Constructor,
Constructor(AudioChannel audioChannelType),
Pref="dom.webaudio.enabled"]
interface AudioContext : EventTarget {
interface AudioContext : BaseAudioContext {
// Bug 1324545: readonly attribute double outputLatency;
// Bug 1324545: AudioTimestamp getOutputTimestamp ();
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
readonly attribute AudioContextState state;
[Throws]
Promise<void> suspend();
[Throws]
Promise<void> resume();
[Throws]
Promise<void> close();
attribute EventHandler onstatechange;
[NewObject, Throws]
AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate);
[NewObject, Throws, UnsafeInPrerendering]
MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
[Throws]
Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData,
optional DecodeSuccessCallback successCallback,
optional DecodeErrorCallback errorCallback);
[NewObject, Throws, UnsafeInPrerendering]
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
// AudioNode creation
[NewObject, Throws]
AudioBufferSourceNode createBufferSource();
[NewObject, Throws]
ConstantSourceNode createConstantSource();
// Bug 1324548: MediaStreamTrackAudioSourceNode createMediaStreamTrackSource (AudioMediaStreamTrack mediaStreamTrack);
[NewObject, Throws]
MediaStreamAudioDestinationNode createMediaStreamDestination();
[NewObject, Throws]
ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
optional unsigned long numberOfInputChannels = 2,
optional unsigned long numberOfOutputChannels = 2);
[NewObject, Throws]
StereoPannerNode createStereoPanner();
[NewObject, Throws]
AnalyserNode createAnalyser();
[NewObject, Throws, UnsafeInPrerendering]
MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
[NewObject, Throws, UnsafeInPrerendering]
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
[NewObject, Throws]
GainNode createGain();
[NewObject, Throws]
DelayNode createDelay(optional double maxDelayTime = 1);
[NewObject, Throws]
BiquadFilterNode createBiquadFilter();
[NewObject, Throws]
IIRFilterNode createIIRFilter(sequence<double> feedforward, sequence<double> feedback);
[NewObject, Throws]
WaveShaperNode createWaveShaper();
[NewObject, Throws]
PannerNode createPanner();
[NewObject, Throws]
ConvolverNode createConvolver();
[NewObject, Throws]
ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
[NewObject, Throws]
ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
[NewObject, Throws]
DynamicsCompressorNode createDynamicsCompressor();
[NewObject, Throws]
OscillatorNode createOscillator();
[NewObject, Throws]
PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag, optional PeriodicWaveConstraints constraints);
};
// Mozilla extensions

Просмотреть файл

@ -49,7 +49,7 @@ interface AudioNode : EventTarget {
[Throws]
void disconnect(AudioParam destination, unsigned long output);
readonly attribute AudioContext context;
readonly attribute BaseAudioContext context;
readonly attribute unsigned long numberOfInputs;
readonly attribute unsigned long numberOfOutputs;

Просмотреть файл

@ -0,0 +1,100 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#idl-def-BaseAudioContext
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
callback DecodeErrorCallback = void (DOMException error);
enum AudioContextState {
"suspended",
"running",
"closed"
};
interface BaseAudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
readonly attribute AudioContextState state;
// Bug 1324552: readonly attribute double baseLatency;
[Throws]
Promise<void> resume();
attribute EventHandler onstatechange;
[NewObject, Throws]
AudioBuffer createBuffer (unsigned long numberOfChannels,
unsigned long length,
float sampleRate);
[Throws]
Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData,
optional DecodeSuccessCallback successCallback,
optional DecodeErrorCallback errorCallback);
// AudioNode creation
[NewObject, Throws]
AudioBufferSourceNode createBufferSource();
[NewObject, Throws]
ConstantSourceNode createConstantSource();
[NewObject, Throws]
ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
optional unsigned long numberOfInputChannels = 2,
optional unsigned long numberOfOutputChannels = 2);
[NewObject, Throws]
AnalyserNode createAnalyser();
[NewObject, Throws]
GainNode createGain();
[NewObject, Throws]
DelayNode createDelay(optional double maxDelayTime = 1);
[NewObject, Throws]
BiquadFilterNode createBiquadFilter();
[NewObject, Throws]
IIRFilterNode createIIRFilter(sequence<double> feedforward, sequence<double> feedback);
[NewObject, Throws]
WaveShaperNode createWaveShaper();
[NewObject, Throws]
PannerNode createPanner();
[NewObject, Throws]
StereoPannerNode createStereoPanner();
[NewObject, Throws]
ConvolverNode createConvolver();
[NewObject, Throws]
ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
[NewObject, Throws]
ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
[NewObject, Throws]
DynamicsCompressorNode createDynamicsCompressor();
[NewObject, Throws]
OscillatorNode createOscillator();
[NewObject, Throws]
PeriodicWave createPeriodicWave(Float32Array real,
Float32Array imag,
optional PeriodicWaveConstraints constraints);
};

Просмотреть файл

@ -30,7 +30,7 @@ dictionary BiquadFilterOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional BiquadFilterOptions options)]
Constructor(BaseAudioContext context, optional BiquadFilterOptions options)]
interface BiquadFilterNode : AudioNode {
attribute BiquadFilterType type;

Просмотреть файл

@ -15,6 +15,6 @@ dictionary ChannelMergerOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional ChannelMergerOptions options)]
Constructor(BaseAudioContext context, optional ChannelMergerOptions options)]
interface ChannelMergerNode : AudioNode {
};

Просмотреть файл

@ -15,7 +15,7 @@ dictionary ChannelSplitterOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional ChannelSplitterOptions options)]
Constructor(BaseAudioContext context, optional ChannelSplitterOptions options)]
interface ChannelSplitterNode : AudioNode {
};

Просмотреть файл

@ -15,7 +15,7 @@ dictionary ConstantSourceOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional ConstantSourceOptions options)]
Constructor(BaseAudioContext context, optional ConstantSourceOptions options)]
interface ConstantSourceNode : AudioNode {
readonly attribute AudioParam offset;
attribute EventHandler onended;

Просмотреть файл

@ -16,7 +16,7 @@ dictionary ConvolverOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional ConvolverOptions options)]
Constructor(BaseAudioContext context, optional ConvolverOptions options)]
interface ConvolverNode : AudioNode {
[SetterThrows]

Просмотреть файл

@ -16,7 +16,7 @@ dictionary DelayOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional DelayOptions options)]
Constructor(BaseAudioContext context, optional DelayOptions options)]
interface DelayNode : AudioNode {
readonly attribute AudioParam delayTime;

Просмотреть файл

@ -19,7 +19,7 @@ dictionary DynamicsCompressorOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional DynamicsCompressorOptions options)]
Constructor(BaseAudioContext context, optional DynamicsCompressorOptions options)]
interface DynamicsCompressorNode : AudioNode {
readonly attribute AudioParam threshold; // in Decibels

Просмотреть файл

@ -15,7 +15,7 @@ dictionary GainOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional GainOptions options)]
Constructor(BaseAudioContext context, optional GainOptions options)]
interface GainNode : AudioNode {
readonly attribute AudioParam gain;

Просмотреть файл

@ -15,7 +15,7 @@ dictionary IIRFilterOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, IIRFilterOptions options)]
Constructor(BaseAudioContext context, IIRFilterOptions options)]
interface IIRFilterNode : AudioNode {
void getFrequencyResponse(Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse);
};

Просмотреть файл

@ -12,12 +12,13 @@
[Constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate),
Pref="dom.webaudio.enabled"]
interface OfflineAudioContext : AudioContext {
interface OfflineAudioContext : BaseAudioContext {
[Throws]
Promise<AudioBuffer> startRendering();
attribute EventHandler oncomplete;
readonly attribute unsigned long length;
// TODO: Promise<void> suspend (double suspendTime);
readonly attribute unsigned long length;
attribute EventHandler oncomplete;
};

Просмотреть файл

@ -26,7 +26,7 @@ dictionary OscillatorOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional OscillatorOptions options)]
Constructor(BaseAudioContext context, optional OscillatorOptions options)]
interface OscillatorNode : AudioNode {
[SetterThrows]

Просмотреть файл

@ -39,7 +39,7 @@ dictionary PannerOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional PannerOptions options)]
Constructor(BaseAudioContext context, optional PannerOptions options)]
interface PannerNode : AudioNode {
// Default for stereo is equalpower

Просмотреть файл

@ -10,6 +10,10 @@
* liability, trademark and document use rules apply.
*/
dictionary PeriodicWaveConstraints {
boolean disableNormalization = false;
};
dictionary PeriodicWaveOptions : PeriodicWaveConstraints {
sequence<float> real;
sequence<float> imag;
@ -19,6 +23,6 @@ dictionary PeriodicWaveOptions : PeriodicWaveConstraints {
// XXXbz The second arg is not optional in the spec, but that looks
// like a spec bug to me. See
// <https://github.com/WebAudio/web-audio-api/issues/1116>.
Constructor(AudioContext context, optional PeriodicWaveOptions options)]
Constructor(BaseAudioContext context, optional PeriodicWaveOptions options)]
interface PeriodicWave {
};

Просмотреть файл

@ -15,7 +15,7 @@ dictionary StereoPannerOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional StereoPannerOptions options)]
Constructor(BaseAudioContext context, optional StereoPannerOptions options)]
interface StereoPannerNode : AudioNode {
readonly attribute AudioParam pan;
};

Просмотреть файл

@ -22,7 +22,7 @@ dictionary WaveShaperOptions : AudioNodeOptions {
};
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional WaveShaperOptions options)]
Constructor(BaseAudioContext context, optional WaveShaperOptions options)]
interface WaveShaperNode : AudioNode {
[Cached, Pure, SetterThrows]

Просмотреть файл

@ -47,6 +47,7 @@ WEBIDL_FILES = [
'AudioWorkletGlobalScope.webidl',
'AutocompleteInfo.webidl',
'BarProp.webidl',
'BaseAudioContext.webidl',
'BaseKeyframeTypes.webidl',
'BatteryManager.webidl',
'BeforeAfterKeyboardEvent.webidl',

Просмотреть файл

@ -4,7 +4,7 @@
<title>AudioBuffer IDL Test</title>
<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script><script src="/resources/idlharness.js"></script><script src="/resources/WebIDLParser.js"></script><script src="/webaudio/js/lodash.js"></script><script src="/webaudio/js/vendor-prefixes.js"></script><script src="/webaudio/js/helpers.js"></script><style type="text/css">
#event-target-idl,
#audio-context-idl
#base-audio-context-idl
{ visibility:hidden; height: 0px;}
</style>
</head>
@ -25,52 +25,42 @@ callback interface EventListener {
interface EventListener {};
</pre>
<pre id="audio-context-idl">callback DecodeSuccessCallback = void (AudioBuffer decodedData);
callback DecodeErrorCallback = void (DOMException error);
[Constructor]
interface AudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate);
void decodeAudioData(ArrayBuffer audioData,
DecodeSuccessCallback successCallback,
optional DecodeErrorCallback errorCallback);
// AudioNode creation
AudioBufferSourceNode createBufferSource();
MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
MediaStreamAudioDestinationNode createMediaStreamDestination();
ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
optional unsigned long numberOfInputChannels = 2,
optional unsigned long numberOfOutputChannels = 2);
AnalyserNode createAnalyser();
GainNode createGain();
DelayNode createDelay(optional double maxDelayTime = 1.0);
BiquadFilterNode createBiquadFilter();
WaveShaperNode createWaveShaper();
PannerNode createPanner();
ConvolverNode createConvolver();
ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
DynamicsCompressorNode createDynamicsCompressor();
OscillatorNode createOscillator();
PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
<pre id="base-audio-context-idl">callback DecodeErrorCallback = void (DOMException error);
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
interface BaseAudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
readonly attribute AudioContextState state;
readonly attribute double baseLatency;
Promise<void> resume ();
attribute EventHandler onstatechange;
AudioBuffer createBuffer (unsigned long numberOfChannels, unsigned long length, float sampleRate);
Promise<AudioBuffer> decodeAudioData (ArrayBuffer audioData, optional DecodeSuccessCallback successCallback, optional DecodeErrorCallback errorCallback);
AudioBufferSourceNode createBufferSource ();
ConstantSourceNode createConstantSource ();
ScriptProcessorNode createScriptProcessor (optional unsigned long bufferSize = 0
, optional unsigned long numberOfInputChannels = 2
, optional unsigned long numberOfOutputChannels = 2
);
AnalyserNode createAnalyser ();
GainNode createGain ();
DelayNode createDelay (optional double maxDelayTime);
BiquadFilterNode createBiquadFilter ();
IIRFilterNode createIIRFilter (sequence<double> feedforward, sequence<double> feedback);
WaveShaperNode createWaveShaper ();
PannerNode createPanner ();
StereoPannerNode createStereoPanner ();
ConvolverNode createConvolver ();
ChannelSplitterNode createChannelSplitter (optional unsigned long numberOfOutputs = 6
);
ChannelMergerNode createChannelMerger (optional unsigned long numberOfInputs = 6
);
DynamicsCompressorNode createDynamicsCompressor ();
OscillatorNode createOscillator ();
PeriodicWave createPeriodicWave (Float32Array real, Float32Array imag, optional PeriodicWaveConstraints constraints);
};</pre>
<pre id="audio-buffer-idl">dictionary AudioBufferOptions {
@ -79,19 +69,17 @@ interface AudioContext : EventTarget {
float sampleRate;
};
[Constructor(AudioContext context, AudioBufferOptions options)]
[Constructor(BaseAudioContext context, AudioBufferOptions options)]
interface AudioBuffer {
readonly attribute float sampleRate;
readonly attribute long length;
// in seconds
readonly attribute double duration;
readonly attribute long numberOfChannels;
Float32Array getChannelData(unsigned long channel);
readonly attribute float sampleRate;
readonly attribute unsigned long length;
readonly attribute double duration;
readonly attribute unsigned long numberOfChannels;
Float32Array getChannelData (unsigned long channel);
void copyFromChannel (Float32Array destination, unsigned long channelNumber, optional unsigned long startInChannel = 0
);
void copyToChannel (Float32Array source, unsigned long channelNumber, optional unsigned long startInChannel = 0
);
};</pre>
<div id="log"></div>
@ -100,7 +88,7 @@ interface AudioBuffer {
(function() {
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById("event-target-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-context-idl").textContent);
idl_array.add_untested_idls(document.getElementById("base-audio-context-idl").textContent);
idl_array.add_idls(document.getElementById("audio-buffer-idl").textContent);
// For these tests the value of the arguments is unimportant.

Просмотреть файл

@ -4,7 +4,7 @@
<title>AudioDestinationNode IDL Test</title>
<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script><script src="/resources/idlharness.js"></script><script src="/resources/WebIDLParser.js"></script><script src="/webaudio/js/lodash.js"></script><script src="/webaudio/js/vendor-prefixes.js"></script><script src="/webaudio/js/helpers.js"></script><style type="text/css">
#event-target-idl,
#audio-context-idl,
#base-audio-context-idl,
#audio-node-idl
{ visibility:hidden; height: 0px;}
</style>
@ -26,52 +26,43 @@ callback interface EventListener {
interface EventListener {};
</pre>
<pre id="audio-context-idl">callback DecodeSuccessCallback = void (AudioBuffer decodedData);
callback DecodeErrorCallback = void (DOMException error);
<pre id="base-audio-context-idl">callback DecodeErrorCallback = void (DOMException error);
[Constructor]
interface AudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate);
void decodeAudioData(ArrayBuffer audioData,
DecodeSuccessCallback successCallback,
optional DecodeErrorCallback errorCallback);
// AudioNode creation
AudioBufferSourceNode createBufferSource();
MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
MediaStreamAudioDestinationNode createMediaStreamDestination();
ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
optional unsigned long numberOfInputChannels = 2,
optional unsigned long numberOfOutputChannels = 2);
AnalyserNode createAnalyser();
GainNode createGain();
DelayNode createDelay(optional double maxDelayTime = 1.0);
BiquadFilterNode createBiquadFilter();
WaveShaperNode createWaveShaper();
PannerNode createPanner();
ConvolverNode createConvolver();
ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
DynamicsCompressorNode createDynamicsCompressor();
OscillatorNode createOscillator();
PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
interface BaseAudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
readonly attribute AudioContextState state;
readonly attribute double baseLatency;
Promise<void> resume ();
attribute EventHandler onstatechange;
AudioBuffer createBuffer (unsigned long numberOfChannels, unsigned long length, float sampleRate);
Promise<AudioBuffer> decodeAudioData (ArrayBuffer audioData, optional DecodeSuccessCallback successCallback, optional DecodeErrorCallback errorCallback);
AudioBufferSourceNode createBufferSource ();
ConstantSourceNode createConstantSource ();
ScriptProcessorNode createScriptProcessor (optional unsigned long bufferSize = 0
, optional unsigned long numberOfInputChannels = 2
, optional unsigned long numberOfOutputChannels = 2
);
AnalyserNode createAnalyser ();
GainNode createGain ();
DelayNode createDelay (optional double maxDelayTime);
BiquadFilterNode createBiquadFilter ();
IIRFilterNode createIIRFilter (sequence<double> feedforward, sequence<double> feedback);
WaveShaperNode createWaveShaper ();
PannerNode createPanner ();
StereoPannerNode createStereoPanner ();
ConvolverNode createConvolver ();
ChannelSplitterNode createChannelSplitter (optional unsigned long numberOfOutputs = 6
);
ChannelMergerNode createChannelMerger (optional unsigned long numberOfInputs = 6
);
DynamicsCompressorNode createDynamicsCompressor ();
OscillatorNode createOscillator ();
PeriodicWave createPeriodicWave (Float32Array real, Float32Array imag, optional PeriodicWaveConstraints constraints);
};</pre>
<pre id="audio-node-idl">enum ChannelCountMode {
@ -91,7 +82,7 @@ interface AudioNode : EventTarget {
void connect(AudioParam destination, optional unsigned long output = 0);
void disconnect(optional unsigned long output = 0);
readonly attribute AudioContext context;
readonly attribute BaseAudioContext context;
readonly attribute unsigned long numberOfInputs;
readonly attribute unsigned long numberOfOutputs;
@ -114,7 +105,7 @@ interface AudioNode : EventTarget {
(function() {
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById("event-target-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-context-idl").textContent);
idl_array.add_untested_idls(document.getElementById("base-audio-context-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-node-idl").textContent);
idl_array.add_idls(document.getElementById("audio-destination-node-idl").textContent);

Просмотреть файл

@ -4,7 +4,7 @@
<title>DelayNode IDL Test</title>
<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script><script src="/resources/idlharness.js"></script><script src="/resources/WebIDLParser.js"></script><script src="/webaudio/js/lodash.js"></script><script src="/webaudio/js/vendor-prefixes.js"></script><script src="/webaudio/js/helpers.js"></script><style type="text/css">
#event-target-idl,
#audio-context-idl,
#base-audio-context-idl,
#audio-node-idl,
#audio-param-idl
{ visibility:hidden; height: 0px;}
@ -27,52 +27,43 @@ callback interface EventListener {
interface EventListener {};
</pre>
<pre id="audio-context-idl">callback DecodeSuccessCallback = void (AudioBuffer decodedData);
callback DecodeErrorCallback = void (DOMException error);
<pre id="base-audio-context-idl">callback DecodeSuccessCallback = void (AudioBuffer decodedData);
[Constructor]
interface AudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate);
void decodeAudioData(ArrayBuffer audioData,
DecodeSuccessCallback successCallback,
optional DecodeErrorCallback errorCallback);
// AudioNode creation
AudioBufferSourceNode createBufferSource();
MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
MediaStreamAudioDestinationNode createMediaStreamDestination();
ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
optional unsigned long numberOfInputChannels = 2,
optional unsigned long numberOfOutputChannels = 2);
AnalyserNode createAnalyser();
GainNode createGain();
DelayNode createDelay(optional double maxDelayTime = 1.0);
BiquadFilterNode createBiquadFilter();
WaveShaperNode createWaveShaper();
PannerNode createPanner();
ConvolverNode createConvolver();
ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
DynamicsCompressorNode createDynamicsCompressor();
OscillatorNode createOscillator();
PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
interface BaseAudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
readonly attribute AudioContextState state;
readonly attribute double baseLatency;
Promise<void> resume ();
attribute EventHandler onstatechange;
AudioBuffer createBuffer (unsigned long numberOfChannels, unsigned long length, float sampleRate);
Promise<AudioBuffer> decodeAudioData (ArrayBuffer audioData, optional DecodeSuccessCallback successCallback, optional DecodeErrorCallback errorCallback);
AudioBufferSourceNode createBufferSource ();
ConstantSourceNode createConstantSource ();
ScriptProcessorNode createScriptProcessor (optional unsigned long bufferSize = 0
, optional unsigned long numberOfInputChannels = 2
, optional unsigned long numberOfOutputChannels = 2
);
AnalyserNode createAnalyser ();
GainNode createGain ();
DelayNode createDelay (optional double maxDelayTime);
BiquadFilterNode createBiquadFilter ();
IIRFilterNode createIIRFilter (sequence<double> feedforward, sequence<double> feedback);
WaveShaperNode createWaveShaper ();
PannerNode createPanner ();
StereoPannerNode createStereoPanner ();
ConvolverNode createConvolver ();
ChannelSplitterNode createChannelSplitter (optional unsigned long numberOfOutputs = 6
);
ChannelMergerNode createChannelMerger (optional unsigned long numberOfInputs = 6
);
DynamicsCompressorNode createDynamicsCompressor ();
OscillatorNode createOscillator ();
PeriodicWave createPeriodicWave (Float32Array real, Float32Array imag, optional PeriodicWaveConstraints constraints);
};</pre>
<pre id="audio-node-idl">enum ChannelCountMode {
@ -92,7 +83,7 @@ interface AudioNode : EventTarget {
void connect(AudioParam destination, optional unsigned long output = 0);
void disconnect(optional unsigned long output = 0);
readonly attribute AudioContext context;
readonly attribute BaseAudioContext context;
readonly attribute unsigned long numberOfInputs;
readonly attribute unsigned long numberOfOutputs;
@ -130,7 +121,7 @@ interface AudioNode : EventTarget {
double delayTime = 0;
};
[Constructor(AudioContext context, optional DelayOptions options)]
[Constructor(BaseAudioContext context, optional DelayOptions options)]
interface DelayNode : AudioNode {
readonly attribute AudioParam delayTime;
@ -143,7 +134,7 @@ interface DelayNode : AudioNode {
(function() {
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById("event-target-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-context-idl").textContent);
idl_array.add_untested_idls(document.getElementById("base-audio-context-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-node-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-param-idl").textContent);
idl_array.add_idls(document.getElementById("delay-node-idl").textContent);

Просмотреть файл

@ -4,7 +4,7 @@
<title>GainNode IDL Test</title>
<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script><script src="/resources/idlharness.js"></script><script src="/resources/WebIDLParser.js"></script><script src="/webaudio/js/lodash.js"></script><script src="/webaudio/js/vendor-prefixes.js"></script><script src="/webaudio/js/helpers.js"></script><style type="text/css">
#event-target-idl,
#audio-context-idl,
#base-audio-context-idl,
#audio-node-idl,
#audio-param-idl
{ visibility:hidden; height: 0px;}
@ -27,52 +27,42 @@ callback interface EventListener {
interface EventListener {};
</pre>
<pre id="audio-context-idl">callback DecodeSuccessCallback = void (AudioBuffer decodedData);
callback DecodeErrorCallback = void (DOMException error);
[Constructor]
interface AudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate);
void decodeAudioData(ArrayBuffer audioData,
DecodeSuccessCallback successCallback,
optional DecodeErrorCallback errorCallback);
// AudioNode creation
AudioBufferSourceNode createBufferSource();
MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
MediaStreamAudioDestinationNode createMediaStreamDestination();
ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
optional unsigned long numberOfInputChannels = 2,
optional unsigned long numberOfOutputChannels = 2);
AnalyserNode createAnalyser();
GainNode createGain();
DelayNode createDelay(optional double maxDelayTime = 1.0);
BiquadFilterNode createBiquadFilter();
WaveShaperNode createWaveShaper();
PannerNode createPanner();
ConvolverNode createConvolver();
ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
DynamicsCompressorNode createDynamicsCompressor();
OscillatorNode createOscillator();
PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
<pre id="base-audio-context-idl">callback DecodeSuccessCallback = void (AudioBuffer decodedData);
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
interface BaseAudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
readonly attribute AudioContextState state;
readonly attribute double baseLatency;
Promise<void> resume ();
attribute EventHandler onstatechange;
AudioBuffer createBuffer (unsigned long numberOfChannels, unsigned long length, float sampleRate);
Promise<AudioBuffer> decodeAudioData (ArrayBuffer audioData, optional DecodeSuccessCallback successCallback, optional DecodeErrorCallback errorCallback);
AudioBufferSourceNode createBufferSource ();
ConstantSourceNode createConstantSource ();
ScriptProcessorNode createScriptProcessor (optional unsigned long bufferSize = 0
, optional unsigned long numberOfInputChannels = 2
, optional unsigned long numberOfOutputChannels = 2
);
AnalyserNode createAnalyser ();
GainNode createGain ();
DelayNode createDelay (optional double maxDelayTime);
BiquadFilterNode createBiquadFilter ();
IIRFilterNode createIIRFilter (sequence<double> feedforward, sequence<double> feedback);
WaveShaperNode createWaveShaper ();
PannerNode createPanner ();
StereoPannerNode createStereoPanner ();
ConvolverNode createConvolver ();
ChannelSplitterNode createChannelSplitter (optional unsigned long numberOfOutputs = 6
);
ChannelMergerNode createChannelMerger (optional unsigned long numberOfInputs = 6
);
DynamicsCompressorNode createDynamicsCompressor ();
OscillatorNode createOscillator ();
PeriodicWave createPeriodicWave (Float32Array real, Float32Array imag, optional PeriodicWaveConstraints constraints);
};</pre>
<pre id="audio-node-idl">enum ChannelCountMode {
@ -92,7 +82,7 @@ interface AudioNode : EventTarget {
void connect(AudioParam destination, optional unsigned long output = 0);
void disconnect(optional unsigned long output = 0);
readonly attribute AudioContext context;
readonly attribute BaseAudioContext context;
readonly attribute unsigned long numberOfInputs;
readonly attribute unsigned long numberOfOutputs;
@ -129,7 +119,7 @@ interface AudioNode : EventTarget {
float gain = 1.0;
};
[Constructor(AudioContext context, optional GainOptions options)]
[Constructor(BaseAudioContext context, optional GainOptions options)]
interface GainNode : AudioNode {
readonly attribute AudioParam gain;
@ -142,7 +132,7 @@ interface GainNode : AudioNode {
(function() {
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById("event-target-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-context-idl").textContent);
idl_array.add_untested_idls(document.getElementById("base-audio-context-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-node-idl").textContent);
idl_array.add_untested_idls(document.getElementById("audio-param-idl").textContent);
idl_array.add_idls(document.getElementById("gain-node-idl").textContent);