Chromium Code Reviews| Index: Source/modules/webaudio/AudioListener.h |
| diff --git a/Source/modules/webaudio/AudioListener.h b/Source/modules/webaudio/AudioListener.h |
| index dcd68dd42ba6717ec150bdcbfbc2a2d063219e7f..ca048843be6f051903e409958c4b6abbfbba8217 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,61 @@ public: |
| { |
| return adoptRef(new AudioListener()); |
| } |
| + virtual ~AudioListener(); |
|
KhNo
2014/04/14 11:23:30
This destructor was added for clear m_panners whic
|
| // Position |
| void setPosition(float x, float y, float z) { setPosition(FloatPoint3D(x, y, z)); } |
| - void setPosition(const FloatPoint3D &position) { m_position = position; } |
|
KhNo
2014/04/14 11:23:30
Moved to private, no need to public.
|
| const FloatPoint3D& position() const { return m_position; } |
| - // Orientation |
| + // Orientation and Up-vector |
|
KhNo
2014/04/14 11:23:30
Orientation and up-vector should be categorized to
|
| 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; } |
|
KhNo
2014/04/14 11:23:30
Moved to private, no need to public.
|
| const FloatPoint3D& orientation() const { return m_orientation; } |
| - |
| - // Up-vector |
|
KhNo
2014/04/14 11:23:30
Orientation and up-vector should be categorized to
|
| - void setUpVector(const FloatPoint3D &upVector) { m_upVector = upVector; } |
|
KhNo
2014/04/14 11:23:30
Moved to private, no need to public.
|
| 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; } |
|
KhNo
2014/04/14 11:23:30
Moved to private, no need to public.
|
| 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; } |
| + // Provide for pannerNodes. |
| + Mutex& listenerLock() { return m_listenerLock; } |
|
KhNo
2014/04/14 11:23:30
listener lock will be used for pannerNode's proces
|
| + 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 updatePannersDirty(unsigned); |
|
KhNo
2014/04/14 11:23:30
Common private method for change dirties of all pa
|
| + |
| FloatPoint3D m_position; |
| FloatPoint3D m_orientation; |
| FloatPoint3D m_upVector; |
| - |
|
KhNo
2014/04/14 11:23:30
blank is not necessary for categorization.
|
| FloatPoint3D m_velocity; |
| - |
|
KhNo
2014/04/14 11:23:30
blank is not necessary for categorization.
|
| 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. |
| + typedef Vector<PannerNode*> PannerList; |
| + PannerList m_panners; |
|
KhNo
2014/04/14 11:23:30
audio listener should have all pannernode's instan
|
| }; |
| } // WebCore |