Bug 792646 - Implement the skeleton of Web Audio source and destination nodes; r=bzbarsky
☠☠ backed out by 904a52466167 ☠ ☠
authorEhsan Akhgari <ehsan.akhgari@gmail.com>
Tue, 18 Sep 2012 19:07:33 -0400
changeset 107657 7d077641695596c33bf9401b28b24fa8236174fd
parent 107656 3f5309a5b66eaae754ff9c6422d03a295ae72a42
child 107658 78ff52eb09d996600a297ae1dba091177df43953
push id15159
push usereakhgari@mozilla.com
push dateThu, 20 Sep 2012 22:35:30 +0000
treeherdermozilla-inbound@7d0776416955 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs792646, 792649
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 792646 - Implement the skeleton of Web Audio source and destination nodes; r=bzbarsky This is the bare minimum that one needs in order to get those interfaces implemented. The work to make the simplest of Web Audio test cases actually pass will be done in bug 792649.
content/media/webaudio/AudioBufferSourceNode.cpp
content/media/webaudio/AudioBufferSourceNode.h
content/media/webaudio/AudioContext.cpp
content/media/webaudio/AudioContext.h
content/media/webaudio/AudioDestinationNode.cpp
content/media/webaudio/AudioDestinationNode.h
content/media/webaudio/AudioNode.cpp
content/media/webaudio/AudioNode.h
content/media/webaudio/AudioSourceNode.cpp
content/media/webaudio/AudioSourceNode.h
content/media/webaudio/EnableWebAudioCheck.h
content/media/webaudio/Makefile.in
dom/bindings/Bindings.conf
dom/bindings/stubgenerator/Skeleton.h
dom/webidl/AudioBufferSourceNode.webidl
dom/webidl/AudioContext.webidl
dom/webidl/AudioDestinationNode.webidl
dom/webidl/AudioNode.webidl
dom/webidl/AudioSourceNode.webidl
dom/webidl/WebIDL.mk
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/AudioBufferSourceNode.cpp
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#include "AudioBufferSourceNode.h"
+#include "mozilla/dom/AudioBufferSourceNodeBinding.h"
+
+namespace mozilla {
+namespace dom {
+
+NS_IMPL_ISUPPORTS_INHERITED0(AudioBufferSourceNode, AudioSourceNode)
+
+AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
+  : AudioSourceNode(aContext)
+{
+}
+
+JSObject*
+AudioBufferSourceNode::WrapObject(JSContext* aCx, JSObject* aScope,
+                                  bool* aTriedToWrap)
+{
+  return AudioBufferSourceNodeBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
+}
+}
+
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/AudioBufferSourceNode.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#pragma once
+
+#include "AudioSourceNode.h"
+
+namespace mozilla {
+namespace dom {
+
+class AudioBufferSourceNode : public AudioSourceNode
+{
+public:
+  explicit AudioBufferSourceNode(AudioContext* aContext);
+
+  NS_DECL_ISUPPORTS_INHERITED
+
+  void NoteOn(double) { /* no-op for now */ }
+  void NoteOff(double) { /* no-op for now */ }
+
+  virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
+                               bool* aTriedToWrap);
+
+};
+
+}
+}
+
--- a/content/media/webaudio/AudioContext.cpp
+++ b/content/media/webaudio/AudioContext.cpp
@@ -4,30 +4,33 @@
  * 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/. */
 
 #include "AudioContext.h"
 #include "nsContentUtils.h"
 #include "nsIDOMWindow.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/AudioContextBinding.h"
+#include "AudioDestinationNode.h"
+#include "AudioBufferSourceNode.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(AudioContext, mWindow)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(AudioContext)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(AudioContext)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AudioContext)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 AudioContext::AudioContext(nsIDOMWindow* aWindow)
   : mWindow(aWindow)
+  , mDestination(new AudioDestinationNode(this))
 {
   SetIsDOMBinding();
 }
 
 AudioContext::~AudioContext()
 {
 }
 
@@ -47,11 +50,19 @@ AudioContext::Constructor(nsISupports* a
     return nullptr;
   }
 
   AudioContext* object = new AudioContext(window);
   NS_ADDREF(object);
   return object;
 }
 
