| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "modules/webaudio/AudioParam.h" | 31 #include "modules/webaudio/AudioParam.h" |
| 32 #include "wtf/OwnPtr.h" | 32 #include "wtf/OwnPtr.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class AbstractAudioContext; | 36 class AbstractAudioContext; |
| 37 class DynamicsCompressor; | 37 class DynamicsCompressor; |
| 38 | 38 |
| 39 class MODULES_EXPORT DynamicsCompressorHandler final : public AudioHandler { | 39 class MODULES_EXPORT DynamicsCompressorHandler final : public AudioHandler { |
| 40 public: | 40 public: |
| 41 static PassRefPtr<DynamicsCompressorHandler> create(AudioNode&, float sample
Rate, AudioParamHandler& threshold, AudioParamHandler& knee, AudioParamHandler&
ratio, AudioParamHandler& reduction, AudioParamHandler& attack, AudioParamHandle
r& release); | 41 static PassRefPtr<DynamicsCompressorHandler> create( |
| 42 AudioNode&, |
| 43 float sampleRate, |
| 44 AudioParamHandler& threshold, |
| 45 AudioParamHandler& knee, |
| 46 AudioParamHandler& ratio, |
| 47 AudioParamHandler& attack, |
| 48 AudioParamHandler& release); |
| 49 |
| 42 ~DynamicsCompressorHandler(); | 50 ~DynamicsCompressorHandler(); |
| 43 | 51 |
| 44 // AudioHandler | 52 // AudioHandler |
| 45 void process(size_t framesToProcess) override; | 53 void process(size_t framesToProcess) override; |
| 46 void initialize() override; | 54 void initialize() override; |
| 47 void clearInternalStateWhenDisabled() override; | 55 void clearInternalStateWhenDisabled() override; |
| 48 | 56 |
| 57 float reductionValue() const { return m_reduction; } |
| 49 private: | 58 private: |
| 50 DynamicsCompressorHandler(AudioNode&, float sampleRate, AudioParamHandler& t
hreshold, AudioParamHandler& knee, AudioParamHandler& ratio, AudioParamHandler&
reduction, AudioParamHandler& attack, AudioParamHandler& release); | 59 DynamicsCompressorHandler( |
| 60 AudioNode&, |
| 61 float sampleRate, |
| 62 AudioParamHandler& threshold, |
| 63 AudioParamHandler& knee, |
| 64 AudioParamHandler& ratio, |
| 65 AudioParamHandler& attack, |
| 66 AudioParamHandler& release); |
| 51 double tailTime() const override; | 67 double tailTime() const override; |
| 52 double latencyTime() const override; | 68 double latencyTime() const override; |
| 53 | 69 |
| 54 OwnPtr<DynamicsCompressor> m_dynamicsCompressor; | 70 OwnPtr<DynamicsCompressor> m_dynamicsCompressor; |
| 55 RefPtr<AudioParamHandler> m_threshold; | 71 RefPtr<AudioParamHandler> m_threshold; |
| 56 RefPtr<AudioParamHandler> m_knee; | 72 RefPtr<AudioParamHandler> m_knee; |
| 57 RefPtr<AudioParamHandler> m_ratio; | 73 RefPtr<AudioParamHandler> m_ratio; |
| 58 RefPtr<AudioParamHandler> m_reduction; | 74 float m_reduction; |
| 59 RefPtr<AudioParamHandler> m_attack; | 75 RefPtr<AudioParamHandler> m_attack; |
| 60 RefPtr<AudioParamHandler> m_release; | 76 RefPtr<AudioParamHandler> m_release; |
| 61 | 77 |
| 62 FRIEND_TEST_ALL_PREFIXES(DynamicsCompressorNodeTest, ProcessorLifetime); | 78 FRIEND_TEST_ALL_PREFIXES(DynamicsCompressorNodeTest, ProcessorLifetime); |
| 63 }; | 79 }; |
| 64 | 80 |
| 65 class MODULES_EXPORT DynamicsCompressorNode final : public AudioNode { | 81 class MODULES_EXPORT DynamicsCompressorNode final : public AudioNode { |
| 66 DEFINE_WRAPPERTYPEINFO(); | 82 DEFINE_WRAPPERTYPEINFO(); |
| 67 public: | 83 public: |
| 68 static DynamicsCompressorNode* create(AbstractAudioContext&, float sampleRat
e); | 84 static DynamicsCompressorNode* create(AbstractAudioContext&, float sampleRat
e); |
| 69 DECLARE_VIRTUAL_TRACE(); | 85 DECLARE_VIRTUAL_TRACE(); |
| 70 | 86 |
| 71 AudioParam* threshold() const; | 87 AudioParam* threshold() const; |
| 72 AudioParam* knee() const; | 88 AudioParam* knee() const; |
| 73 AudioParam* ratio() const; | 89 AudioParam* ratio() const; |
| 74 AudioParam* reduction() const; | 90 float reduction() const; |
| 75 AudioParam* attack() const; | 91 AudioParam* attack() const; |
| 76 AudioParam* release() const; | 92 AudioParam* release() const; |
| 77 | 93 |
| 78 private: | 94 private: |
| 79 DynamicsCompressorNode(AbstractAudioContext&, float sampleRate); | 95 DynamicsCompressorNode(AbstractAudioContext&, float sampleRate); |
| 80 DynamicsCompressorHandler& dynamicsCompressorHandler() const; | 96 DynamicsCompressorHandler& dynamicsCompressorHandler() const; |
| 81 | 97 |
| 82 Member<AudioParam> m_threshold; | 98 Member<AudioParam> m_threshold; |
| 83 Member<AudioParam> m_knee; | 99 Member<AudioParam> m_knee; |
| 84 Member<AudioParam> m_ratio; | 100 Member<AudioParam> m_ratio; |
| 85 Member<AudioParam> m_reduction; | |
| 86 Member<AudioParam> m_attack; | 101 Member<AudioParam> m_attack; |
| 87 Member<AudioParam> m_release; | 102 Member<AudioParam> m_release; |
| 88 | 103 |
| 89 FRIEND_TEST_ALL_PREFIXES(DynamicsCompressorNodeTest, ProcessorLifetime); | 104 FRIEND_TEST_ALL_PREFIXES(DynamicsCompressorNodeTest, ProcessorLifetime); |
| 90 }; | 105 }; |
| 91 | 106 |
| 92 } // namespace blink | 107 } // namespace blink |
| 93 | 108 |
| 94 #endif // DynamicsCompressorNode_h | 109 #endif // DynamicsCompressorNode_h |
| OLD | NEW |