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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // It must be called on audio thread, currently called only process() in Aud
ioBufferSourceNode. |
120 double dopplerRate(); | 120 double dopplerRate(); |
121 | 121 |
122 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; } |
123 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; } |
124 | 124 |
| 125 virtual void trace(Visitor*) OVERRIDE; |
| 126 |
125 private: | 127 private: |
126 PannerNode(AudioContext*, float sampleRate); | 128 PannerNode(AudioContext*, float sampleRate); |
127 | 129 |
128 void calculateAzimuthElevation(double* outAzimuth, double* outElevation); | 130 void calculateAzimuthElevation(double* outAzimuth, double* outElevation); |
129 // Returns the combined distance and cone gain attenuation. | 131 // Returns the combined distance and cone gain attenuation. |
130 float calculateDistanceConeGain(); | 132 float calculateDistanceConeGain(); |
131 double calculateDopplerRate(); | 133 double calculateDopplerRate(); |
132 | 134 |
133 void azimuthElevation(double* outAzimuth, double* outElevation); | 135 void azimuthElevation(double* outAzimuth, double* outElevation); |
134 float distanceConeGain(); | 136 float distanceConeGain(); |
(...skipping 17 matching lines...) Expand all Loading... |
152 FloatPoint3D m_position; | 154 FloatPoint3D m_position; |
153 FloatPoint3D m_orientation; | 155 FloatPoint3D m_orientation; |
154 FloatPoint3D m_velocity; | 156 FloatPoint3D m_velocity; |
155 | 157 |
156 // Cached source location information | 158 // Cached source location information |
157 FloatPoint3D m_cachedPosition; | 159 FloatPoint3D m_cachedPosition; |
158 FloatPoint3D m_cachedOrientation; | 160 FloatPoint3D m_cachedOrientation; |
159 FloatPoint3D m_cachedVelocity; | 161 FloatPoint3D m_cachedVelocity; |
160 | 162 |
161 // Gain | 163 // Gain |
162 RefPtr<AudioParam> m_distanceGain; | 164 RefPtrWillBeMember<AudioParam> m_distanceGain; |
163 RefPtr<AudioParam> m_coneGain; | 165 RefPtrWillBeMember<AudioParam> m_coneGain; |
164 DistanceEffect m_distanceEffect; | 166 DistanceEffect m_distanceEffect; |
165 ConeEffect m_coneEffect; | 167 ConeEffect m_coneEffect; |
166 float m_lastGain; | 168 float m_lastGain; |
167 | 169 |
168 double m_cachedAzimuth; | 170 double m_cachedAzimuth; |
169 double m_cachedElevation; | 171 double m_cachedElevation; |
170 float m_cachedDistanceConeGain; | 172 float m_cachedDistanceConeGain; |
171 double m_cachedDopplerRate; | 173 double m_cachedDopplerRate; |
172 | 174 |
173 // Cached listener parameters after processing. | 175 // Cached listener parameters after processing. |
174 RefPtr<AudioListener> m_cachedListener; | 176 RefPtrWillBeMember<AudioListener> m_cachedListener; |
175 | 177 |
176 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; | 178 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; |
177 | 179 |
178 // AudioContext's connection count | 180 // AudioContext's connection count |
179 unsigned m_connectionCount; | 181 unsigned m_connectionCount; |
180 | 182 |
181 // Synchronize process() with setting of the panning model, distance model a
nd caching of the source location/orientation info. | 183 // Synchronize process() with setting of the panning model, distance model a
nd caching of the source location/orientation info. |
182 mutable Mutex m_processLock; | 184 mutable Mutex m_processLock; |
183 }; | 185 }; |
184 | 186 |
185 } // namespace WebCore | 187 } // namespace WebCore |
186 | 188 |
187 #endif // PannerNode_h | 189 #endif // PannerNode_h |
OLD | NEW |