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

Side by Side Diff: third_party/WebKit/Source/platform/audio/StereoPanner.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/audio/StereoPanner.h" 5 #include "platform/audio/StereoPanner.h"
6 #include <algorithm> 6 #include <algorithm>
7 #include "platform/audio/AudioBus.h" 7 #include "platform/audio/AudioBus.h"
8 #include "platform/audio/AudioUtilities.h" 8 #include "platform/audio/AudioUtilities.h"
9 #include "wtf/MathExtras.h" 9 #include "wtf/MathExtras.h"
10 10
(...skipping 13 matching lines...) Expand all
24 : m_isFirstRender(true), m_pan(0.0) { 24 : m_isFirstRender(true), m_pan(0.0) {
25 // Convert smoothing time (50ms) to a per-sample time value. 25 // Convert smoothing time (50ms) to a per-sample time value.
26 m_smoothingConstant = AudioUtilities::discreteTimeConstantForSampleRate( 26 m_smoothingConstant = AudioUtilities::discreteTimeConstantForSampleRate(
27 SmoothingTimeConstant, sampleRate); 27 SmoothingTimeConstant, sampleRate);
28 } 28 }
29 29
30 void StereoPanner::panWithSampleAccurateValues(const AudioBus* inputBus, 30 void StereoPanner::panWithSampleAccurateValues(const AudioBus* inputBus,
31 AudioBus* outputBus, 31 AudioBus* outputBus,
32 const float* panValues, 32 const float* panValues,
33 size_t framesToProcess) { 33 size_t framesToProcess) {
34 bool isInputSafe = inputBus && (inputBus->numberOfChannels() == 1 || 34 bool isInputSafe = inputBus &&
35 inputBus->numberOfChannels() == 2) && 35 (inputBus->numberOfChannels() == 1 ||
36 inputBus->numberOfChannels() == 2) &&
36 framesToProcess <= inputBus->length(); 37 framesToProcess <= inputBus->length();
37 ASSERT(isInputSafe); 38 ASSERT(isInputSafe);
38 if (!isInputSafe) 39 if (!isInputSafe)
39 return; 40 return;
40 41
41 unsigned numberOfInputChannels = inputBus->numberOfChannels(); 42 unsigned numberOfInputChannels = inputBus->numberOfChannels();
42 43
43 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && 44 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 &&
44 framesToProcess <= outputBus->length(); 45 framesToProcess <= outputBus->length();
45 ASSERT(isOutputSafe); 46 ASSERT(isOutputSafe);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 *destinationR++ = static_cast<float>(inputR + inputL * gainR); 90 *destinationR++ = static_cast<float>(inputR + inputL * gainR);
90 } 91 }
91 } 92 }
92 } 93 }
93 } 94 }
94 95
95 void StereoPanner::panToTargetValue(const AudioBus* inputBus, 96 void StereoPanner::panToTargetValue(const AudioBus* inputBus,
96 AudioBus* outputBus, 97 AudioBus* outputBus,
97 float panValue, 98 float panValue,
98 size_t framesToProcess) { 99 size_t framesToProcess) {
99 bool isInputSafe = inputBus && (inputBus->numberOfChannels() == 1 || 100 bool isInputSafe = inputBus &&
100 inputBus->numberOfChannels() == 2) && 101 (inputBus->numberOfChannels() == 1 ||
102 inputBus->numberOfChannels() == 2) &&
101 framesToProcess <= inputBus->length(); 103 framesToProcess <= inputBus->length();
102 ASSERT(isInputSafe); 104 ASSERT(isInputSafe);
103 if (!isInputSafe) 105 if (!isInputSafe)
104 return; 106 return;
105 107
106 unsigned numberOfInputChannels = inputBus->numberOfChannels(); 108 unsigned numberOfInputChannels = inputBus->numberOfChannels();
107 109
108 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && 110 bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 &&
109 framesToProcess <= outputBus->length(); 111 framesToProcess <= outputBus->length();
110 ASSERT(isOutputSafe); 112 ASSERT(isOutputSafe);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // When [0; 1], keep right channel intact and equal-power pan the 174 // When [0; 1], keep right channel intact and equal-power pan the
173 // left channel only. 175 // left channel only.
174 *destinationL++ = static_cast<float>(inputL * gainL); 176 *destinationL++ = static_cast<float>(inputL * gainL);
175 *destinationR++ = static_cast<float>(inputR + inputL * gainR); 177 *destinationR++ = static_cast<float>(inputR + inputL * gainR);
176 } 178 }
177 } 179 }
178 } 180 }
179 } 181 }
180 182
181 } // namespace blink 183 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698