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/. */
6 
7 #ifndef ChannelMergerNode_h_
8 #define ChannelMergerNode_h_
9 
10 #include "AudioNode.h"
11 
12 namespace mozilla {
13 namespace dom {
14 
15 class AudioContext;
16 struct ChannelMergerOptions;
17 
18 class ChannelMergerNode final : public AudioNode {
19  public:
20   static already_AddRefed<ChannelMergerNode> Create(
21       AudioContext& aAudioContext, const ChannelMergerOptions& aOptions,
22       ErrorResult& aRv);
23 
NS_INLINE_DECL_REFCOUNTING_INHERITED(ChannelMergerNode,AudioNode)24   NS_INLINE_DECL_REFCOUNTING_INHERITED(ChannelMergerNode, AudioNode)
25 
26   static already_AddRefed<ChannelMergerNode> Constructor(
27       const GlobalObject& aGlobal, AudioContext& aAudioContext,
28       const ChannelMergerOptions& aOptions, ErrorResult& aRv) {
29     return Create(aAudioContext, aOptions, aRv);
30   }
31 
32   JSObject* WrapObject(JSContext* aCx,
33                        JS::Handle<JSObject*> aGivenProto) override;
34 
NumberOfInputs()35   uint16_t NumberOfInputs() const override { return mInputCount; }
36 
NodeType()37   const char* NodeType() const override { return "ChannelMergerNode"; }
38 
SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)39   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override {
40     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
41   }
42 
43  private:
44   ChannelMergerNode(AudioContext* aContext, uint16_t aInputCount);
45   ~ChannelMergerNode() = default;
46 
47   const uint16_t mInputCount;
48 };
49 
50 }  // namespace dom
51 }  // namespace mozilla
52 
53 #endif
54