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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 11 matching lines...) Expand all
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #ifndef RealtimeAnalyser_h 25 #ifndef RealtimeAnalyser_h
26 #define RealtimeAnalyser_h 26 #define RealtimeAnalyser_h
27 27
28 #include "core/dom/DOMTypedArray.h" 28 #include "core/dom/DOMTypedArray.h"
29 #include "platform/audio/AudioArray.h" 29 #include "platform/audio/AudioArray.h"
30 #include "platform/audio/FFTFrame.h" 30 #include "platform/audio/FFTFrame.h"
31 #include "wtf/Noncopyable.h" 31 #include "wtf/Noncopyable.h"
32 #include "wtf/OwnPtr.h" 32 #include <memory>
33 33
34 namespace blink { 34 namespace blink {
35 35
36 class AudioBus; 36 class AudioBus;
37 37
38 class RealtimeAnalyser final { 38 class RealtimeAnalyser final {
39 WTF_MAKE_NONCOPYABLE(RealtimeAnalyser); 39 WTF_MAKE_NONCOPYABLE(RealtimeAnalyser);
40 DISALLOW_NEW(); 40 DISALLOW_NEW();
41 public: 41 public:
42 RealtimeAnalyser(); 42 RealtimeAnalyser();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 80 // Input audio is downmixed to this bus before copying to m_inputBuffer.
81 RefPtr<AudioBus> m_downMixBus; 81 RefPtr<AudioBus> m_downMixBus;
82 82
83 size_t m_fftSize; 83 size_t m_fftSize;
84 OwnPtr<FFTFrame> m_analysisFrame; 84 std::unique_ptr<FFTFrame> m_analysisFrame;
85 void doFFTAnalysis(); 85 void doFFTAnalysis();
86 86
87 // 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|.
88 void convertToByteData(DOMUint8Array* destination); 88 void convertToByteData(DOMUint8Array* destination);
89 89
90 // Convert magnidue buffer to dB, saving the result in |destination| 90 // Convert magnidue buffer to dB, saving the result in |destination|
91 void convertFloatToDb(DOMFloat32Array* destination); 91 void convertFloatToDb(DOMFloat32Array* destination);
92 92
93 // doFFTAnalysis() stores the floating-point magnitude analysis data here. 93 // doFFTAnalysis() stores the floating-point magnitude analysis data here.
94 AudioFloatArray m_magnitudeBuffer; 94 AudioFloatArray m_magnitudeBuffer;
95 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; } 95 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; }
96 96
97 // 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.
98 double m_smoothingTimeConstant; 98 double m_smoothingTimeConstant;
99 99
100 // The range used when converting when using getByteFrequencyData(). 100 // The range used when converting when using getByteFrequencyData().
101 double m_minDecibels; 101 double m_minDecibels;
102 double m_maxDecibels; 102 double m_maxDecibels;
103 103
104 // Time at which the FFT was last computed. 104 // Time at which the FFT was last computed.
105 double m_lastAnalysisTime; 105 double m_lastAnalysisTime;
106 }; 106 };
107 107
108 } // namespace blink 108 } // namespace blink
109 109
110 #endif // RealtimeAnalyser_h 110 #endif // RealtimeAnalyser_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698