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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 { | 137 { |
138 m_lastGain = -1.0; // force to snap to initial gain | 138 m_lastGain = -1.0; // force to snap to initial gain |
139 if (m_panner.get()) | 139 if (m_panner.get()) |
140 m_panner->reset(); | 140 m_panner->reset(); |
141 } | 141 } |
142 | 142 |
143 void PannerNode::initialize() | 143 void PannerNode::initialize() |
144 { | 144 { |
145 if (isInitialized()) | 145 if (isInitialized()) |
146 return; | 146 return; |
147 | 147 |
148 m_panner = Panner::create(m_panningModel, sampleRate()); | 148 HRTFDatabase* database = context()->hrtfDatabaseLoader()->database(); |
Ken Russell (switch to Gerrit)
2013/05/11 01:35:16
There's a race condition in the fetching of the HR
Chris Rogers
2013/05/13 20:05:22
Good point, I'll switch this back to the previous
| |
149 m_panner = Panner::create(m_panningModel, sampleRate(), database); | |
149 | 150 |
150 AudioNode::initialize(); | 151 AudioNode::initialize(); |
151 } | 152 } |
152 | 153 |
153 void PannerNode::uninitialize() | 154 void PannerNode::uninitialize() |
154 { | 155 { |
155 if (!isInitialized()) | 156 if (!isInitialized()) |
156 return; | 157 return; |
157 | 158 |
158 m_panner.clear(); | 159 m_panner.clear(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 } | 193 } |
193 | 194 |
194 bool PannerNode::setPanningModel(unsigned model) | 195 bool PannerNode::setPanningModel(unsigned model) |
195 { | 196 { |
196 switch (model) { | 197 switch (model) { |
197 case EQUALPOWER: | 198 case EQUALPOWER: |
198 case HRTF: | 199 case HRTF: |
199 if (!m_panner.get() || model != m_panningModel) { | 200 if (!m_panner.get() || model != m_panningModel) { |
200 // This synchronizes with process(). | 201 // This synchronizes with process(). |
201 MutexLocker processLocker(m_pannerLock); | 202 MutexLocker processLocker(m_pannerLock); |
202 | 203 |
203 OwnPtr<Panner> newPanner = Panner::create(model, sampleRate()); | 204 HRTFDatabase* database = context()->hrtfDatabaseLoader()->database() ; |
205 OwnPtr<Panner> newPanner = Panner::create(model, sampleRate(), datab ase); | |
204 m_panner = newPanner.release(); | 206 m_panner = newPanner.release(); |
205 m_panningModel = model; | 207 m_panningModel = model; |
206 } | 208 } |
207 break; | 209 break; |
208 case SOUNDFIELD: | 210 case SOUNDFIELD: |
209 // FIXME: Implement sound field model. See // https://bugs.webkit.org/sh ow_bug.cgi?id=77367. | 211 // FIXME: Implement sound field model. See // https://bugs.webkit.org/sh ow_bug.cgi?id=77367. |
210 context()->scriptExecutionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel, "'soundfield' panning model not implemented."); | 212 context()->scriptExecutionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel, "'soundfield' panning model not implemented."); |
211 break; | 213 break; |
212 default: | 214 default: |
213 return false; | 215 return false; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 AudioNode* connectedNode = connectedOutput->node(); | 410 AudioNode* connectedNode = connectedOutput->node(); |
409 notifyAudioSourcesConnectedToNode(connectedNode); // recurse | 411 notifyAudioSourcesConnectedToNode(connectedNode); // recurse |
410 } | 412 } |
411 } | 413 } |
412 } | 414 } |
413 } | 415 } |
414 | 416 |
415 } // namespace WebCore | 417 } // namespace WebCore |
416 | 418 |
417 #endif // ENABLE(WEB_AUDIO) | 419 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |