content/media/webaudio/ConvolverNode.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef ConvolverNode_h_
     8 #define ConvolverNode_h_
    10 #include "AudioNode.h"
    11 #include "AudioBuffer.h"
    13 namespace mozilla {
    14 namespace dom {
    16 class ConvolverNode : public AudioNode
    17 {
    18 public:
    19   explicit ConvolverNode(AudioContext* aContext);
    21   NS_DECL_ISUPPORTS_INHERITED
    22   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ConvolverNode, AudioNode);
    24   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    26   AudioBuffer* GetBuffer(JSContext* aCx) const
    27   {
    28     return mBuffer;
    29   }
    31   void SetBuffer(JSContext* aCx, AudioBuffer* aBufferi, ErrorResult& aRv);
    33   bool Normalize() const
    34   {
    35     return mNormalize;
    36   }
    38   void SetNormalize(bool aNormal);
    40   virtual void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv) MOZ_OVERRIDE
    41   {
    42     if (aChannelCount > 2) {
    43       aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    44       return;
    45     }
    46     AudioNode::SetChannelCount(aChannelCount, aRv);
    47   }
    48   virtual void SetChannelCountModeValue(ChannelCountMode aMode, ErrorResult& aRv) MOZ_OVERRIDE
    49   {
    50     if (aMode == ChannelCountMode::Max) {
    51       aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    52       return;
    53     }
    54     AudioNode::SetChannelCountModeValue(aMode, aRv);
    55   }
    57   virtual const char* NodeType() const
    58   {
    59     return "ConvolverNode";
    60   }
    62   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
    63   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
    65 private:
    66   nsRefPtr<AudioBuffer> mBuffer;
    67   bool mNormalize;
    68 };
    71 } //end namespace dom
    72 } //end namespace mozilla
    74 #endif

mercurial