Chromium Code Reviews| Index: Source/modules/webaudio/PannerNode.h |
| diff --git a/Source/modules/webaudio/PannerNode.h b/Source/modules/webaudio/PannerNode.h |
| index f1981df10f0ebeff06acececf5e3765b3bc8cd40..27765cb6270cb6333746fa2ef270cd4c1f76b421 100644 |
| --- a/Source/modules/webaudio/PannerNode.h |
| +++ b/Source/modules/webaudio/PannerNode.h |
| @@ -49,16 +49,22 @@ class PannerNode FINAL : public AudioNode { |
| public: |
| // These must be defined as in the .idl file and must match those in the Panner class. |
| enum { |
| - EQUALPOWER = 0, |
| + EqualPower = 0, |
|
Raymond Toy
2014/04/16 17:36:15
Why is the case changed for this enum and the enum
KhNo
2014/04/17 13:41:03
When I added dirty enums, webkit style checker of
|
| HRTF = 1, |
| }; |
| // These must be defined as in the .idl file and must match those |
| // in the DistanceEffect class. |
| enum { |
| - LINEAR_DISTANCE = 0, |
| - INVERSE_DISTANCE = 1, |
| - EXPONENTIAL_DISTANCE = 2, |
| + LinearDistance = 0, |
| + InverseDistance = 1, |
| + ExponentialDistance = 2, |
| + }; |
| + |
| + enum { |
|
Raymond Toy
2014/04/16 17:36:15
Add comment on what these flags are for.
KhNo
2014/04/17 13:41:03
Done.
|
| + AzimuthElevationDirty = 0x00000001, |
| + DistanceConeGainDirty = 0x00000002, |
| + DopplerRateDirty = 0x00000004, |
| }; |
| static PassRefPtr<PannerNode> create(AudioContext* context, float sampleRate) |
| @@ -74,20 +80,13 @@ public: |
| virtual void initialize() OVERRIDE; |
| virtual void uninitialize() OVERRIDE; |
| - // AudioContext's listener |
| - AudioListener* listener(); |
| - |
| // Panning model |
| String panningModel() const; |
| void setPanningModel(const String&); |
| - // Position |
| + // Position, orientation and velocity |
| void setPosition(float x, float y, float z); |
| - |
| - // Orientation |
| void setOrientation(float x, float y, float z); |
| - |
| - // Velocity |
| void setVelocity(float x, float y, float z); |
| // Distance parameters |
| @@ -95,23 +94,25 @@ public: |
| void setDistanceModel(const String&); |
| double refDistance() { return m_distanceEffect.refDistance(); } |
| - void setRefDistance(double refDistance) { m_distanceEffect.setRefDistance(refDistance); } |
| + void setRefDistance(double); |
| double maxDistance() { return m_distanceEffect.maxDistance(); } |
| - void setMaxDistance(double maxDistance) { m_distanceEffect.setMaxDistance(maxDistance); } |
| + void setMaxDistance(double); |
| double rolloffFactor() { return m_distanceEffect.rolloffFactor(); } |
| - void setRolloffFactor(double rolloffFactor) { m_distanceEffect.setRolloffFactor(rolloffFactor); } |
| + void setRolloffFactor(double); |
| // Sound cones - angles in degrees |
| double coneInnerAngle() const { return m_coneEffect.innerAngle(); } |
| - void setConeInnerAngle(double angle) { m_coneEffect.setInnerAngle(angle); } |
| + void setConeInnerAngle(double); |
| double coneOuterAngle() const { return m_coneEffect.outerAngle(); } |
| - void setConeOuterAngle(double angle) { m_coneEffect.setOuterAngle(angle); } |
| + void setConeOuterAngle(double); |
| double coneOuterGain() const { return m_coneEffect.outerGain(); } |
| - void setConeOuterGain(double angle) { m_coneEffect.setOuterGain(angle); } |
| + void setConeOuterGain(double); |
| + |
| + void updatePannerDirty(unsigned); |
| // It must be called on audio thread, currently called only process() in AudioBufferSourceNode. |
| double dopplerRate(); |
| @@ -122,27 +123,27 @@ public: |
| private: |
| PannerNode(AudioContext*, float sampleRate); |
| + // AudioContext's listener |
| + AudioListener* listener(); |
| + |
| bool setPanningModel(unsigned); // Returns true on success. |
| bool setDistanceModel(unsigned); // Returns true on success. |
| + |
| void calculateAzimuthElevation(double* outAzimuth, double* outElevation); |
| - // Returns the combined distance and cone gain attenuation. |
| - float calculateDistanceConeGain(); |
| + float calculateDistanceConeGain(); // Returns the combined distance and cone gain attenuation. |
| double calculateDopplerRate(); |
| void azimuthElevation(double* outAzimuth, double* outElevation); |
| float distanceConeGain(); |
| - bool isAzimuthElevationDirty(); |
| - bool isDistanceConeGainDirty(); |
| - bool isDopplerRateDirty(); |
| + bool isAzimuthElevationDirty() const { return m_isAzimuthElevationDirty; } |
| + bool isDistanceConeGainDirty() const { return m_isDistanceConeGainDirty; } |
| + bool isDopplerRateDirty() const { return m_isDopplerRateDirty; } |
| // Notifies any AudioBufferSourceNodes connected to us either directly or indirectly about our existence. |
| // This is in order to handle the pitch change necessary for the doppler shift. |
| void notifyAudioSourcesConnectedToNode(AudioNode*, HashMap<AudioNode*, bool> &visitedNodes); |
| - void updateCachedListener(); |
| - void updateCachedSourceLocationInfo(); |
| - |
| OwnPtr<Panner> m_panner; |
| unsigned m_panningModel; |
| unsigned m_distanceModel; |
| @@ -152,10 +153,9 @@ private: |
| FloatPoint3D m_orientation; |
| FloatPoint3D m_velocity; |
| - // Cached source location information |
| - FloatPoint3D m_cachedPosition; |
| - FloatPoint3D m_cachedOrientation; |
| - FloatPoint3D m_cachedVelocity; |
| + bool m_isAzimuthElevationDirty; |
| + bool m_isDistanceConeGainDirty; |
| + bool m_isDopplerRateDirty; |
| // Gain |
| DistanceEffect m_distanceEffect; |
| @@ -167,15 +167,12 @@ private: |
| float m_cachedDistanceConeGain; |
| double m_cachedDopplerRate; |
| - // Cached listener parameters after processing. |
| - RefPtr<AudioListener> m_cachedListener; |
| - |
| RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; |
| // AudioContext's connection count |
| unsigned m_connectionCount; |
| - // Synchronize process() with setting of the panning model, distance model and caching of the source location/orientation info. |
| + // Synchronize process() with setting of the panning model, source's location information, listener, distance parameters and sound cones. |
| mutable Mutex m_processLock; |
| }; |