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

Unified Diff: Source/modules/webaudio/AudioListener.h

Issue 232453003: Add logic to cache elements of panner node from calculation with own attributes and AudioListener (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Unrelated fix has been separated. Created 6 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 | « no previous file | Source/modules/webaudio/AudioListener.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioListener.h
diff --git a/Source/modules/webaudio/AudioListener.h b/Source/modules/webaudio/AudioListener.h
index dcd68dd42ba6717ec150bdcbfbc2a2d063219e7f..a2db467877e442ac057d264fd135de0a159f9907 100644
--- a/Source/modules/webaudio/AudioListener.h
+++ b/Source/modules/webaudio/AudioListener.h
@@ -33,9 +33,12 @@
#include "platform/geometry/FloatPoint3D.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
namespace WebCore {
+class PannerNode;
+
// AudioListener maintains the state of the listener in the audio scene as defined in the OpenAL specification.
class AudioListener : public ScriptWrappable, public RefCounted<AudioListener> {
@@ -44,50 +47,59 @@ public:
{
return adoptRef(new AudioListener());
}
+ virtual ~AudioListener();
// Position
void setPosition(float x, float y, float z) { setPosition(FloatPoint3D(x, y, z)); }
- void setPosition(const FloatPoint3D &position) { m_position = position; }
const FloatPoint3D& position() const { return m_position; }
- // Orientation
+ // Orientation and Up-vector
void setOrientation(float x, float y, float z, float upX, float upY, float upZ)
{
setOrientation(FloatPoint3D(x, y, z));
setUpVector(FloatPoint3D(upX, upY, upZ));
}
- void setOrientation(const FloatPoint3D &orientation) { m_orientation = orientation; }
const FloatPoint3D& orientation() const { return m_orientation; }
-
- // Up-vector
- void setUpVector(const FloatPoint3D &upVector) { m_upVector = upVector; }
const FloatPoint3D& upVector() const { return m_upVector; }
// Velocity
void setVelocity(float x, float y, float z) { setVelocity(FloatPoint3D(x, y, z)); }
- void setVelocity(const FloatPoint3D &velocity) { m_velocity = velocity; }
const FloatPoint3D& velocity() const { return m_velocity; }
// Doppler factor
- void setDopplerFactor(double dopplerFactor) { m_dopplerFactor = dopplerFactor; }
+ void setDopplerFactor(double);
double dopplerFactor() const { return m_dopplerFactor; }
// Speed of sound
- void setSpeedOfSound(double speedOfSound) { m_speedOfSound = speedOfSound; }
+ void setSpeedOfSound(double);
double speedOfSound() const { return m_speedOfSound; }
+ Mutex& listenerLock() { return m_listenerLock; }
+ void addPanner(PannerNode*);
+ void removePanner(PannerNode*);
+
private:
AudioListener();
- // Position / Orientation
+ void setPosition(const FloatPoint3D&);
+ void setOrientation(const FloatPoint3D&);
+ void setUpVector(const FloatPoint3D&);
+ void setVelocity(const FloatPoint3D&);
+
+ void markPannersAsDirty(unsigned);
+
FloatPoint3D m_position;
FloatPoint3D m_orientation;
FloatPoint3D m_upVector;
-
FloatPoint3D m_velocity;
-
double m_dopplerFactor;
double m_speedOfSound;
+
+ // Synchronize a panner's process() with setting of the state of the listener.
+ mutable Mutex m_listenerLock;
+
+ // List for pannerNodes in context.
+ Vector<PannerNode*> m_panners;
};
} // WebCore
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioListener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698