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

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

Issue 2807673002: createPeriodicWave parameters are sequence<float> (Closed)
Patch Set: Rebaseline test 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
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/PeriodicWave.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fe93007802e9839efc9bf0105a44c21df66c8356..f0dba1aaa289f185164105a17500feaeea92a024 100644
--- a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
@@ -54,10 +54,8 @@ 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,
+ const Vector<float>& real,
+ const Vector<float>& imag,
bool disable_normalization,
ExceptionState& exception_state) {
DCHECK(IsMainThread());
@@ -67,33 +65,21 @@ 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,
+ periodic_wave->CreateBandLimitedTables(real.Data(), imag.Data(), real.size(),
disable_normalization);
return periodic_wave;
}
-PeriodicWave* PeriodicWave::Create(BaseAudioContext& context,
- NotShared<DOMFloat32Array> real,
- NotShared<DOMFloat32Array> imag,
- bool disable_normalization,
- ExceptionState& exception_state) {
- DCHECK(IsMainThread());
-
- return Create(context, real.View()->length(), real.View()->Data(),
- imag.View()->length(), imag.View()->Data(),
- disable_normalization, exception_state);
-}
-
PeriodicWave* PeriodicWave::Create(BaseAudioContext* context,
const PeriodicWaveOptions& options,
ExceptionState& exception_state) {
@@ -122,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) {
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/PeriodicWave.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698