OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Sound cones - angles in degrees | 109 // Sound cones - angles in degrees |
110 double coneInnerAngle() const { return m_coneEffect.innerAngle(); } | 110 double coneInnerAngle() const { return m_coneEffect.innerAngle(); } |
111 void setConeInnerAngle(double angle) { m_coneEffect.setInnerAngle(angle); } | 111 void setConeInnerAngle(double angle) { m_coneEffect.setInnerAngle(angle); } |
112 | 112 |
113 double coneOuterAngle() const { return m_coneEffect.outerAngle(); } | 113 double coneOuterAngle() const { return m_coneEffect.outerAngle(); } |
114 void setConeOuterAngle(double angle) { m_coneEffect.setOuterAngle(angle); } | 114 void setConeOuterAngle(double angle) { m_coneEffect.setOuterAngle(angle); } |
115 | 115 |
116 double coneOuterGain() const { return m_coneEffect.outerGain(); } | 116 double coneOuterGain() const { return m_coneEffect.outerGain(); } |
117 void setConeOuterGain(double angle) { m_coneEffect.setOuterGain(angle); } | 117 void setConeOuterGain(double angle) { m_coneEffect.setOuterGain(angle); } |
118 | 118 |
| 119 // It must be called on audio thread, currently called only process() in Aud
ioBufferSourceNode. |
119 double dopplerRate(); | 120 double dopplerRate(); |
120 | 121 |
121 virtual double tailTime() const OVERRIDE { return m_panner ? m_panner->tailT
ime() : 0; } | 122 virtual double tailTime() const OVERRIDE { return m_panner ? m_panner->tailT
ime() : 0; } |
122 virtual double latencyTime() const OVERRIDE { return m_panner ? m_panner->la
tencyTime() : 0; } | 123 virtual double latencyTime() const OVERRIDE { return m_panner ? m_panner->la
tencyTime() : 0; } |
123 | 124 |
124 private: | 125 private: |
125 PannerNode(AudioContext*, float sampleRate); | 126 PannerNode(AudioContext*, float sampleRate); |
126 | 127 |
127 void calculateAzimuthElevation(double* outAzimuth, double* outElevation); | 128 void calculateAzimuthElevation(double* outAzimuth, double* outElevation); |
128 // Returns the combined distance and cone gain attenuation. | 129 // Returns the combined distance and cone gain attenuation. |
129 float calculateDistanceConeGain(); | 130 float calculateDistanceConeGain(); |
130 double calculateDopplerRate(); | 131 double calculateDopplerRate(); |
131 | 132 |
132 void azimuthElevation(double* outAzimuth, double* outElevation); | 133 void azimuthElevation(double* outAzimuth, double* outElevation); |
133 float distanceConeGain(); | 134 float distanceConeGain(); |
134 | 135 |
135 bool isAzimuthElevationDirty(); | 136 bool isAzimuthElevationDirty(); |
136 bool isDistanceConeGainDirty(); | 137 bool isDistanceConeGainDirty(); |
137 bool isDopplerRateDirty(); | 138 bool isDopplerRateDirty(); |
138 | 139 |
139 // Notifies any AudioBufferSourceNodes connected to us either directly or in
directly about our existence. | 140 // Notifies any AudioBufferSourceNodes connected to us either directly or in
directly about our existence. |
140 // This is in order to handle the pitch change necessary for the doppler shi
ft. | 141 // This is in order to handle the pitch change necessary for the doppler shi
ft. |
141 void notifyAudioSourcesConnectedToNode(AudioNode*, HashMap<AudioNode*, bool>
&visitedNodes); | 142 void notifyAudioSourcesConnectedToNode(AudioNode*, HashMap<AudioNode*, bool>
&visitedNodes); |
142 | 143 |
143 void updateCachedListener(); | 144 void updateCachedListener(); |
144 void updateCachedSourceLocationInfo(); | 145 void updateCachedSourceLocationInfo(); |
145 | 146 |
146 OwnPtr<Panner> m_panner; | 147 OwnPtr<Panner> m_panner; |
147 unsigned m_panningModel; | 148 unsigned m_panningModel; |
| 149 unsigned m_distanceModel; |
148 | 150 |
149 // Current source location information | 151 // Current source location information |
150 FloatPoint3D m_position; | 152 FloatPoint3D m_position; |
151 FloatPoint3D m_orientation; | 153 FloatPoint3D m_orientation; |
152 FloatPoint3D m_velocity; | 154 FloatPoint3D m_velocity; |
153 | 155 |
154 // Cached source location information | 156 // Cached source location information |
155 FloatPoint3D m_cachedPosition; | 157 FloatPoint3D m_cachedPosition; |
156 FloatPoint3D m_cachedOrientation; | 158 FloatPoint3D m_cachedOrientation; |
157 FloatPoint3D m_cachedVelocity; | 159 FloatPoint3D m_cachedVelocity; |
(...skipping 11 matching lines...) Expand all Loading... |
169 double m_cachedDopplerRate; | 171 double m_cachedDopplerRate; |
170 | 172 |
171 // Cached listener parameters after processing. | 173 // Cached listener parameters after processing. |
172 RefPtr<AudioListener> m_cachedListener; | 174 RefPtr<AudioListener> m_cachedListener; |
173 | 175 |
174 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; | 176 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; |
175 | 177 |
176 // AudioContext's connection count | 178 // AudioContext's connection count |
177 unsigned m_connectionCount; | 179 unsigned m_connectionCount; |
178 | 180 |
179 // Synchronize process() and setPanningModel() which can change the panner. | 181 // Synchronize process() with setting of the panning model, distance model a
nd caching of the source location/orientation info. |
180 mutable Mutex m_pannerLock; | 182 mutable Mutex m_processLock; |
181 }; | 183 }; |
182 | 184 |
183 } // namespace WebCore | 185 } // namespace WebCore |
184 | 186 |
185 #endif // PannerNode_h | 187 #endif // PannerNode_h |
OLD | NEW |