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 ConstantSourceNode_h_
8 : #define ConstantSourceNode_h_
9 :
10 : #include "AudioScheduledSourceNode.h"
11 : #include "AudioParam.h"
12 : #include "mozilla/dom/ConstantSourceNodeBinding.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class AudioContext;
18 :
19 : class ConstantSourceNode final : public AudioScheduledSourceNode
20 : , public MainThreadMediaStreamListener
21 : {
22 : public:
23 : explicit ConstantSourceNode(AudioContext* aContext);
24 :
25 : NS_DECL_ISUPPORTS_INHERITED
26 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ConstantSourceNode, AudioScheduledSourceNode)
27 :
28 : JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
29 :
30 : static already_AddRefed<ConstantSourceNode>
31 : Constructor(const GlobalObject& aGlobal,
32 : AudioContext& aContext,
33 : const ConstantSourceOptions& aOptions,
34 : ErrorResult& aRv);
35 :
36 : void DestroyMediaStream() override;
37 :
38 0 : uint16_t NumberOfInputs() const final override
39 : {
40 0 : return 0;
41 : }
42 :
43 0 : AudioParam* Offset() const
44 : {
45 0 : return mOffset;
46 : }
47 :
48 : void Start(double aWhen, ErrorResult& rv) override;
49 : void Stop(double aWhen, ErrorResult& rv) override;
50 :
51 : void NotifyMainThreadStreamFinished() override;
52 :
53 0 : const char* NodeType() const override
54 : {
55 0 : return "ConstantSourceNode";
56 : }
57 :
58 : size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
59 : size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
60 :
61 : protected:
62 : virtual ~ConstantSourceNode();
63 :
64 : private:
65 : RefPtr<AudioParam> mOffset;
66 : bool mStartCalled;
67 :
68 : };
69 :
70 : } // namespace dom
71 : } // namespace mozilla
72 :
73 : #endif
74 :
|