OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 void getByteTimeDomainData(Uint8Array*); | 63 void getByteTimeDomainData(Uint8Array*); |
64 | 64 |
65 // The audio thread writes input data here. | 65 // The audio thread writes input data here. |
66 void writeInput(AudioBus*, size_t framesToProcess); | 66 void writeInput(AudioBus*, size_t framesToProcess); |
67 | 67 |
68 static const double DefaultSmoothingTimeConstant; | 68 static const double DefaultSmoothingTimeConstant; |
69 static const double DefaultMinDecibels; | 69 static const double DefaultMinDecibels; |
70 static const double DefaultMaxDecibels; | 70 static const double DefaultMaxDecibels; |
71 | 71 |
72 static const unsigned DefaultFFTSize; | 72 static const unsigned DefaultFFTSize; |
| 73 static const unsigned MinFFTSize; |
73 static const unsigned MaxFFTSize; | 74 static const unsigned MaxFFTSize; |
74 static const unsigned InputBufferSize; | 75 static const unsigned InputBufferSize; |
75 | 76 |
76 private: | 77 private: |
77 // The audio thread writes the input audio here. | 78 // The audio thread writes the input audio here. |
78 AudioFloatArray m_inputBuffer; | 79 AudioFloatArray m_inputBuffer; |
79 unsigned m_writeIndex; | 80 unsigned m_writeIndex; |
80 | 81 |
81 size_t m_fftSize; | 82 size_t m_fftSize; |
82 OwnPtr<FFTFrame> m_analysisFrame; | 83 OwnPtr<FFTFrame> m_analysisFrame; |
83 void doFFTAnalysis(); | 84 void doFFTAnalysis(); |
84 | 85 |
85 // doFFTAnalysis() stores the floating-point magnitude analysis data here. | 86 // doFFTAnalysis() stores the floating-point magnitude analysis data here. |
86 AudioFloatArray m_magnitudeBuffer; | 87 AudioFloatArray m_magnitudeBuffer; |
87 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; } | 88 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; } |
88 | 89 |
89 // A value between 0 and 1 which averages the previous version of m_magnitud
eBuffer with the current analysis magnitude data. | 90 // A value between 0 and 1 which averages the previous version of m_magnitud
eBuffer with the current analysis magnitude data. |
90 double m_smoothingTimeConstant; | 91 double m_smoothingTimeConstant; |
91 | 92 |
92 // The range used when converting when using getByteFrequencyData(). | 93 // The range used when converting when using getByteFrequencyData(). |
93 double m_minDecibels; | 94 double m_minDecibels; |
94 double m_maxDecibels; | 95 double m_maxDecibels; |
95 }; | 96 }; |
96 | 97 |
97 } // namespace WebCore | 98 } // namespace WebCore |
98 | 99 |
99 #endif // RealtimeAnalyser_h | 100 #endif // RealtimeAnalyser_h |
OLD | NEW |