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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef DynamicsCompressorKernel_h | 29 #ifndef DynamicsCompressorKernel_h |
30 #define DynamicsCompressorKernel_h | 30 #define DynamicsCompressorKernel_h |
31 | 31 |
32 #include "platform/PlatformExport.h" | 32 #include "platform/PlatformExport.h" |
33 #include "platform/audio/AudioArray.h" | 33 #include "platform/audio/AudioArray.h" |
34 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
35 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
36 #include <memory> | 36 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/PassOwnPtr.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 class PLATFORM_EXPORT DynamicsCompressorKernel { | 41 class PLATFORM_EXPORT DynamicsCompressorKernel { |
41 DISALLOW_NEW(); | 42 DISALLOW_NEW(); |
42 WTF_MAKE_NONCOPYABLE(DynamicsCompressorKernel); | 43 WTF_MAKE_NONCOPYABLE(DynamicsCompressorKernel); |
43 public: | 44 public: |
44 DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels); | 45 DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels); |
45 | 46 |
46 void setNumberOfChannels(unsigned); | 47 void setNumberOfChannels(unsigned); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 float m_meteringReleaseK; | 85 float m_meteringReleaseK; |
85 float m_meteringGain; | 86 float m_meteringGain; |
86 | 87 |
87 // Lookahead section. | 88 // Lookahead section. |
88 enum { MaxPreDelayFrames = 1024 }; | 89 enum { MaxPreDelayFrames = 1024 }; |
89 enum { MaxPreDelayFramesMask = MaxPreDelayFrames - 1 }; | 90 enum { MaxPreDelayFramesMask = MaxPreDelayFrames - 1 }; |
90 enum { DefaultPreDelayFrames = 256 }; // setPreDelayTime() will override thi
s initial value | 91 enum { DefaultPreDelayFrames = 256 }; // setPreDelayTime() will override thi
s initial value |
91 unsigned m_lastPreDelayFrames; | 92 unsigned m_lastPreDelayFrames; |
92 void setPreDelayTime(float); | 93 void setPreDelayTime(float); |
93 | 94 |
94 Vector<std::unique_ptr<AudioFloatArray>> m_preDelayBuffers; | 95 Vector<OwnPtr<AudioFloatArray>> m_preDelayBuffers; |
95 int m_preDelayReadIndex; | 96 int m_preDelayReadIndex; |
96 int m_preDelayWriteIndex; | 97 int m_preDelayWriteIndex; |
97 | 98 |
98 float m_maxAttackCompressionDiffDb; | 99 float m_maxAttackCompressionDiffDb; |
99 | 100 |
100 // Static compression curve. | 101 // Static compression curve. |
101 float kneeCurve(float x, float k); | 102 float kneeCurve(float x, float k); |
102 float saturate(float x, float k); | 103 float saturate(float x, float k); |
103 float slopeAt(float x, float k); | 104 float slopeAt(float x, float k); |
104 float kAtSlope(float desiredSlope); | 105 float kAtSlope(float desiredSlope); |
(...skipping 18 matching lines...) Expand all Loading... |
123 float m_kneeThresholdDb; | 124 float m_kneeThresholdDb; |
124 float m_ykneeThresholdDb; | 125 float m_ykneeThresholdDb; |
125 | 126 |
126 // Internal parameter for the knee portion of the curve. | 127 // Internal parameter for the knee portion of the curve. |
127 float m_knee; | 128 float m_knee; |
128 }; | 129 }; |
129 | 130 |
130 } // namespace blink | 131 } // namespace blink |
131 | 132 |
132 #endif // DynamicsCompressorKernel_h | 133 #endif // DynamicsCompressorKernel_h |
OLD | NEW |