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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return context()->listener(); | 160 return context()->listener(); |
161 } | 161 } |
162 | 162 |
163 String PannerNode::panningModel() const | 163 String PannerNode::panningModel() const |
164 { | 164 { |
165 switch (m_panningModel) { | 165 switch (m_panningModel) { |
166 case EQUALPOWER: | 166 case EQUALPOWER: |
167 return "equalpower"; | 167 return "equalpower"; |
168 case HRTF: | 168 case HRTF: |
169 return "HRTF"; | 169 return "HRTF"; |
170 case SOUNDFIELD: | |
171 return "soundfield"; | |
172 default: | 170 default: |
173 ASSERT_NOT_REACHED(); | 171 ASSERT_NOT_REACHED(); |
174 return "HRTF"; | 172 return "HRTF"; |
175 } | 173 } |
176 } | 174 } |
177 | 175 |
178 void PannerNode::setPanningModel(const String& model) | 176 void PannerNode::setPanningModel(const String& model) |
179 { | 177 { |
180 if (model == "equalpower") | 178 if (model == "equalpower") |
181 setPanningModel(EQUALPOWER); | 179 setPanningModel(EQUALPOWER); |
182 else if (model == "HRTF") | 180 else if (model == "HRTF") |
183 setPanningModel(HRTF); | 181 setPanningModel(HRTF); |
184 else if (model == "soundfield") | |
185 setPanningModel(SOUNDFIELD); | |
186 else | 182 else |
187 ASSERT_NOT_REACHED(); | 183 ASSERT_NOT_REACHED(); |
188 } | 184 } |
189 | 185 |
190 bool PannerNode::setPanningModel(unsigned model) | 186 bool PannerNode::setPanningModel(unsigned model) |
191 { | 187 { |
192 switch (model) { | 188 switch (model) { |
193 case EQUALPOWER: | 189 case EQUALPOWER: |
194 case HRTF: | 190 case HRTF: |
195 if (!m_panner.get() || model != m_panningModel) { | 191 if (!m_panner.get() || model != m_panningModel) { |
196 // This synchronizes with process(). | 192 // This synchronizes with process(). |
197 MutexLocker processLocker(m_pannerLock); | 193 MutexLocker processLocker(m_pannerLock); |
198 | 194 |
199 OwnPtr<Panner> newPanner = Panner::create(model, sampleRate(), conte
xt()->hrtfDatabaseLoader()); | 195 OwnPtr<Panner> newPanner = Panner::create(model, sampleRate(), conte
xt()->hrtfDatabaseLoader()); |
200 m_panner = newPanner.release(); | 196 m_panner = newPanner.release(); |
201 m_panningModel = model; | 197 m_panningModel = model; |
202 } | 198 } |
203 break; | 199 break; |
204 case SOUNDFIELD: | |
205 // FIXME: Implement sound field model. See // https://bugs.webkit.org/sh
ow_bug.cgi?id=77367. | |
206 context()->executionContext()->addConsoleMessage(JSMessageSource, Warnin
gMessageLevel, "'soundfield' panning model not implemented."); | |
207 break; | |
208 default: | 200 default: |
209 return false; | 201 return false; |
210 } | 202 } |
211 | 203 |
212 return true; | 204 return true; |
213 } | 205 } |
214 | 206 |
215 String PannerNode::distanceModel() const | 207 String PannerNode::distanceModel() const |
216 { | 208 { |
217 switch (const_cast<PannerNode*>(this)->m_distanceEffect.model()) { | 209 switch (const_cast<PannerNode*>(this)->m_distanceEffect.model()) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 notifyAudioSourcesConnectedToNode(connectedNode, visitedNode
s); // recurse | 403 notifyAudioSourcesConnectedToNode(connectedNode, visitedNode
s); // recurse |
412 } | 404 } |
413 } | 405 } |
414 } | 406 } |
415 } | 407 } |
416 } | 408 } |
417 | 409 |
418 } // namespace WebCore | 410 } // namespace WebCore |
419 | 411 |
420 #endif // ENABLE(WEB_AUDIO) | 412 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |