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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp

Issue 2103043007: Rename AbstractAudioContext to BaseAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ASSERT(isGraphOwner()) instead of DCHECK Created 4 years, 5 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 11 matching lines...) Expand all
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "bindings/core/v8/ExceptionMessages.h" 29 #include "bindings/core/v8/ExceptionMessages.h"
30 #include "bindings/core/v8/ExceptionState.h" 30 #include "bindings/core/v8/ExceptionState.h"
31 #include "core/dom/ExceptionCode.h" 31 #include "core/dom/ExceptionCode.h"
32 #include "modules/webaudio/AbstractAudioContext.h" 32 #include "modules/webaudio/BaseAudioContext.h"
33 #include "modules/webaudio/OscillatorNode.h" 33 #include "modules/webaudio/OscillatorNode.h"
34 #include "modules/webaudio/PeriodicWave.h" 34 #include "modules/webaudio/PeriodicWave.h"
35 #include "platform/audio/FFTFrame.h" 35 #include "platform/audio/FFTFrame.h"
36 #include "platform/audio/VectorMath.h" 36 #include "platform/audio/VectorMath.h"
37 #include "wtf/PtrUtil.h" 37 #include "wtf/PtrUtil.h"
38 #include <algorithm> 38 #include <algorithm>
39 #include <memory> 39 #include <memory>
40 40
41 namespace blink { 41 namespace blink {
42 42
43 // The number of bands per octave. Each octave will have this many entries in t he wave tables. 43 // The number of bands per octave. Each octave will have this many entries in t he wave tables.
44 const unsigned kNumberOfOctaveBands = 3; 44 const unsigned kNumberOfOctaveBands = 3;
45 45
46 // The max length of a periodic wave. This must be a power of two greater than o r equal to 2048 and 46 // The max length of a periodic wave. This must be a power of two greater than o r equal to 2048 and
47 // must be supported by the FFT routines. 47 // must be supported by the FFT routines.
48 const unsigned kMaxPeriodicWaveSize = 16384; 48 const unsigned kMaxPeriodicWaveSize = 16384;
49 49
50 const float CentsPerRange = 1200 / kNumberOfOctaveBands; 50 const float CentsPerRange = 1200 / kNumberOfOctaveBands;
51 51
52 using namespace VectorMath; 52 using namespace VectorMath;
53 53
54 PeriodicWave* PeriodicWave::create( 54 PeriodicWave* PeriodicWave::create(
55 AbstractAudioContext& context, 55 BaseAudioContext& context,
56 DOMFloat32Array* real, 56 DOMFloat32Array* real,
57 DOMFloat32Array* imag, 57 DOMFloat32Array* imag,
58 bool disableNormalization, 58 bool disableNormalization,
59 ExceptionState& exceptionState) 59 ExceptionState& exceptionState)
60 { 60 {
61 DCHECK(isMainThread()); 61 DCHECK(isMainThread());
62 62
63 if (context.isContextClosed()) { 63 if (context.isContextClosed()) {
64 context.throwExceptionForClosedState(exceptionState); 64 context.throwExceptionForClosedState(exceptionState);
65 return nullptr; 65 return nullptr;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 realP[n] = 0; 345 realP[n] = 0;
346 imagP[n] = b; 346 imagP[n] = b;
347 } 347 }
348 348
349 createBandLimitedTables(realP, imagP, halfSize, false); 349 createBandLimitedTables(realP, imagP, halfSize, false);
350 } 350 }
351 351
352 } // namespace blink 352 } // namespace blink
353 353
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698