Chromium Code Reviews| Index: Source/modules/webaudio/StereoPannerNode.h |
| diff --git a/Source/platform/text/TextRunIterator.h b/Source/modules/webaudio/StereoPannerNode.h |
| similarity index 56% |
| copy from Source/platform/text/TextRunIterator.h |
| copy to Source/modules/webaudio/StereoPannerNode.h |
| index 0774b659a08244236f61d3b3b5cf728a6d078329..02b02e4278a5925be7926116a0d5be933f9ca761 100644 |
| --- a/Source/platform/text/TextRunIterator.h |
| +++ b/Source/modules/webaudio/StereoPannerNode.h |
| @@ -1,4 +1,4 @@ |
| -// Copyright (C) 2013 Google Inc. All rights reserved. |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are |
| @@ -26,53 +26,49 @@ |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| -#ifndef TextRunIterator_h |
| -#define TextRunIterator_h |
| +#ifndef StereoPannerNode_h |
| +#define StereoPannerNode_h |
| -#include "platform/text/TextRun.h" |
| +#include "modules/webaudio/AudioNode.h" |
| +#include "modules/webaudio/AudioParam.h" |
| +#include "platform/audio/AudioBus.h" |
| +#include "platform/audio/Spatializer.h" |
| namespace blink { |
| -class TextRunIterator { |
| +// StereoPannerNode is an AudioNode with one input and one output. It is |
| +// specifically designed for equal-power stereo panning. |
| +class StereoPannerNode final : public AudioNode { |
| + DEFINE_WRAPPERTYPEINFO(); |
| public: |
| - TextRunIterator() |
| - : m_textRun(0) |
| - , m_offset(0) |
| + static StereoPannerNode* create(AudioContext* context, float sampleRate) |
| { |
| + return new StereoPannerNode(context, sampleRate); |
| } |
| - TextRunIterator(const TextRun* textRun, unsigned offset) |
| - : m_textRun(textRun) |
| - , m_offset(offset) |
| - { |
| - } |
| + virtual ~StereoPannerNode(); |
| - TextRunIterator(const TextRunIterator& other) |
| - : m_textRun(other.m_textRun) |
| - , m_offset(other.m_offset) |
| - { |
| - } |
| + virtual void dispose() override; |
| + virtual void process(size_t framesToProcess) override; |
| + virtual void initialize() override; |
| + virtual void uninitialize() override; |
| - unsigned offset() const { return m_offset; } |
| - void increment() { m_offset++; } |
| - bool atEnd() const { return !m_textRun || m_offset >= m_textRun->length(); } |
| - UChar current() const { return (*m_textRun)[m_offset]; } |
| - WTF::Unicode::Direction direction() const { return atEnd() ? WTF::Unicode::OtherNeutral : WTF::Unicode::direction(current()); } |
| - bool atParagraphSeparator() const { return current() == '\n'; } |
| + virtual double tailTime() const override { return 0; } |
| + virtual double latencyTime() const override { return 0; } |
| - bool operator==(const TextRunIterator& other) |
| - { |
| - return m_offset == other.m_offset && m_textRun == other.m_textRun; |
| - } |
| + virtual void trace(Visitor*) override; |
| - bool operator!=(const TextRunIterator& other) { return !operator==(other); } |
| + AudioParam* pan() { return m_pan.get(); } |
|
Raymond Toy
2014/11/11 19:41:47
Can this be const?
hongchan
2014/11/12 00:06:54
The structure of this node is based on GainNode an
Raymond Toy
2014/11/12 00:16:44
I think the style is to be const when possible, so
|
| private: |
| - const TextRun* m_textRun; |
| - int m_offset; |
| -}; |
| + StereoPannerNode(AudioContext*, float sampleRate); |
| + Member<Spatializer> m_stereoPanner; |
| + Member<AudioParam> m_pan; |
| + |
| + AudioFloatArray m_sampleAccuratePanValues; |
| +}; |
| } // namespace blink |
| -#endif // TextRunIterator_h |
| +#endif // StereoPannerNode_h |