Bug 1062849: Define AudioWorkletNode and AudioWorkletProcessor. WIP draft
authorJan-Ivar Bruaroey <jib@mozilla.com>
Fri, 26 May 2017 16:29:19 -0400
changeset 697798 714d61181ccf44692f84a416325ab7f4af701434
parent 697795 7a1e7727c7b6138859eaed51406e650a1cd1a0b8
child 740206 501e47455e97cd78d6707091694c9e74124ddb85
push id89096
push userjbruaroey@mozilla.com
push dateTue, 14 Nov 2017 18:00:29 +0000
bugs1062849
milestone59.0a1
Bug 1062849: Define AudioWorkletNode and AudioWorkletProcessor. WIP MozReview-Commit-ID: 1b6IXBBL3yX
dom/webidl/AudioParamMap.webidl
dom/webidl/AudioWorkletNode.webidl
dom/webidl/AudioWorkletProcessor.webidl
dom/webidl/moz.build
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AudioParamMap.webidl
@@ -0,0 +1,16 @@
+/* -*- 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/
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+[Pref="dom.audioworklet.enabled"]
+interface AudioParamMap {
+    readonly maplike<DOMString, AudioParam>;
+};
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AudioWorkletNode.webidl
@@ -0,0 +1,33 @@
+/* -*- 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/
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+dictionary AudioWorkletNodeOptions : AudioNodeOptions {
+             unsigned long             numberOfInputs = 1;
+             unsigned long             numberOfOutputs = 1;
+             object parameterData;
+};
+
+enum AudioWorkletProcessorState {
+    "pending",
+    "running",
+    "stopped",
+    "error"
+};
+
+[Pref="dom.audioworklet.enabled",
+ Constructor (BaseAudioContext context, optional AudioWorkletNodeOptions options)]
+interface AudioWorkletNode : AudioNode {
+    readonly        attribute AudioParamMap              parameters;
+    readonly        attribute MessagePort                port;
+    readonly        attribute AudioWorkletProcessorState processorState;
+                    attribute EventHandler               onprocessorstatechange;
+};
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AudioWorkletProcessor.webidl
@@ -0,0 +1,22 @@
+/* -*- 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/
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+dictionary AudioContextInfo {
+             double currentTime;
+             float  sampleRate;
+};
+
+[Pref="dom.audioworklet.enabled"]
+interface AudioWorkletProcessor {
+    AudioContextInfo getContextInfo ();
+    readonly        attribute MessagePort port;
+};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -397,22 +397,25 @@ WEBIDL_FILES = [
     'Attr.webidl',
     'AudioBuffer.webidl',
     'AudioBufferSourceNode.webidl',
     'AudioContext.webidl',
     'AudioDestinationNode.webidl',
     'AudioListener.webidl',
     'AudioNode.webidl',
     'AudioParam.webidl',
+    'AudioParamMap.webidl',
     'AudioProcessingEvent.webidl',
     'AudioScheduledSourceNode.webidl',
     'AudioStreamTrack.webidl',
     'AudioTrack.webidl',
     'AudioTrackList.webidl',
     'AudioWorkletGlobalScope.webidl',
+    'AudioWorkletNode.webidl',
+    'AudioWorkletProcessor.webidl',
     'AutocompleteInfo.webidl',
     'BarProp.webidl',
     'BaseAudioContext.webidl',
     'BaseKeyframeTypes.webidl',
     'BasicCardPayment.webidl',
     'BatteryManager.webidl',
     'BeforeUnloadEvent.webidl',
     'BiquadFilterNode.webidl',