Line data Source code
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 DynamicsCompressorNode_h_
8 : #define DynamicsCompressorNode_h_
9 :
10 : #include "AudioNode.h"
11 : #include "AudioParam.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : class AudioContext;
17 : struct DynamicsCompressorOptions;
18 :
19 : class DynamicsCompressorNode final : public AudioNode
20 : {
21 : public:
22 : static already_AddRefed<DynamicsCompressorNode>
23 : Create(AudioContext& aAudioContext, const DynamicsCompressorOptions& aOptions,
24 : ErrorResult& aRv);
25 :
26 : NS_DECL_ISUPPORTS_INHERITED
27 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DynamicsCompressorNode, AudioNode)
28 :
29 : static already_AddRefed<DynamicsCompressorNode>
30 0 : Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
31 : const DynamicsCompressorOptions& aOptions, ErrorResult& aRv)
32 : {
33 0 : return Create(aAudioContext, aOptions, aRv);
34 : }
35 :
36 : JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
37 :
38 0 : AudioParam* Threshold() const
39 : {
40 0 : return mThreshold;
41 : }
42 :
43 0 : AudioParam* Knee() const
44 : {
45 0 : return mKnee;
46 : }
47 :
48 0 : AudioParam* Ratio() const
49 : {
50 0 : return mRatio;
51 : }
52 :
53 0 : AudioParam* Attack() const
54 : {
55 0 : return mAttack;
56 : }
57 :
58 : // Called GetRelease to prevent clashing with the nsISupports::Release name
59 0 : AudioParam* GetRelease() const
60 : {
61 0 : return mRelease;
62 : }
63 :
64 0 : float Reduction() const
65 : {
66 0 : return mReduction;
67 : }
68 :
69 0 : const char* NodeType() const override
70 : {
71 0 : return "DynamicsCompressorNode";
72 : }
73 :
74 : size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
75 : size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
76 :
77 0 : void SetReduction(float aReduction)
78 : {
79 0 : MOZ_ASSERT(NS_IsMainThread());
80 0 : mReduction = aReduction;
81 0 : }
82 :
83 : private:
84 : explicit DynamicsCompressorNode(AudioContext* aContext);
85 0 : ~DynamicsCompressorNode() = default;
86 :
87 : RefPtr<AudioParam> mThreshold;
88 : RefPtr<AudioParam> mKnee;
89 : RefPtr<AudioParam> mRatio;
90 : float mReduction;
91 : RefPtr<AudioParam> mAttack;
92 : RefPtr<AudioParam> mRelease;
93 : };
94 :
95 : } // namespace dom
96 : } // namespace mozilla
97 :
98 : #endif
|