aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webidls
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2017-11-07 20:57:30 +0100
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2018-07-30 14:21:36 +0200
commit7ee42e4223dc970aeffc56ecddec2738c8340f8c (patch)
tree1f53a3dc650992ab7b84c9a9e0e748d11ca97a7d /components/script/dom/webidls
parentde48f25d0b0b5ecaf0499030f8617a3d37b3fde2 (diff)
downloadservo-7ee42e4223dc970aeffc56ecddec2738c8340f8c.tar.gz
servo-7ee42e4223dc970aeffc56ecddec2738c8340f8c.zip
Initial WebAudio API stubs
Diffstat (limited to 'components/script/dom/webidls')
-rw-r--r--components/script/dom/webidls/AudioContext.webidl40
-rw-r--r--components/script/dom/webidls/AudioDestinationNode.webidl12
-rw-r--r--components/script/dom/webidls/AudioNode.webidl61
-rw-r--r--components/script/dom/webidls/AudioParam.webidl26
-rw-r--r--components/script/dom/webidls/AudioScheduledSourceNode.webidl14
-rw-r--r--components/script/dom/webidls/BaseAudioContext.webidl55
-rw-r--r--components/script/dom/webidls/OscillatorNode.webidl34
-rw-r--r--components/script/dom/webidls/PeriodicWave.webidl21
8 files changed, 263 insertions, 0 deletions
diff --git a/components/script/dom/webidls/AudioContext.webidl b/components/script/dom/webidls/AudioContext.webidl
new file mode 100644
index 00000000000..07de08f7ac0
--- /dev/null
+++ b/components/script/dom/webidls/AudioContext.webidl
@@ -0,0 +1,40 @@
+/* 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/#dom-audiocontext
+ */
+
+enum AudioContextLatencyCategory {
+ "balanced",
+ "interactive",
+ "playback"
+};
+
+dictionary AudioContextOptions {
+ AudioContextLatencyCategory latencyHint = "interactive";
+ float sampleRate;
+};
+
+dictionary AudioTimestamp {
+ double contextTime;
+ DOMHighResTimeStamp performanceTime;
+};
+
+[Exposed=Window,
+ Constructor(optional AudioContextOptions contextOptions)]
+interface AudioContext : BaseAudioContext {
+ readonly attribute double baseLatency;
+ readonly attribute double outputLatency;
+
+ AudioTimestamp getOutputTimestamp();
+
+ Promise<void> suspend();
+ Promise<void> close();
+
+ // MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
+ // MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
+ // MediaStreamTrackAudioSourceNode createMediaStreamTrackSource(MediaStreamTrack mediaStreamTrack);
+ // MediaStreamAudioDestinationNode createMediaStreamDestination();
+};
diff --git a/components/script/dom/webidls/AudioDestinationNode.webidl b/components/script/dom/webidls/AudioDestinationNode.webidl
new file mode 100644
index 00000000000..c9b2a06fb44
--- /dev/null
+++ b/components/script/dom/webidls/AudioDestinationNode.webidl
@@ -0,0 +1,12 @@
+/* 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/#dom-audiodestinationnode
+ */
+
+[Exposed=Window]
+interface AudioDestinationNode : AudioNode {
+ readonly attribute unsigned long maxChannelCount;
+};
diff --git a/components/script/dom/webidls/AudioNode.webidl b/components/script/dom/webidls/AudioNode.webidl
new file mode 100644
index 00000000000..78b68a6cebf
--- /dev/null
+++ b/components/script/dom/webidls/AudioNode.webidl
@@ -0,0 +1,61 @@
+/* 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/#dom-audionode
+ */
+
+enum ChannelCountMode {
+ "max",
+ "clamped-max",
+ "explicit"
+};
+
+enum ChannelInterpretation {
+ "speakers",
+ "discrete"
+};
+
+dictionary AudioNodeOptions {
+ unsigned long channelCount;
+ ChannelCountMode channelCountMode;
+ ChannelInterpretation channelInterpretation;
+};
+
+[Exposed=Window]
+interface AudioNode : EventTarget {
+ [Throws]
+ AudioNode connect(AudioNode destinationNode,
+ optional unsigned long output = 0,
+ optional unsigned long input = 0);
+ [Throws]
+ void connect(AudioParam destinationParam,
+ optional unsigned long output = 0);
+ [Throws]
+ void disconnect();
+ [Throws]
+ void disconnect(unsigned long output);
+ [Throws]
+ void disconnect(AudioNode destination);
+ [Throws]
+ void disconnect(AudioNode destination, unsigned long output);
+ [Throws]
+ void disconnect(AudioNode destination,
+ unsigned long output,
+ unsigned long input);
+ [Throws]
+ void disconnect(AudioParam destination);
+ [Throws]
+ void disconnect(AudioParam destination, unsigned long output);
+
+ readonly attribute BaseAudioContext context;
+ readonly attribute unsigned long numberOfInputs;
+ readonly attribute unsigned long numberOfOutputs;
+
+ [SetterThrows]
+ attribute unsigned long channelCount;
+ [SetterThrows]
+ attribute ChannelCountMode channelCountMode;
+ attribute ChannelInterpretation channelInterpretation;
+};
diff --git a/components/script/dom/webidls/AudioParam.webidl b/components/script/dom/webidls/AudioParam.webidl
new file mode 100644
index 00000000000..3c0c4870c2b
--- /dev/null
+++ b/components/script/dom/webidls/AudioParam.webidl
@@ -0,0 +1,26 @@
+/* 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/#dom-audioparam
+ */
+
+[Exposed=Window]
+interface AudioParam {
+ attribute float value;
+ readonly attribute float defaultValue;
+ readonly attribute float minValue;
+ readonly attribute float maxValue;
+// AudioParam setValueAtTime(float value, double startTime);
+// AudioParam linearRampToValueAtTime(float value, double endTime);
+// AudioParam exponentialRampToValueAtTime(float value, double endTime);
+// AudioParam setTargetAtTime(float target,
+// double startTime,
+// float timeConstant);
+// AudioParam setValueCurveAtTime(sequence<float> values,
+// double startTime,
+// double duration);
+// AudioParam cancelScheduledValues(double cancelTime);
+// AudioParam cancelAndHoldAtTime(double cancelTime);
+};
diff --git a/components/script/dom/webidls/AudioScheduledSourceNode.webidl b/components/script/dom/webidls/AudioScheduledSourceNode.webidl
new file mode 100644
index 00000000000..8e058b129cc
--- /dev/null
+++ b/components/script/dom/webidls/AudioScheduledSourceNode.webidl
@@ -0,0 +1,14 @@
+/* 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/#AudioScheduledSourceNode
+ */
+
+[Exposed=Window]
+interface AudioScheduledSourceNode : AudioNode {
+ attribute EventHandler onended;
+ void start(optional double when = 0);
+ void stop(optional double when = 0);
+};
diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl
new file mode 100644
index 00000000000..288b5771fdc
--- /dev/null
+++ b/components/script/dom/webidls/BaseAudioContext.webidl
@@ -0,0 +1,55 @@
+/* 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/#BaseAudioContext
+ */
+
+enum AudioContextState {
+ "suspended",
+ "running",
+ "closed"
+};
+
+// callback DecodeErrorCallback = void (DOMException error);
+// callback DecodeSuccessCallback = void (AudioBuffer decodedData);
+
+[Exposed=Window]
+interface BaseAudioContext : EventTarget {
+ readonly attribute AudioDestinationNode destination;
+ readonly attribute float sampleRate;
+ readonly attribute double currentTime;
+ // readonly attribute AudioListener listener;
+ // readonly attribute AudioContextState state;
+ 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 = 1);
+ // 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(sequence<float> real,
+ // sequence<float> imag,
+ // optional PeriodicWaveConstraints constraints);
+};
diff --git a/components/script/dom/webidls/OscillatorNode.webidl b/components/script/dom/webidls/OscillatorNode.webidl
new file mode 100644
index 00000000000..30197d2248c
--- /dev/null
+++ b/components/script/dom/webidls/OscillatorNode.webidl
@@ -0,0 +1,34 @@
+/* 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/#oscillatornode
+ */
+
+enum OscillatorType {
+ "sine",
+ "square",
+ "sawtooth",
+ "triangle",
+ "custom"
+};
+
+dictionary OscillatorOptions : AudioNodeOptions {
+ OscillatorType type = "sine";
+ float frequency = 440;
+ float detune = 0;
+ PeriodicWave periodicWave;
+};
+
+[Exposed=Window,
+ Constructor (BaseAudioContext context, optional OscillatorOptions options)]
+interface OscillatorNode : AudioScheduledSourceNode {
+/* [SetterThrows]
+ attribute OscillatorType type;
+
+ readonly attribute AudioParam frequency;
+ readonly attribute AudioParam detune;
+
+ void setPeriodicWave (PeriodicWave periodicWave);*/
+};
diff --git a/components/script/dom/webidls/PeriodicWave.webidl b/components/script/dom/webidls/PeriodicWave.webidl
new file mode 100644
index 00000000000..63ec5981235
--- /dev/null
+++ b/components/script/dom/webidls/PeriodicWave.webidl
@@ -0,0 +1,21 @@
+/* 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/#periodicwave
+ */
+
+dictionary PeriodicWaveConstraints {
+ boolean disableNormalization = false;
+};
+
+dictionary PeriodicWaveOptions : PeriodicWaveConstraints {
+ sequence<float> real;
+ sequence<float> imag;
+};
+
+[Exposed=Window,
+ Constructor(BaseAudioContext context, optional PeriodicWaveOptions options)]
+interface PeriodicWave {
+};