Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h

Issue 1803233002: AnalyserNode should downmix channels to mono. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 static const unsigned DefaultFFTSize; 70 static const unsigned DefaultFFTSize;
71 static const unsigned MinFFTSize; 71 static const unsigned MinFFTSize;
72 static const unsigned MaxFFTSize; 72 static const unsigned MaxFFTSize;
73 static const unsigned InputBufferSize; 73 static const unsigned InputBufferSize;
74 74
75 private: 75 private:
76 // The audio thread writes the input audio here. 76 // The audio thread writes the input audio here.
77 AudioFloatArray m_inputBuffer; 77 AudioFloatArray m_inputBuffer;
78 unsigned m_writeIndex; 78 unsigned m_writeIndex;
79 79
80 // Input audio is downmixed to this bus before copying to m_inputBuffer.
81 RefPtr<AudioBus> m_downMixBus;
82
80 size_t m_fftSize; 83 size_t m_fftSize;
81 OwnPtr<FFTFrame> m_analysisFrame; 84 OwnPtr<FFTFrame> m_analysisFrame;
82 void doFFTAnalysis(); 85 void doFFTAnalysis();
83 86
84 // Convert the contents of magnitudeBuffer to byte values, saving the result in |destination|. 87 // Convert the contents of magnitudeBuffer to byte values, saving the result in |destination|.
85 void convertToByteData(DOMUint8Array* destination); 88 void convertToByteData(DOMUint8Array* destination);
86 89
87 // Convert magnidue buffer to dB, saving the result in |destination| 90 // Convert magnidue buffer to dB, saving the result in |destination|
88 void convertFloatToDb(DOMFloat32Array* destination); 91 void convertFloatToDb(DOMFloat32Array* destination);
89 92
90 // doFFTAnalysis() stores the floating-point magnitude analysis data here. 93 // doFFTAnalysis() stores the floating-point magnitude analysis data here.
91 AudioFloatArray m_magnitudeBuffer; 94 AudioFloatArray m_magnitudeBuffer;
92 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; } 95 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; }
93 96
94 // A value between 0 and 1 which averages the previous version of m_magnitud eBuffer with the current analysis magnitude data. 97 // A value between 0 and 1 which averages the previous version of m_magnitud eBuffer with the current analysis magnitude data.
95 double m_smoothingTimeConstant; 98 double m_smoothingTimeConstant;
96 99
97 // The range used when converting when using getByteFrequencyData(). 100 // The range used when converting when using getByteFrequencyData().
98 double m_minDecibels; 101 double m_minDecibels;
99 double m_maxDecibels; 102 double m_maxDecibels;
100 103
101 // Time at which the FFT was last computed. 104 // Time at which the FFT was last computed.
102 double m_lastAnalysisTime; 105 double m_lastAnalysisTime;
103 }; 106 };
104 107
105 } // namespace blink 108 } // namespace blink
106 109
107 #endif // RealtimeAnalyser_h 110 #endif // RealtimeAnalyser_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698