/src/mozilla-central/dom/media/webaudio/DynamicsCompressorNode.h
Line | Count | Source (jump to first uncovered line) |
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 | | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DynamicsCompressorNode, AudioNode) |
28 | | |
29 | | static already_AddRefed<DynamicsCompressorNode> |
30 | | Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext, |
31 | | const DynamicsCompressorOptions& aOptions, ErrorResult& aRv) |
32 | | { |
33 | | return Create(aAudioContext, aOptions, aRv); |
34 | | } |
35 | | |
36 | | JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
37 | | |
38 | | AudioParam* Threshold() const |
39 | | { |
40 | | return mThreshold; |
41 | | } |
42 | | |
43 | | AudioParam* Knee() const |
44 | | { |
45 | | return mKnee; |
46 | | } |
47 | | |
48 | | AudioParam* Ratio() const |
49 | | { |
50 | | return mRatio; |
51 | | } |
52 | | |
53 | | AudioParam* Attack() const |
54 | | { |
55 | | return mAttack; |
56 | | } |
57 | | |
58 | | // Called GetRelease to prevent clashing with the nsISupports::Release name |
59 | | AudioParam* GetRelease() const |
60 | | { |
61 | | return mRelease; |
62 | | } |
63 | | |
64 | | float Reduction() const |
65 | | { |
66 | | return mReduction; |
67 | | } |
68 | | |
69 | | const char* NodeType() const override |
70 | 0 | { |
71 | 0 | return "DynamicsCompressorNode"; |
72 | 0 | } |
73 | | |
74 | | size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override; |
75 | | size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override; |
76 | | |
77 | | void SetReduction(float aReduction) |
78 | 0 | { |
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 |