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

Unified Diff: third_party/WebKit/Source/platform/audio/Distance.cpp

Issue 2807313002: Allow Panner.refDistance to be 0 (Closed)
Patch Set: Adjust test to support cases where 0 is allowed (or not) 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/PannerNode.cpp ('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/platform/audio/Distance.cpp
diff --git a/third_party/WebKit/Source/platform/audio/Distance.cpp b/third_party/WebKit/Source/platform/audio/Distance.cpp
index af25befff1eccc38bf68af304a398c96c8f14d26..99c5a0221aa10008546f78f776b8f3ca13309ed5 100644
--- a/third_party/WebKit/Source/platform/audio/Distance.cpp
+++ b/third_party/WebKit/Source/platform/audio/Distance.cpp
@@ -67,11 +67,17 @@ double DistanceEffect::LinearGain(double distance) {
}
double DistanceEffect::InverseGain(double distance) {
+ if (ref_distance_ == 0)
+ return 0;
+
return ref_distance_ / (ref_distance_ + clampTo(rolloff_factor_, 0.0) *
(distance - ref_distance_));
}
double DistanceEffect::ExponentialGain(double distance) {
+ if (ref_distance_ == 0)
+ return 0;
+
return pow(distance / ref_distance_, -clampTo(rolloff_factor_, 0.0));
}
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/PannerNode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698