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

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

Issue 2272683003: Remove redundant definition of Spatializer abstract class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix reference URL Created 4 years, 3 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 "platform/audio/AudioBus.h" 6 #include "platform/audio/AudioBus.h"
7 #include "platform/audio/AudioUtilities.h" 7 #include "platform/audio/AudioUtilities.h"
8 #include "wtf/MathExtras.h" 8 #include "wtf/MathExtras.h"
9 #include <algorithm> 9 #include <algorithm>
10 10
11 // Use a 50ms smoothing / de-zippering time-constant. 11 // Use a 50ms smoothing / de-zippering time-constant.
12 const float SmoothingTimeConstant = 0.050f; 12 const float SmoothingTimeConstant = 0.050f;
13 13
14 namespace blink { 14 namespace blink {
15 15
16 // Implement equal-power panning algorithm for mono or stereo input. 16 // Implement equal-power panning algorithm for mono or stereo input.
17 // See: http://webaudio.github.io/web-audio-api/#panning-algorithm 17 // See: http://webaudio.github.io/web-audio-api/#panning-algorithm
18 18
19 StereoPanner::StereoPanner(float sampleRate) : Spatializer(PanningModelEqualPowe r) 19 std::unique_ptr<StereoPanner> StereoPanner::create(float sampleRate)
20 , m_isFirstRender(true) 20 {
21 return wrapUnique(new StereoPanner(sampleRate));
22 }
23
24 StereoPanner::StereoPanner(float sampleRate)
25 : m_isFirstRender(true)
21 , m_pan(0.0) 26 , m_pan(0.0)
22 { 27 {
23 // Convert smoothing time (50ms) to a per-sample time value. 28 // Convert smoothing time (50ms) to a per-sample time value.
24 m_smoothingConstant = AudioUtilities::discreteTimeConstantForSampleRate(Smoo thingTimeConstant, sampleRate); 29 m_smoothingConstant = AudioUtilities::discreteTimeConstantForSampleRate(Smoo thingTimeConstant, sampleRate);
25 } 30 }
26 31
27 void StereoPanner::panWithSampleAccurateValues(const AudioBus* inputBus, AudioBu s* outputBus, const float* panValues, size_t framesToProcess) 32 void StereoPanner::panWithSampleAccurateValues(const AudioBus* inputBus, AudioBu s* outputBus, const float* panValues, size_t framesToProcess)
28 { 33 {
29 bool isInputSafe = inputBus 34 bool isInputSafe = inputBus
30 && (inputBus->numberOfChannels() == 1 || inputBus->numberOfChannels() == 2) 35 && (inputBus->numberOfChannels() == 1 || inputBus->numberOfChannels() == 2)
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // left channel only. 167 // left channel only.
163 *destinationL++ = static_cast<float>(inputL * gainL); 168 *destinationL++ = static_cast<float>(inputL * gainL);
164 *destinationR++ = static_cast<float>(inputR + inputL * gainR); 169 *destinationR++ = static_cast<float>(inputR + inputL * gainR);
165 } 170 }
166 } 171 }
167 } 172 }
168 } 173 }
169 174
170 } // namespace blink 175 } // namespace blink
171 176
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/audio/StereoPanner.h ('k') | third_party/WebKit/Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698