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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 }; | 54 }; |
55 | 55 |
56 // These must be defined as in the .idl file and must match those | 56 // These must be defined as in the .idl file and must match those |
57 // in the DistanceEffect class. | 57 // in the DistanceEffect class. |
58 enum { | 58 enum { |
59 LINEAR_DISTANCE = 0, | 59 LINEAR_DISTANCE = 0, |
60 INVERSE_DISTANCE = 1, | 60 INVERSE_DISTANCE = 1, |
61 EXPONENTIAL_DISTANCE = 2, | 61 EXPONENTIAL_DISTANCE = 2, |
62 }; | 62 }; |
63 | 63 |
64 static PassRefPtr<PannerNode> create(AudioContext* context, float sampleRate
) | 64 static PassRefPtrWillBeRawPtr<PannerNode> create(AudioContext* context, floa
t sampleRate) |
65 { | 65 { |
66 return adoptRef(new PannerNode(context, sampleRate)); | 66 return adoptRefWillBeNoop(new PannerNode(context, sampleRate)); |
67 } | 67 } |
68 | 68 |
69 virtual ~PannerNode(); | 69 virtual ~PannerNode(); |
70 | 70 |
71 // AudioNode | 71 // AudioNode |
72 virtual void process(size_t framesToProcess) OVERRIDE; | 72 virtual void process(size_t framesToProcess) OVERRIDE; |
73 virtual void pullInputs(size_t framesToProcess) OVERRIDE; | 73 virtual void pullInputs(size_t framesToProcess) OVERRIDE; |
74 virtual void initialize() OVERRIDE; | 74 virtual void initialize() OVERRIDE; |
75 virtual void uninitialize() OVERRIDE; | 75 virtual void uninitialize() OVERRIDE; |
76 | 76 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 double coneOuterGain() const { return m_coneEffect.outerGain(); } | 113 double coneOuterGain() const { return m_coneEffect.outerGain(); } |
114 void setConeOuterGain(double angle) { m_coneEffect.setOuterGain(angle); } | 114 void setConeOuterGain(double angle) { m_coneEffect.setOuterGain(angle); } |
115 | 115 |
116 // It must be called on audio thread, currently called only process() in Aud
ioBufferSourceNode. | 116 // It must be called on audio thread, currently called only process() in Aud
ioBufferSourceNode. |
117 double dopplerRate(); | 117 double dopplerRate(); |
118 | 118 |
119 virtual double tailTime() const OVERRIDE { return m_panner ? m_panner->tailT
ime() : 0; } | 119 virtual double tailTime() const OVERRIDE { return m_panner ? m_panner->tailT
ime() : 0; } |
120 virtual double latencyTime() const OVERRIDE { return m_panner ? m_panner->la
tencyTime() : 0; } | 120 virtual double latencyTime() const OVERRIDE { return m_panner ? m_panner->la
tencyTime() : 0; } |
121 | 121 |
| 122 virtual void trace(Visitor*) OVERRIDE; |
| 123 |
122 private: | 124 private: |
123 PannerNode(AudioContext*, float sampleRate); | 125 PannerNode(AudioContext*, float sampleRate); |
124 | 126 |
125 bool setPanningModel(unsigned); // Returns true on success. | 127 bool setPanningModel(unsigned); // Returns true on success. |
126 bool setDistanceModel(unsigned); // Returns true on success. | 128 bool setDistanceModel(unsigned); // Returns true on success. |
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 |
(...skipping 29 matching lines...) Expand all Loading... |
161 DistanceEffect m_distanceEffect; | 163 DistanceEffect m_distanceEffect; |
162 ConeEffect m_coneEffect; | 164 ConeEffect m_coneEffect; |
163 float m_lastGain; | 165 float m_lastGain; |
164 | 166 |
165 double m_cachedAzimuth; | 167 double m_cachedAzimuth; |
166 double m_cachedElevation; | 168 double m_cachedElevation; |
167 float m_cachedDistanceConeGain; | 169 float m_cachedDistanceConeGain; |
168 double m_cachedDopplerRate; | 170 double m_cachedDopplerRate; |
169 | 171 |
170 // Cached listener parameters after processing. | 172 // Cached listener parameters after processing. |
171 RefPtr<AudioListener> m_cachedListener; | 173 RefPtrWillBeMember<AudioListener> m_cachedListener; |
172 | 174 |
173 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; | 175 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; |
174 | 176 |
175 // AudioContext's connection count | 177 // AudioContext's connection count |
176 unsigned m_connectionCount; | 178 unsigned m_connectionCount; |
177 | 179 |
178 // Synchronize process() with setting of the panning model, distance model a
nd caching of the source location/orientation info. | 180 // Synchronize process() with setting of the panning model, distance model a
nd caching of the source location/orientation info. |
179 mutable Mutex m_processLock; | 181 mutable Mutex m_processLock; |
180 }; | 182 }; |
181 | 183 |
182 } // namespace WebCore | 184 } // namespace WebCore |
183 | 185 |
184 #endif // PannerNode_h | 186 #endif // PannerNode_h |
OLD | NEW |