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