Bug 1265405 - Add a dictionary to specify how PeriodicWave should be normalized (or not); r=smaug
authorDan Minor <dminor@mozilla.com>
Tue, 26 Apr 2016 06:54:38 -0400
changeset 295185 11de193d377770de40029cf9fbcc464fcdd1274d
parent 295184 4fc5be17759a7167fd34c480163a7a0f9c3f5dd6
child 295186 94189d37e581d108bf89064ded062831669a7be6
push id30220
push usercbook@mozilla.com
push dateThu, 28 Apr 2016 14:31:09 +0000
treeherdermozilla-central@4292da9df16b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1265405
milestone49.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 1265405 - Add a dictionary to specify how PeriodicWave should be normalized (or not); r=smaug MozReview-Commit-ID: CR5kO8MXdZv
dom/media/webaudio/AudioContext.cpp
dom/media/webaudio/AudioContext.h
dom/webidl/AudioContext.webidl
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -523,16 +523,17 @@ AudioContext::CreateOscillator(ErrorResu
   RefPtr<OscillatorNode> oscillatorNode =
     new OscillatorNode(this);
   return oscillatorNode.forget();
 }
 
 already_AddRefed<PeriodicWave>
 AudioContext::CreatePeriodicWave(const Float32Array& aRealData,
                                  const Float32Array& aImagData,
+                                 const PeriodicWaveConstraints& aConstraints,
                                  ErrorResult& aRv)
 {
   aRealData.ComputeLengthAndData();
   aImagData.ComputeLengthAndData();
 
   if (aRealData.Length() != aImagData.Length() ||
       aRealData.Length() == 0) {
     aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
--- a/dom/media/webaudio/AudioContext.h
+++ b/dom/media/webaudio/AudioContext.h
@@ -63,16 +63,17 @@ class GlobalObject;
 class MediaStreamAudioDestinationNode;
 class MediaStreamAudioSourceNode;
 class OscillatorNode;
 class PannerNode;
 class ScriptProcessorNode;
 class StereoPannerNode;
 class WaveShaperNode;
 class PeriodicWave;
+struct PeriodicWaveConstraints;
 class Promise;
 enum class OscillatorType : uint32_t;
 
 // This is addrefed by the OscillatorNodeEngine on the main thread
 // and then used from the MSG thread.
 // It can be released either from the graph thread or the main thread.
 class BasicWaveFormCache
 {
@@ -250,16 +251,17 @@ public:
   already_AddRefed<BiquadFilterNode>
   CreateBiquadFilter(ErrorResult& aRv);
 
   already_AddRefed<OscillatorNode>
   CreateOscillator(ErrorResult& aRv);
 
   already_AddRefed<PeriodicWave>
   CreatePeriodicWave(const Float32Array& aRealData, const Float32Array& aImagData,
+                     const PeriodicWaveConstraints& aConstraints,
                      ErrorResult& aRv);
 
   already_AddRefed<Promise>
   DecodeAudioData(const ArrayBuffer& aBuffer,
                   const Optional<OwningNonNull<DecodeSuccessCallback> >& aSuccessCallback,
                   const Optional<OwningNonNull<DecodeErrorCallback> >& aFailureCallback,
                   ErrorResult& aRv);
 
--- a/dom/webidl/AudioContext.webidl
+++ b/dom/webidl/AudioContext.webidl
@@ -14,16 +14,20 @@ callback DecodeSuccessCallback = void (A
 callback DecodeErrorCallback = void ();
 
 enum AudioContextState {
     "suspended",
     "running",
     "closed"
 };
 
+dictionary PeriodicWaveConstraints {
+  boolean disableNormalization = false;
+};
+
 [Constructor,
  Constructor(AudioChannel audioChannelType)]
 interface AudioContext : EventTarget {
 
     readonly attribute AudioDestinationNode destination;
     readonly attribute float sampleRate;
     readonly attribute double currentTime;
     readonly attribute AudioListener listener;
@@ -83,17 +87,17 @@ interface AudioContext : EventTarget {
     ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
 
     [NewObject, Throws]
     DynamicsCompressorNode createDynamicsCompressor();
 
     [NewObject, Throws]
     OscillatorNode createOscillator();
     [NewObject, Throws]
-    PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
+    PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag, optional PeriodicWaveConstraints constraints);
 
 };
 
 // Mozilla extensions
 partial interface AudioContext {
   // Read AudioChannel.webidl for more information about this attribute.
   [Pref="media.useAudioChannelAPI"]
   readonly attribute AudioChannel mozAudioChannelType;