summaryrefslogtreecommitdiffstats
path: root/dom/media/webaudio/ScriptProcessorNode.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/webaudio/ScriptProcessorNode.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/webaudio/ScriptProcessorNode.h')
-rw-r--r--dom/media/webaudio/ScriptProcessorNode.h147
1 files changed, 147 insertions, 0 deletions
diff --git a/dom/media/webaudio/ScriptProcessorNode.h b/dom/media/webaudio/ScriptProcessorNode.h
new file mode 100644
index 000000000..bd1170e9c
--- /dev/null
+++ b/dom/media/webaudio/ScriptProcessorNode.h
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef ScriptProcessorNode_h_
+#define ScriptProcessorNode_h_
+
+#include "AudioNode.h"
+
+namespace mozilla {
+namespace dom {
+
+class AudioContext;
+class SharedBuffers;
+
+class ScriptProcessorNode final : public AudioNode
+{
+public:
+ ScriptProcessorNode(AudioContext* aContext,
+ uint32_t aBufferSize,
+ uint32_t aNumberOfInputChannels,
+ uint32_t aNumberOfOutputChannels);
+
+ NS_DECL_ISUPPORTS_INHERITED
+
+ IMPL_EVENT_HANDLER(audioprocess)
+
+ void EventListenerAdded(nsIAtom* aType) override;
+ void EventListenerRemoved(nsIAtom* aType) override;
+
+ JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+
+ AudioNode* Connect(AudioNode& aDestination, uint32_t aOutput,
+ uint32_t aInput, ErrorResult& aRv) override
+ {
+ AudioNode* node = AudioNode::Connect(aDestination, aOutput, aInput, aRv);
+ if (!aRv.Failed()) {
+ UpdateConnectedStatus();
+ }
+ return node;
+ }
+
+ void Connect(AudioParam& aDestination, uint32_t aOutput,
+ ErrorResult& aRv) override
+ {
+ AudioNode::Connect(aDestination, aOutput, aRv);
+ if (!aRv.Failed()) {
+ UpdateConnectedStatus();
+ }
+ }
+ void Disconnect(ErrorResult& aRv) override
+ {
+ AudioNode::Disconnect(aRv);
+ UpdateConnectedStatus();
+ }
+ void Disconnect(uint32_t aOutput, ErrorResult& aRv) override
+ {
+ AudioNode::Disconnect(aOutput, aRv);
+ UpdateConnectedStatus();
+ }
+ void NotifyInputsChanged() override
+ {
+ UpdateConnectedStatus();
+ }
+ void NotifyHasPhantomInput() override
+ {
+ mHasPhantomInput = true;
+ // No need to UpdateConnectedStatus() because there was previously an
+ // input in InputNodes().
+ }
+ void Disconnect(AudioNode& aDestination, ErrorResult& aRv) override
+ {
+ AudioNode::Disconnect(aDestination, aRv);
+ UpdateConnectedStatus();
+ }
+ void Disconnect(AudioNode& aDestination, uint32_t aOutput, ErrorResult& aRv) override
+ {
+ AudioNode::Disconnect(aDestination, aOutput, aRv);
+ UpdateConnectedStatus();
+ }
+ void Disconnect(AudioNode& aDestination, uint32_t aOutput, uint32_t aInput, ErrorResult& aRv) override
+ {
+ AudioNode::Disconnect(aDestination, aOutput, aInput, aRv);
+ UpdateConnectedStatus();
+ }
+ void Disconnect(AudioParam& aDestination, ErrorResult& aRv) override
+ {
+ AudioNode::Disconnect(aDestination, aRv);
+ UpdateConnectedStatus();
+ }
+ void Disconnect(AudioParam& aDestination, uint32_t aOutput, ErrorResult& aRv) override
+ {
+ AudioNode::Disconnect(aDestination, aOutput, aRv);
+ UpdateConnectedStatus();
+ }
+ void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv) override
+ {
+ if (aChannelCount != ChannelCount()) {
+ aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
+ }
+ return;
+ }
+ void SetChannelCountModeValue(ChannelCountMode aMode, ErrorResult& aRv) override
+ {
+ if (aMode != ChannelCountMode::Explicit) {
+ aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
+ }
+ return;
+ }
+
+ uint32_t BufferSize() const
+ {
+ return mBufferSize;
+ }
+
+ uint32_t NumberOfOutputChannels() const
+ {
+ return mNumberOfOutputChannels;
+ }
+
+ using DOMEventTargetHelper::DispatchTrustedEvent;
+
+ const char* NodeType() const override
+ {
+ return "ScriptProcessorNode";
+ }
+
+ size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
+ size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
+
+private:
+ virtual ~ScriptProcessorNode();
+
+ void UpdateConnectedStatus();
+
+ const uint32_t mBufferSize;
+ const uint32_t mNumberOfOutputChannels;
+ bool mHasPhantomInput = false;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif
+