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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 static PannerNode* create(AudioContext* context, float sampleRate) | 56 static PannerNode* create(AudioContext* context, float sampleRate) |
57 { | 57 { |
58 return new PannerNode(context, sampleRate); | 58 return new PannerNode(context, sampleRate); |
59 } | 59 } |
60 | 60 |
61 virtual ~PannerNode(); | 61 virtual ~PannerNode(); |
62 | 62 |
63 // AudioNode | 63 // AudioNode |
64 virtual void dispose() override; | 64 virtual void dispose() override; |
65 virtual void process(size_t framesToProcess) override; | 65 virtual void process(size_t framesToProcess) override; |
66 virtual void pullInputs(size_t framesToProcess) override; | |
67 virtual void initialize() override; | 66 virtual void initialize() override; |
68 virtual void uninitialize() override; | 67 virtual void uninitialize() override; |
69 | 68 |
70 // Panning model | 69 // Panning model |
71 String panningModel() const; | 70 String panningModel() const; |
72 void setPanningModel(const String&); | 71 void setPanningModel(const String&); |
73 | 72 |
74 // Position, orientation and velocity | 73 // Position, orientation and velocity |
75 void setPosition(float x, float y, float z); | 74 void setPosition(float x, float y, float z); |
76 void setOrientation(float x, float y, float z); | 75 void setOrientation(float x, float y, float z); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 float calculateDistanceConeGain(); // Returns the combined distance and cone
gain attenuation. | 124 float calculateDistanceConeGain(); // Returns the combined distance and cone
gain attenuation. |
126 double calculateDopplerRate(); | 125 double calculateDopplerRate(); |
127 | 126 |
128 void azimuthElevation(double* outAzimuth, double* outElevation); | 127 void azimuthElevation(double* outAzimuth, double* outElevation); |
129 float distanceConeGain(); | 128 float distanceConeGain(); |
130 | 129 |
131 bool isAzimuthElevationDirty() const { return m_isAzimuthElevationDirty; } | 130 bool isAzimuthElevationDirty() const { return m_isAzimuthElevationDirty; } |
132 bool isDistanceConeGainDirty() const { return m_isDistanceConeGainDirty; } | 131 bool isDistanceConeGainDirty() const { return m_isDistanceConeGainDirty; } |
133 bool isDopplerRateDirty() const { return m_isDopplerRateDirty; } | 132 bool isDopplerRateDirty() const { return m_isDopplerRateDirty; } |
134 | 133 |
135 // Notifies any AudioBufferSourceNodes connected to us either directly or in
directly about our existence. | |
136 // This is in order to handle the pitch change necessary for the doppler shi
ft. | |
137 void notifyAudioSourcesConnectedToNode(AudioNode*, HashMap<AudioNode*, bool>
&visitedNodes); | |
138 | |
139 Member<Panner> m_panner; | 134 Member<Panner> m_panner; |
140 unsigned m_panningModel; | 135 unsigned m_panningModel; |
141 unsigned m_distanceModel; | 136 unsigned m_distanceModel; |
142 | 137 |
143 // Current source location information | 138 // Current source location information |
144 FloatPoint3D m_position; | 139 FloatPoint3D m_position; |
145 FloatPoint3D m_orientation; | 140 FloatPoint3D m_orientation; |
146 FloatPoint3D m_velocity; | 141 FloatPoint3D m_velocity; |
147 | 142 |
148 bool m_isAzimuthElevationDirty; | 143 bool m_isAzimuthElevationDirty; |
149 bool m_isDistanceConeGainDirty; | 144 bool m_isDistanceConeGainDirty; |
150 bool m_isDopplerRateDirty; | 145 bool m_isDopplerRateDirty; |
151 | 146 |
152 // Gain | 147 // Gain |
153 DistanceEffect m_distanceEffect; | 148 DistanceEffect m_distanceEffect; |
154 ConeEffect m_coneEffect; | 149 ConeEffect m_coneEffect; |
155 float m_lastGain; | 150 float m_lastGain; |
156 | 151 |
157 // Cached values | 152 // Cached values |
158 double m_cachedAzimuth; | 153 double m_cachedAzimuth; |
159 double m_cachedElevation; | 154 double m_cachedElevation; |
160 float m_cachedDistanceConeGain; | 155 float m_cachedDistanceConeGain; |
161 double m_cachedDopplerRate; | 156 double m_cachedDopplerRate; |
162 | 157 |
163 // AudioContext's connection count | |
164 unsigned m_connectionCount; | |
165 | |
166 // Synchronize process() with setting of the panning model, source's locatio
n information, listener, distance parameters and sound cones. | 158 // Synchronize process() with setting of the panning model, source's locatio
n information, listener, distance parameters and sound cones. |
167 mutable Mutex m_processLock; | 159 mutable Mutex m_processLock; |
168 }; | 160 }; |
169 | 161 |
170 } // namespace blink | 162 } // namespace blink |
171 | 163 |
172 #endif // PannerNode_h | 164 #endif // PannerNode_h |
OLD | NEW |