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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 }; | 55 }; |
56 | 56 |
57 // These must be defined as in the .idl file and must match those | 57 // These must be defined as in the .idl file and must match those |
58 // in the DistanceEffect class. | 58 // in the DistanceEffect class. |
59 enum { | 59 enum { |
60 LINEAR_DISTANCE = 0, | 60 LINEAR_DISTANCE = 0, |
61 INVERSE_DISTANCE = 1, | 61 INVERSE_DISTANCE = 1, |
62 EXPONENTIAL_DISTANCE = 2, | 62 EXPONENTIAL_DISTANCE = 2, |
63 }; | 63 }; |
64 | 64 |
65 static PassRefPtr<PannerNode> create(AudioContext* context, float sampleRate
) | 65 static PassRefPtrWillBeRawPtr<PannerNode> create(AudioContext* context, floa
t sampleRate) |
66 { | 66 { |
67 return adoptRef(new PannerNode(context, sampleRate)); | 67 return adoptRefWillBeNoop(new PannerNode(context, sampleRate)); |
68 } | 68 } |
69 | 69 |
70 virtual ~PannerNode(); | 70 virtual ~PannerNode(); |
71 | 71 |
72 // AudioNode | 72 // AudioNode |
73 virtual void process(size_t framesToProcess) OVERRIDE; | 73 virtual void process(size_t framesToProcess) OVERRIDE; |
74 virtual void pullInputs(size_t framesToProcess) OVERRIDE; | 74 virtual void pullInputs(size_t framesToProcess) OVERRIDE; |
75 virtual void initialize() OVERRIDE; | 75 virtual void initialize() OVERRIDE; |
76 virtual void uninitialize() OVERRIDE; | 76 virtual void uninitialize() OVERRIDE; |
77 | 77 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 double dopplerRate(); | 119 double dopplerRate(); |
120 | 120 |
121 virtual double tailTime() const OVERRIDE { return m_panner ? m_panner->tailT
ime() : 0; } | 121 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; } | 122 virtual double latencyTime() const OVERRIDE { return m_panner ? m_panner->la
tencyTime() : 0; } |
123 | 123 |
| 124 virtual void trace(Visitor*) OVERRIDE; |
| 125 |
124 private: | 126 private: |
125 PannerNode(AudioContext*, float sampleRate); | 127 PannerNode(AudioContext*, float sampleRate); |
126 | 128 |
127 void calculateAzimuthElevation(double* outAzimuth, double* outElevation); | 129 void calculateAzimuthElevation(double* outAzimuth, double* outElevation); |
128 // Returns the combined distance and cone gain attenuation. | 130 // Returns the combined distance and cone gain attenuation. |
129 float calculateDistanceConeGain(); | 131 float calculateDistanceConeGain(); |
130 double calculateDopplerRate(); | 132 double calculateDopplerRate(); |
131 | 133 |
132 void azimuthElevation(double* outAzimuth, double* outElevation); | 134 void azimuthElevation(double* outAzimuth, double* outElevation); |
133 float distanceConeGain(); | 135 float distanceConeGain(); |
(...skipping 16 matching lines...) Expand all Loading... |
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; |
158 | 160 |
159 // Gain | 161 // Gain |
160 RefPtr<AudioParam> m_distanceGain; | 162 RefPtrWillBeMember<AudioParam> m_distanceGain; |
161 RefPtr<AudioParam> m_coneGain; | 163 RefPtrWillBeMember<AudioParam> m_coneGain; |
162 DistanceEffect m_distanceEffect; | 164 DistanceEffect m_distanceEffect; |
163 ConeEffect m_coneEffect; | 165 ConeEffect m_coneEffect; |
164 float m_lastGain; | 166 float m_lastGain; |
165 | 167 |
166 double m_cachedAzimuth; | 168 double m_cachedAzimuth; |
167 double m_cachedElevation; | 169 double m_cachedElevation; |
168 float m_cachedDistanceConeGain; | 170 float m_cachedDistanceConeGain; |
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 RefPtrWillBeMember<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() and setPanningModel() which can change the panner. |
180 mutable Mutex m_pannerLock; | 182 mutable Mutex m_pannerLock; |
181 }; | 183 }; |
182 | 184 |
183 } // namespace WebCore | 185 } // namespace WebCore |
184 | 186 |
185 #endif // PannerNode_h | 187 #endif // PannerNode_h |
OLD | NEW |