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 "wtf/OwnPtr.h" | 36 #include <memory> |
37 #include "wtf/PassOwnPtr.h" | |
38 | 37 |
39 namespace blink { | 38 namespace blink { |
40 | 39 |
41 class PLATFORM_EXPORT DynamicsCompressorKernel { | 40 class PLATFORM_EXPORT DynamicsCompressorKernel { |
42 DISALLOW_NEW(); | 41 DISALLOW_NEW(); |
43 WTF_MAKE_NONCOPYABLE(DynamicsCompressorKernel); | 42 WTF_MAKE_NONCOPYABLE(DynamicsCompressorKernel); |
44 public: | 43 public: |
45 DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels); | 44 DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels); |
46 | 45 |
47 void setNumberOfChannels(unsigned); | 46 void setNumberOfChannels(unsigned); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 float m_meteringReleaseK; | 84 float m_meteringReleaseK; |
86 float m_meteringGain; | 85 float m_meteringGain; |
87 | 86 |
88 // Lookahead section. | 87 // Lookahead section. |
89 enum { MaxPreDelayFrames = 1024 }; | 88 enum { MaxPreDelayFrames = 1024 }; |
90 enum { MaxPreDelayFramesMask = MaxPreDelayFrames - 1 }; | 89 enum { MaxPreDelayFramesMask = MaxPreDelayFrames - 1 }; |
91 enum { DefaultPreDelayFrames = 256 }; // setPreDelayTime() will override thi
s initial value | 90 enum { DefaultPreDelayFrames = 256 }; // setPreDelayTime() will override thi
s initial value |
92 unsigned m_lastPreDelayFrames; | 91 unsigned m_lastPreDelayFrames; |
93 void setPreDelayTime(float); | 92 void setPreDelayTime(float); |
94 | 93 |
95 Vector<OwnPtr<AudioFloatArray>> m_preDelayBuffers; | 94 Vector<std::unique_ptr<AudioFloatArray>> m_preDelayBuffers; |
96 int m_preDelayReadIndex; | 95 int m_preDelayReadIndex; |
97 int m_preDelayWriteIndex; | 96 int m_preDelayWriteIndex; |
98 | 97 |
99 float m_maxAttackCompressionDiffDb; | 98 float m_maxAttackCompressionDiffDb; |
100 | 99 |
101 // Static compression curve. | 100 // Static compression curve. |
102 float kneeCurve(float x, float k); | 101 float kneeCurve(float x, float k); |
103 float saturate(float x, float k); | 102 float saturate(float x, float k); |
104 float slopeAt(float x, float k); | 103 float slopeAt(float x, float k); |
105 float kAtSlope(float desiredSlope); | 104 float kAtSlope(float desiredSlope); |
(...skipping 18 matching lines...) Expand all Loading... |
124 float m_kneeThresholdDb; | 123 float m_kneeThresholdDb; |
125 float m_ykneeThresholdDb; | 124 float m_ykneeThresholdDb; |
126 | 125 |
127 // Internal parameter for the knee portion of the curve. | 126 // Internal parameter for the knee portion of the curve. |
128 float m_knee; | 127 float m_knee; |
129 }; | 128 }; |
130 | 129 |
131 } // namespace blink | 130 } // namespace blink |
132 | 131 |
133 #endif // DynamicsCompressorKernel_h | 132 #endif // DynamicsCompressorKernel_h |
OLD | NEW |