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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h

Issue 2102133002: Add constructors for WebAudio nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and prefix use counter names with WebAudio Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef StereoPannerNode_h 5 #ifndef StereoPannerNode_h
6 #define StereoPannerNode_h 6 #define StereoPannerNode_h
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "modules/webaudio/AudioNode.h" 9 #include "modules/webaudio/AudioNode.h"
10 #include "modules/webaudio/AudioParam.h" 10 #include "modules/webaudio/AudioParam.h"
11 #include "platform/audio/AudioBus.h" 11 #include "platform/audio/AudioBus.h"
12 #include "platform/audio/StereoPanner.h" 12 #include "platform/audio/StereoPanner.h"
13 #include <memory> 13 #include <memory>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class BaseAudioContext; 17 class BaseAudioContext;
18 class StereoPannerOptions;
18 19
19 // StereoPannerNode is an AudioNode with one input and one output. It is 20 // StereoPannerNode is an AudioNode with one input and one output. It is
20 // specifically designed for equal-power stereo panning. 21 // specifically designed for equal-power stereo panning.
21 class StereoPannerHandler final : public AudioHandler { 22 class StereoPannerHandler final : public AudioHandler {
22 public: 23 public:
23 static PassRefPtr<StereoPannerHandler> create(AudioNode&, float sampleRate, AudioParamHandler& pan); 24 static PassRefPtr<StereoPannerHandler> create(AudioNode&, float sampleRate, AudioParamHandler& pan);
24 ~StereoPannerHandler() override; 25 ~StereoPannerHandler() override;
25 26
26 void process(size_t framesToProcess) override; 27 void process(size_t framesToProcess) override;
27 void initialize() override; 28 void initialize() override;
28 29
29 void setChannelCount(unsigned long, ExceptionState&) final; 30 void setChannelCount(unsigned long, ExceptionState&) final;
30 void setChannelCountMode(const String&, ExceptionState&) final; 31 void setChannelCountMode(const String&, ExceptionState&) final;
31 32
32 private: 33 private:
33 StereoPannerHandler(AudioNode&, float sampleRate, AudioParamHandler& pan); 34 StereoPannerHandler(AudioNode&, float sampleRate, AudioParamHandler& pan);
34 35
35 std::unique_ptr<StereoPanner> m_stereoPanner; 36 std::unique_ptr<StereoPanner> m_stereoPanner;
36 RefPtr<AudioParamHandler> m_pan; 37 RefPtr<AudioParamHandler> m_pan;
37 38
38 AudioFloatArray m_sampleAccuratePanValues; 39 AudioFloatArray m_sampleAccuratePanValues;
39 40
40 FRIEND_TEST_ALL_PREFIXES(StereoPannerNodeTest, StereoPannerLifetime); 41 FRIEND_TEST_ALL_PREFIXES(StereoPannerNodeTest, StereoPannerLifetime);
41 }; 42 };
42 43
43 class StereoPannerNode final : public AudioNode { 44 class StereoPannerNode final : public AudioNode {
44 DEFINE_WRAPPERTYPEINFO(); 45 DEFINE_WRAPPERTYPEINFO();
45 public: 46 public:
46 static StereoPannerNode* create(BaseAudioContext&, ExceptionState&); 47 static StereoPannerNode* create(BaseAudioContext&, ExceptionState&);
48 static StereoPannerNode* create(BaseAudioContext*, const StereoPannerOptions &, ExceptionState&);
47 DECLARE_VIRTUAL_TRACE(); 49 DECLARE_VIRTUAL_TRACE();
48 50
49 AudioParam* pan() const; 51 AudioParam* pan() const;
50 52
51 private: 53 private:
52 StereoPannerNode(BaseAudioContext&); 54 StereoPannerNode(BaseAudioContext&);
53 55
54 Member<AudioParam> m_pan; 56 Member<AudioParam> m_pan;
55 }; 57 };
56 58
57 } // namespace blink 59 } // namespace blink
58 60
59 #endif // StereoPannerNode_h 61 #endif // StereoPannerNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698