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

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

Issue 2012773005: Simplify notification of a dirty listener. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 7 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.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/PannerNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp b/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
index 5754b0cf59ad26bab5003361c26dd4994dc3ab73..fe27df43e669b26672534e04d95901f7b1019dfb 100644
--- a/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
@@ -148,6 +148,11 @@ void PannerHandler::process(size_t framesToProcess)
// Apply the panning effect.
double azimuth;
double elevation;
+
+ // Update dirty state in case something has moved; this can happen if the AudioParam for
+ // the position or orientation component is set directly.
+ updateDirtyState();
+
azimuthElevation(&azimuth, &elevation);
m_panner->pan(azimuth, elevation, source, destination, framesToProcess);
@@ -507,7 +512,9 @@ void PannerHandler::azimuthElevation(double* outAzimuth, double* outElevation)
{
ASSERT(context()->isAudioThread());
- if (isAzimuthElevationDirty()) {
+ // Calculate new azimuth and elevation if the panner or the listener changed
+ // position or orientation in any way.
+ if (isAzimuthElevationDirty() || listener()->isListenerDirty()) {
calculateAzimuthElevation(
&m_cachedAzimuth,
&m_cachedElevation,
@@ -526,7 +533,9 @@ float PannerHandler::distanceConeGain()
{
ASSERT(context()->isAudioThread());
- if (isDistanceConeGainDirty()) {
+ // Calculate new distance and cone gain if the panner or the listener
+ // changed position or orientation in any way.
+ if (isDistanceConeGainDirty() || listener()->isListenerDirty()) {
m_cachedDistanceConeGain = calculateDistanceConeGain(position(), orientation(), listener()->position());
m_isDistanceConeGainDirty = false;
}
@@ -606,6 +615,8 @@ bool PannerHandler::hasSampleAccurateValues() const
void PannerHandler::updateDirtyState()
{
+ DCHECK(context()->isAudioThread());
+
FloatPoint3D currentPosition = position();
FloatPoint3D currentOrientation = orientation();
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/PannerNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698