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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 AudioFloatArray m_inputBuffer; | 79 AudioFloatArray m_inputBuffer; |
80 unsigned m_writeIndex; | 80 unsigned m_writeIndex; |
81 | 81 |
82 // Input audio is downmixed to this bus before copying to m_inputBuffer. | 82 // Input audio is downmixed to this bus before copying to m_inputBuffer. |
83 RefPtr<AudioBus> m_downMixBus; | 83 RefPtr<AudioBus> m_downMixBus; |
84 | 84 |
85 size_t m_fftSize; | 85 size_t m_fftSize; |
86 std::unique_ptr<FFTFrame> m_analysisFrame; | 86 std::unique_ptr<FFTFrame> m_analysisFrame; |
87 void doFFTAnalysis(); | 87 void doFFTAnalysis(); |
88 | 88 |
89 // Convert the contents of magnitudeBuffer to byte values, saving the result i
n |destination|. | 89 // Convert the contents of magnitudeBuffer to byte values, saving the result |
| 90 // in |destination|. |
90 void convertToByteData(DOMUint8Array* destination); | 91 void convertToByteData(DOMUint8Array* destination); |
91 | 92 |
92 // Convert magnidue buffer to dB, saving the result in |destination| | 93 // Convert magnidue buffer to dB, saving the result in |destination| |
93 void convertFloatToDb(DOMFloat32Array* destination); | 94 void convertFloatToDb(DOMFloat32Array* destination); |
94 | 95 |
95 // doFFTAnalysis() stores the floating-point magnitude analysis data here. | 96 // doFFTAnalysis() stores the floating-point magnitude analysis data here. |
96 AudioFloatArray m_magnitudeBuffer; | 97 AudioFloatArray m_magnitudeBuffer; |
97 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; } | 98 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; } |
98 | 99 |
99 // A value between 0 and 1 which averages the previous version of m_magnitudeB
uffer with the current analysis magnitude data. | 100 // A value between 0 and 1 which averages the previous version of |
| 101 // m_magnitudeBuffer with the current analysis magnitude data. |
100 double m_smoothingTimeConstant; | 102 double m_smoothingTimeConstant; |
101 | 103 |
102 // The range used when converting when using getByteFrequencyData(). | 104 // The range used when converting when using getByteFrequencyData(). |
103 double m_minDecibels; | 105 double m_minDecibels; |
104 double m_maxDecibels; | 106 double m_maxDecibels; |
105 | 107 |
106 // Time at which the FFT was last computed. | 108 // Time at which the FFT was last computed. |
107 double m_lastAnalysisTime; | 109 double m_lastAnalysisTime; |
108 }; | 110 }; |
109 | 111 |
110 } // namespace blink | 112 } // namespace blink |
111 | 113 |
112 #endif // RealtimeAnalyser_h | 114 #endif // RealtimeAnalyser_h |
OLD | NEW |