| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 framesToProcess, | 231 framesToProcess, |
| 232 internalChannelInterpretation()); | 232 internalChannelInterpretation()); |
| 233 destination->copyWithSampleAccurateGainValuesFrom(*destination, totalGain, | 233 destination->copyWithSampleAccurateGainValuesFrom(*destination, totalGain, |
| 234 framesToProcess); | 234 framesToProcess); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void PannerHandler::initialize() { | 237 void PannerHandler::initialize() { |
| 238 if (isInitialized()) | 238 if (isInitialized()) |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 m_panner = Panner::create(m_panningModel, sampleRate(), | 241 m_panner = Panner::create(m_panningModel, context()->sampleRate(), |
| 242 listener()->hrtfDatabaseLoader()); | 242 listener()->hrtfDatabaseLoader()); |
| 243 listener()->addPanner(*this); | 243 listener()->addPanner(*this); |
| 244 | 244 |
| 245 // Set the cached values to the current values to start things off. The | 245 // Set the cached values to the current values to start things off. The |
| 246 // panner is already marked as dirty, so this won't matter. | 246 // panner is already marked as dirty, so this won't matter. |
| 247 m_lastPosition = position(); | 247 m_lastPosition = position(); |
| 248 m_lastOrientation = orientation(); | 248 m_lastOrientation = orientation(); |
| 249 | 249 |
| 250 AudioHandler::initialize(); | 250 AudioHandler::initialize(); |
| 251 } | 251 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // Load the HRTF database asynchronously so we don't block the | 297 // Load the HRTF database asynchronously so we don't block the |
| 298 // Javascript thread while creating the HRTF database. It's ok to call | 298 // Javascript thread while creating the HRTF database. It's ok to call |
| 299 // this multiple times; we won't be constantly loading the database over | 299 // this multiple times; we won't be constantly loading the database over |
| 300 // and over. | 300 // and over. |
| 301 listener()->createAndLoadHRTFDatabaseLoader(context()->sampleRate()); | 301 listener()->createAndLoadHRTFDatabaseLoader(context()->sampleRate()); |
| 302 } | 302 } |
| 303 | 303 |
| 304 if (!m_panner.get() || model != m_panningModel) { | 304 if (!m_panner.get() || model != m_panningModel) { |
| 305 // This synchronizes with process(). | 305 // This synchronizes with process(). |
| 306 MutexLocker processLocker(m_processLock); | 306 MutexLocker processLocker(m_processLock); |
| 307 m_panner = | 307 m_panner = Panner::create(model, context()->sampleRate(), |
| 308 Panner::create(model, sampleRate(), listener()->hrtfDatabaseLoader()); | 308 listener()->hrtfDatabaseLoader()); |
| 309 m_panningModel = model; | 309 m_panningModel = model; |
| 310 } | 310 } |
| 311 return true; | 311 return true; |
| 312 } | 312 } |
| 313 | 313 |
| 314 String PannerHandler::distanceModel() const { | 314 String PannerHandler::distanceModel() const { |
| 315 switch (const_cast<PannerHandler*>(this)->m_distanceEffect.model()) { | 315 switch (const_cast<PannerHandler*>(this)->m_distanceEffect.model()) { |
| 316 case DistanceEffect::ModelLinear: | 316 case DistanceEffect::ModelLinear: |
| 317 return "linear"; | 317 return "linear"; |
| 318 case DistanceEffect::ModelInverse: | 318 case DistanceEffect::ModelInverse: |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 visitor->trace(m_positionZ); | 775 visitor->trace(m_positionZ); |
| 776 | 776 |
| 777 visitor->trace(m_orientationX); | 777 visitor->trace(m_orientationX); |
| 778 visitor->trace(m_orientationY); | 778 visitor->trace(m_orientationY); |
| 779 visitor->trace(m_orientationZ); | 779 visitor->trace(m_orientationZ); |
| 780 | 780 |
| 781 AudioNode::trace(visitor); | 781 AudioNode::trace(visitor); |
| 782 } | 782 } |
| 783 | 783 |
| 784 } // namespace blink | 784 } // namespace blink |
| OLD | NEW |