Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Unified Diff: third_party/WebKit/Source/modules/webaudio/ConstantSourceNode.h

Issue 2134813002: Implement ConstantSourceNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/ConstantSourceNode.h
diff --git a/third_party/WebKit/Source/modules/webaudio/ConstantSourceNode.h b/third_party/WebKit/Source/modules/webaudio/ConstantSourceNode.h
new file mode 100644
index 0000000000000000000000000000000000000000..e6d1699f3c40179e18af08bf0bd9e3222822cb1e
--- /dev/null
+++ b/third_party/WebKit/Source/modules/webaudio/ConstantSourceNode.h
@@ -0,0 +1,66 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ConstantSourceNode_h
+#define ConstantSourceNode_h
+
+#include "modules/webaudio/AudioParam.h"
+#include "modules/webaudio/AudioScheduledSourceNode.h"
+#include "platform/audio/AudioBus.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Threading.h"
+
+namespace blink {
+
+class BaseAudioContext;
+class ConstantSourceOptions;
+class ExceptionState;
+
+// ConstantSourceNode is an audio generator for a constant source
+
+class ConstantSourceHandler final : public AudioScheduledSourceHandler {
+ public:
+ static PassRefPtr<ConstantSourceHandler> create(AudioNode&,
+ float sampleRate,
+ AudioParamHandler& offset);
+ ~ConstantSourceHandler() override;
+
+ // AudioHandler
+ void process(size_t framesToProcess) override;
+
+ private:
+ ConstantSourceHandler(AudioNode&,
+ float sampleRate,
+ AudioParamHandler& offset);
+
+ // If we are no longer playing, propogate silence ahead to downstream nodes.
+ bool propagatesSilence() const override;
+
+ RefPtr<AudioParamHandler> m_offset;
+ AudioFloatArray m_sampleAccurateValues;
+};
+
+class ConstantSourceNode final : public AudioScheduledSourceNode {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ static ConstantSourceNode* create(BaseAudioContext&, ExceptionState&);
+ static ConstantSourceNode* create(BaseAudioContext*,
+ const ConstantSourceOptions&,
+ ExceptionState&);
+ DECLARE_VIRTUAL_TRACE();
+
+ AudioParam* offset();
+
+ private:
+ ConstantSourceNode(BaseAudioContext&);
+ ConstantSourceHandler& constantSourceHandler() const;
+
+ Member<AudioParam> m_offset;
+};
+
+} // namespace blink
+
+#endif // ConstantSourceNode_h

Powered by Google App Engine
This is Rietveld 408576698