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

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

Issue 2102133002: Add constructors for WebAudio nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 /* 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 22 matching lines...) Expand all
33 #include "core/dom/DOMTypedArray.h" 33 #include "core/dom/DOMTypedArray.h"
34 #include "platform/audio/AudioArray.h" 34 #include "platform/audio/AudioArray.h"
35 #include "wtf/Forward.h" 35 #include "wtf/Forward.h"
36 #include "wtf/Vector.h" 36 #include "wtf/Vector.h"
37 #include <memory> 37 #include <memory>
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class BaseAudioContext; 41 class BaseAudioContext;
42 class ExceptionState; 42 class ExceptionState;
43 class PeriodicWaveOptions;
43 44
44 class PeriodicWave final : public GarbageCollectedFinalized<PeriodicWave>, publi c ScriptWrappable { 45 class PeriodicWave final : public GarbageCollectedFinalized<PeriodicWave>, publi c ScriptWrappable {
45 DEFINE_WRAPPERTYPEINFO(); 46 DEFINE_WRAPPERTYPEINFO();
46 public: 47 public:
47 static PeriodicWave* createSine(float sampleRate); 48 static PeriodicWave* createSine(float sampleRate);
48 static PeriodicWave* createSquare(float sampleRate); 49 static PeriodicWave* createSquare(float sampleRate);
49 static PeriodicWave* createSawtooth(float sampleRate); 50 static PeriodicWave* createSawtooth(float sampleRate);
50 static PeriodicWave* createTriangle(float sampleRate); 51 static PeriodicWave* createTriangle(float sampleRate);
51 52
52 // Creates an arbitrary periodic wave given the frequency components (Fourie r coefficients). 53 // Creates an arbitrary periodic wave given the frequency components (Fourie r coefficients).
53 static PeriodicWave* create( 54 static PeriodicWave* create(
54 BaseAudioContext&, 55 BaseAudioContext&,
56 size_t realLength,
57 const float* real,
58 size_t imagLength,
59 const float* imag,
60 bool normalize,
61 ExceptionState&);
62
63 static PeriodicWave* create(
64 BaseAudioContext&,
55 DOMFloat32Array* real, 65 DOMFloat32Array* real,
56 DOMFloat32Array* imag, 66 DOMFloat32Array* imag,
57 bool normalize, 67 bool normalize,
58 ExceptionState&); 68 ExceptionState&);
59 69
70 static PeriodicWave* create(BaseAudioContext*, const PeriodicWaveOptions&, E xceptionState&);
71
60 virtual ~PeriodicWave(); 72 virtual ~PeriodicWave();
61 73
62 // Returns pointers to the lower and higher wave data for the pitch range co ntaining 74 // Returns pointers to the lower and higher wave data for the pitch range co ntaining
63 // the given fundamental frequency. These two tables are in adjacent "pitch" ranges 75 // the given fundamental frequency. These two tables are in adjacent "pitch" ranges
64 // where the higher table will have the maximum number of partials which won 't alias when played back 76 // where the higher table will have the maximum number of partials which won 't alias when played back
65 // at this fundamental frequency. The lower wave is the next range containin g fewer partials than the higher wave. 77 // at this fundamental frequency. The lower wave is the next range containin g fewer partials than the higher wave.
66 // Interpolation between these two tables can be made according to tableInte rpolationFactor. 78 // Interpolation between these two tables can be made according to tableInte rpolationFactor.
67 // Where values from 0 -> 1 interpolate between lower -> higher. 79 // Where values from 0 -> 1 interpolate between lower -> higher.
68 void waveDataForFundamentalFrequency(float, float*& lowerWaveData, float*& h igherWaveData, float& tableInterpolationFactor); 80 void waveDataForFundamentalFrequency(float, float*& lowerWaveData, float*& h igherWaveData, float& tableInterpolationFactor);
69 81
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void adjustV8ExternalMemory(int delta); 116 void adjustV8ExternalMemory(int delta);
105 117
106 // Creates tables based on numberOfComponents Fourier coefficients. 118 // Creates tables based on numberOfComponents Fourier coefficients.
107 void createBandLimitedTables(const float* real, const float* imag, unsigned numberOfComponents, bool disableNormalization); 119 void createBandLimitedTables(const float* real, const float* imag, unsigned numberOfComponents, bool disableNormalization);
108 Vector<std::unique_ptr<AudioFloatArray>> m_bandLimitedTables; 120 Vector<std::unique_ptr<AudioFloatArray>> m_bandLimitedTables;
109 }; 121 };
110 122
111 } // namespace blink 123 } // namespace blink
112 124
113 #endif // PeriodicWave_h 125 #endif // PeriodicWave_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698