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 StereoPannerNode_h_
8 : #define StereoPannerNode_h_
9 :
10 : #include "AudioNode.h"
11 : #include "mozilla/dom/StereoPannerNodeBinding.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : class AudioContext;
17 : struct StereoPannerOptions;
18 :
19 : class StereoPannerNode final : public AudioNode
20 : {
21 : public:
22 : static already_AddRefed<StereoPannerNode>
23 : Create(AudioContext& aAudioContext, const StereoPannerOptions& aOptions,
24 : ErrorResult& aRv);
25 :
26 : MOZ_DECLARE_REFCOUNTED_TYPENAME(StereoPannerNode)
27 :
28 : static already_AddRefed<StereoPannerNode>
29 0 : Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
30 : const StereoPannerOptions& aOptions, ErrorResult& aRv)
31 : {
32 0 : return Create(aAudioContext, aOptions, aRv);
33 : }
34 :
35 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
36 :
37 0 : virtual void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv) override
38 : {
39 0 : if (aChannelCount > 2) {
40 0 : aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
41 0 : return;
42 : }
43 0 : AudioNode::SetChannelCount(aChannelCount, aRv);
44 : }
45 0 : virtual void SetChannelCountModeValue(ChannelCountMode aMode, ErrorResult& aRv) override
46 : {
47 0 : if (aMode == ChannelCountMode::Max) {
48 0 : aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
49 0 : return;
50 : }
51 0 : AudioNode::SetChannelCountModeValue(aMode, aRv);
52 : }
53 :
54 0 : AudioParam* Pan() const
55 : {
56 0 : return mPan;
57 : }
58 :
59 : NS_DECL_ISUPPORTS_INHERITED
60 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(StereoPannerNode, AudioNode)
61 :
62 0 : virtual const char* NodeType() const override
63 : {
64 0 : return "StereoPannerNode";
65 : }
66 :
67 : virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
68 : virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
69 :
70 : private:
71 : explicit StereoPannerNode(AudioContext* aContext);
72 0 : ~StereoPannerNode() = default;
73 :
74 : RefPtr<AudioParam> mPan;
75 : };
76 :
77 : } // namespace dom
78 : } // namespace mozilla
79 :
80 : #endif
|