+already_AddRefed<AudioBufferSourceNode>
+AudioContext::CreateBufferSource()
+{
+  nsRefPtr<AudioBufferSourceNode> bufferNode =
+    new AudioBufferSourceNode(this);
+  return bufferNode.forget();
+}
+
 }
 }
 
--- a/content/media/webaudio/AudioContext.h
+++ b/content/media/webaudio/AudioContext.h
@@ -1,29 +1,35 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
+#pragma once
+
 #include "nsWrapperCache.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/Attributes.h"
 #include "nsCOMPtr.h"
 #include "EnableWebAudioCheck.h"
+#include "nsAutoPtr.h"
 
 class JSContext;
 class nsIDOMWindow;
 
 namespace mozilla {
 
 class ErrorResult;
 
 namespace dom {
 
+class AudioDestinationNode;
+class AudioBufferSourceNode;
+
 class AudioContext MOZ_FINAL : public nsISupports,
                                public nsWrapperCache,
                                public EnableWebAudioCheck
 {
   explicit AudioContext(nsIDOMWindow* aParentWindow);
 
 public:
   virtual ~AudioContext();
@@ -37,15 +43,23 @@ public:
   }
 
   virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
                                bool* aTriedToWrap);
 
   static already_AddRefed<AudioContext>
   Constructor(nsISupports* aGlobal, ErrorResult& aRv);
 
+  AudioDestinationNode* Destination() const
+  {
+    return mDestination;
+  }
+
+  already_AddRefed<AudioBufferSourceNode> CreateBufferSource();
+
 private:
   nsCOMPtr<nsIDOMWindow> mWindow;
+  nsRefPtr<AudioDestinationNode> mDestination;
 };
 
 }
 }
 
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/AudioDestinationNode.cpp
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#include "AudioDestinationNode.h"
+#include "mozilla/dom/AudioDestinationNodeBinding.h"
+
+namespace mozilla {
+namespace dom {
+
+NS_IMPL_ISUPPORTS_INHERITED0(AudioDestinationNode, AudioNode)
+
+AudioDestinationNode::AudioDestinationNode(AudioContext* aContext)
+  : AudioNode(aContext)
+{
+}
+
+JSObject*
+AudioDestinationNode::WrapObject(JSContext* aCx, JSObject* aScope,
+                                 bool* aTriedToWrap)
+{
+  return AudioDestinationNodeBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
+}
+}
+
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/AudioDestinationNode.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#pragma once
+
+#include "AudioNode.h"
+
+namespace mozilla {
+namespace dom {
+
+class AudioContext;
+
+class AudioDestinationNode : public AudioNode
+{
+public:
+  explicit AudioDestinationNode(AudioContext* aContext);
+
+  NS_DECL_ISUPPORTS_INHERITED
+
+  virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
+                               bool* aTriedToWrap);
+
+};
+
+}
+}
+
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/AudioNode.cpp
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#include "AudioNode.h"
+#include "AudioContext.h"
+#include "nsContentUtils.h"
+
+namespace mozilla {
+namespace dom {
+
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(AudioNode, mContext)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(AudioNode)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(AudioNode)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AudioNode)
+  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+AudioNode::AudioNode(AudioContext* aContext)
+  : mContext(aContext)
+{
+  MOZ_ASSERT(aContext);
+  SetIsDOMBinding();
+}
+
+}
+}
+
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/AudioNode.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#pragma once
+
+#include "nsWrapperCache.h"
+#include "nsCycleCollectionParticipant.h"
+#include "mozilla/Attributes.h"
+#include "EnableWebAudioCheck.h"
+#include "nsAutoPtr.h"
+#include "AudioContext.h"
+
+struct JSContext;
+
+namespace mozilla {
+namespace dom {
+
+class AudioNode : public nsISupports,
+                  public nsWrapperCache,
+                  public EnableWebAudioCheck
+{
+public:
+  explicit AudioNode(AudioContext* aContext);
+  virtual ~AudioNode() {}
+
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AudioNode)
+
+  AudioContext* GetParentObject() const
+  {
+    return mContext;
+  }
+
+  AudioContext* Context() const
+  {
+    return mContext;
+  }
+
+  void Connect(AudioNode& aDestination, uint32_t aOutput,
+               uint32_t aInput)
+  { /* no-op for now */ }
+
+  void Disconnect(uint32_t aOutput)
+  { /* no-op for now */ }
+
+private:
+  nsRefPtr<AudioContext> mContext;
+};
+
+}
+}
+
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/AudioSourceNode.cpp
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#include "AudioSourceNode.h"
+
+namespace mozilla {
+namespace dom {
+
+NS_IMPL_ISUPPORTS_INHERITED0(AudioSourceNode, AudioNode)
+
+AudioSourceNode::AudioSourceNode(AudioContext* aContext)
+  : AudioNode(aContext)
+{
+}
+
+}
+}
+
new file mode 100644
--- /dev/null
+++ b/content/media/webaudio/AudioSourceNode.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#pragma once
+
+#include "AudioNode.h"
+
+namespace mozilla {
+namespace dom {
+
+class AudioSourceNode : public AudioNode
+{
+public:
+  explicit AudioSourceNode(AudioContext* aContext);
+
+  NS_DECL_ISUPPORTS_INHERITED
+
+};
+
+}
+}
+
--- a/content/media/webaudio/EnableWebAudioCheck.h
+++ b/content/media/webaudio/EnableWebAudioCheck.h
@@ -1,14 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
+#pragma once
+
 namespace mozilla {
 namespace dom {
 
 // This is a helper class which enables Web Audio to be enabled or disabled
 // as whole.  Individual Web Audio object classes should inherit from this.
 class EnableWebAudioCheck {
 public:
   static bool PrefEnabled();
--- a/content/media/webaudio/Makefile.in
+++ b/content/media/webaudio/Makefile.in
@@ -10,17 +10,29 @@ FAIL_ON_WARNINGS := 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         := content
 LIBRARY_NAME   := gkconwebaudio_s
 LIBXUL_LIBRARY := 1
 
 CPPSRCS := \
+  AudioBufferSourceNode.cpp \
   AudioContext.cpp \
+  AudioDestinationNode.cpp \
+  AudioNode.cpp \
+  AudioSourceNode.cpp \
   EnableWebAudioCheck.cpp \
   $(NULL)
 
+EXPORTS_NAMESPACES := mozilla/dom
+EXPORTS_mozilla/dom := \
+  AudioBufferSourceNode.h \
+  AudioDestinationNode.h \
+  AudioNode.h \
+  AudioSourceNode.h \
+  $(NULL)
+
 PARALLEL_DIRS := test
 
 FORCE_STATIC_LIB := 1
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -22,18 +22,23 @@
 #                  to an educated guess).
 #   * castable - Indicates whether the value in the wrapper can be cast to
 #                nativeType, or whether it needs to be QI-ed (defaults to True
 #                for everything but callback interfaces and external interfaces,
 #                for which it defaults to false and is not allowed to be set
 #                at all).
 #   * concrete - Indicates whether there exist objects with this interface as
 #                their primary interface (defaults to True).
-#   * prefable - Indicates whether this binding is subject to the about:config
-#                pref, or whether it's always enabled (defaults to False).
+#   * prefable - Indicates whether this bindings should be disabled if the
+#                global pref for Web IDL bindings is set to false.  This is a
+#                risk mitigation strategy and it will cause all of the Web IDL
+#                bindings marked as prefable to fall back to the xpconnect
+#                bindings in case something goes wrong.  This defaults to False.
+#                Setting this on objects which only have Web IDL bindings does
+#                not make any sense.
 #                Cannot be set on external interfaces.
 #   * workers - Indicates whether the descriptor is intended to be used for
 #               worker threads (defaults to false).
 #   * customTrace - The native class will use a custom trace hook (defaults to
 #                   true for workers, false otherwise).
 #   * customFinalize - The native class will use a custom finalize hook
 #                      (defaults to true for workers, false otherwise).
 #   * notflattened - The native type does not have nsIClassInfo, so when
@@ -58,17 +63,30 @@
 #                         that require a JSContext as the first argument
 #   * resultNotAddRefed - attributes and methods specified in the .webidl file
 #                         that do not AddRef the return value
 
 DOMInterfaces = {
 
 'mozAudioContext': {
     'nativeType': 'AudioContext',
-    'prefable': True,
+},
+
+'AudioNode' : {
+    'concrete': False,
+},
+
+'AudioSourceNode': {
+    'concrete': False,
+},
+
+'AudioBufferSourceNode': {
+},
+
+'AudioDestinationNode': {
 },
 
 'Blob': [
 {
     'headerFile': 'nsIDOMFile.h',
 },
 {
     'workers': True,
--- a/dom/bindings/stubgenerator/Skeleton.h
+++ b/dom/bindings/stubgenerator/Skeleton.h
@@ -1,14 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
+#pragma once
+
 #include "nsWrapperCache.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/Attributes.h"
 
 struct JSContext;
 
 namespace mozilla {
 namespace dom {
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AudioBufferSourceNode.webidl
@@ -0,0 +1,35 @@
+/* -*- 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://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+[PrefControlled]
+interface AudioBufferSourceNode : AudioSourceNode {
+
+    const unsigned short UNSCHEDULED_STATE = 0;
+    const unsigned short SCHEDULED_STATE = 1;
+    const unsigned short PLAYING_STATE = 2;
+    const unsigned short FINISHED_STATE = 3;
+
+    //readonly attribute unsigned short playbackState;
+
+    // Playback this in-memory audio asset  
+    // Many sources can share the same buffer  
+    //attribute AudioBuffer buffer;
+
+    //attribute AudioParam playbackRate;
+    //attribute boolean loop;
+
+    void noteOn(double when);
+    //void noteGrainOn(double when, double grainOffset, double grainDuration);
+    void noteOff(double when);
+
+};
+
--- a/dom/webidl/AudioContext.webidl
+++ b/dom/webidl/AudioContext.webidl
@@ -7,10 +7,18 @@
  * https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
 [Constructor, PrefControlled]
 interface mozAudioContext {
+
+    readonly attribute AudioDestinationNode destination;
+
+    // AudioNode creation 
+    AudioBufferSourceNode createBufferSource();
+
 };
 
+typedef mozAudioContext AudioContext;
+
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AudioDestinationNode.webidl
@@ -0,0 +1,20 @@
+/* -*- 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://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+[PrefControlled]
+interface AudioDestinationNode : AudioNode {
+
+    //readonly attribute unsigned long maxNumberOfChannels;
+    //attribute unsigned long numberOfChannels;
+
+};
+
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AudioNode.webidl
@@ -0,0 +1,27 @@
+/* -*- 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://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+[PrefControlled]
+interface AudioNode {
+
+    void connect(AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0);
+
+    //void connect(AudioParam destination, optional unsigned long output = 0);
+
+    void disconnect(optional unsigned long output = 0);
+
+    readonly attribute AudioContext context;
+    //readonly attribute unsigned long numberOfInputs;
+    //readonly attribute unsigned long numberOfOutputs;
+
+};
+
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AudioSourceNode.webidl
@@ -0,0 +1,17 @@
+/* -*- 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://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+[PrefControlled]
+interface AudioSourceNode : AudioNode {
+
+};
+
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -4,17 +4,21 @@
 
 webidl_base = $(topsrcdir)/dom/webidl
 
 generated_webidl_files = \
   CSS2Properties.webidl \
   $(NULL)
 
 webidl_files = \
+  AudioBufferSourceNode.webidl \
   AudioContext.webidl \
+  AudioDestinationNode.webidl \
+  AudioNode.webidl \
+  AudioSourceNode.webidl \
   Blob.webidl \
   CanvasRenderingContext2D.webidl \
   ClientRectList.webidl \
   CSSStyleDeclaration.webidl \
   DOMTokenList.webidl \
   DOMSettableTokenList.webidl \
   Function.webidl \
   EventListener.webidl \