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

Unified Diff: third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp

Issue 2807673002: createPeriodicWave parameters are sequence<float> (Closed)
Patch Set: Rebase Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
index c33bd1de857f47a8cede03d49c0482f9c6601706..d86eea36b8ec091dd9311bf869b4d439b1d1c216 100644
--- a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
@@ -54,11 +54,9 @@ const float kCentsPerRange = 1200 / kNumberOfOctaveBands;
using namespace VectorMath;
PeriodicWave* PeriodicWave::Create(BaseAudioContext& context,
- size_t real_length,
- const float* real,
- size_t imag_length,
- const float* imag,
- bool disable_normalization,
+ const Vector<float>& real,
+ const Vector<float>& imag,
+ bool disableNormalization,
ExceptionState& exception_state) {
DCHECK(IsMainThread());
@@ -67,30 +65,19 @@ PeriodicWave* PeriodicWave::Create(BaseAudioContext& context,
return nullptr;
}
- if (real_length != imag_length) {
+ if (real.size() != imag.size()) {
exception_state.ThrowDOMException(
kIndexSizeError, "length of real array (" +
- String::Number(real_length) +
+ String::Number(real.size()) +
") and length of imaginary array (" +
- String::Number(imag_length) + ") must match.");
+ String::Number(imag.size()) + ") must match.");
return nullptr;
}
- PeriodicWave* periodic_wave = new PeriodicWave(context.sampleRate());
- periodic_wave->CreateBandLimitedTables(real, imag, real_length,
- disable_normalization);
- return periodic_wave;
-}
-
-PeriodicWave* PeriodicWave::Create(BaseAudioContext& context,
- DOMFloat32Array* real,
- DOMFloat32Array* imag,
- bool disable_normalization,
- ExceptionState& exception_state) {
- DCHECK(IsMainThread());
-
- return Create(context, real->length(), real->Data(), imag->length(),
- imag->Data(), disable_normalization, exception_state);
+ PeriodicWave* periodicWave = new PeriodicWave(context.sampleRate());
+ periodicWave->CreateBandLimitedTables(real.Data(), imag.Data(), real.size(),
+ disableNormalization);
+ return periodicWave;
}
PeriodicWave* PeriodicWave::Create(BaseAudioContext* context,
@@ -121,8 +108,7 @@ PeriodicWave* PeriodicWave::Create(BaseAudioContext* context,
imag_coef[1] = 1;
}
- return Create(*context, real_coef.size(), real_coef.Data(), imag_coef.size(),
- imag_coef.Data(), normalize, exception_state);
+ return Create(*context, real_coef, imag_coef, normalize, exception_state);
}
PeriodicWave* PeriodicWave::CreateSine(float sample_rate) {

Powered by Google App Engine
This is Rietveld 408576698