Chromium Code Reviews| Index: Source/modules/webaudio/PannerNode.cpp |
| diff --git a/Source/modules/webaudio/PannerNode.cpp b/Source/modules/webaudio/PannerNode.cpp |
| index 0fd7edc8a1219fd8a180e144c525e3b20eeb2395..5c7abf7dd7e2ce23a9ade70ce213a5d6162ab449 100644 |
| --- a/Source/modules/webaudio/PannerNode.cpp |
| +++ b/Source/modules/webaudio/PannerNode.cpp |
| @@ -29,6 +29,7 @@ |
| #include "modules/webaudio/PannerNode.h" |
| #include "core/dom/ExecutionContext.h" |
| +#include "platform/audio/HRTFDatabaseLoader.h" |
| #include "platform/audio/HRTFPanner.h" |
| #include "modules/webaudio/AudioBufferSourceNode.h" |
| #include "modules/webaudio/AudioContext.h" |
| @@ -63,7 +64,7 @@ PannerNode::PannerNode(AudioContext* context, float sampleRate) |
| { |
| // Load the HRTF database asynchronously so we don't block the Javascript thread while creating the HRTF database. |
| // The HRTF panner will return zeroes until the database is loaded. |
| - m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(context->sampleRate()); |
| + listener()->createAndLoadHRTFDatabaseLoader(context->sampleRate()); |
| ScriptWrappable::init(this); |
| addInput(); |
| @@ -123,9 +124,9 @@ void PannerNode::process(size_t framesToProcess) |
| if (tryLocker.locked() && tryListenerLocker.locked()) { |
| // HRTFDatabase should be loaded before proceeding for offline audio context when the panning model is HRTF. |
| - if (m_panningModel == Panner::PanningModelHRTF && !m_hrtfDatabaseLoader->isLoaded()) { |
| + if (m_panningModel == Panner::PanningModelHRTF && !hrtfDatabaseLoader()->isLoaded()) { |
|
Raymond Toy
2014/07/17 17:25:45
Since the HRTF database is loaded in the listener,
|
| if (context()->isOfflineContext()) { |
| - m_hrtfDatabaseLoader->waitForLoaderThreadCompletion(); |
| + hrtfDatabaseLoader()->waitForLoaderThreadCompletion(); |
|
Raymond Toy
2014/07/17 17:25:46
Same as above. Maybe use listener()->waitForHRTFL
|
| } else { |
| destination->zero(); |
| return; |
| @@ -160,7 +161,7 @@ void PannerNode::initialize() |
| if (isInitialized()) |
| return; |
| - m_panner = Panner::create(m_panningModel, sampleRate(), m_hrtfDatabaseLoader.get()); |
| + m_panner = Panner::create(m_panningModel, sampleRate(), hrtfDatabaseLoader()); |
| listener()->addPanner(this); |
| AudioNode::initialize(); |
| @@ -211,7 +212,7 @@ bool PannerNode::setPanningModel(unsigned model) |
| if (!m_panner.get() || model != m_panningModel) { |
| // This synchronizes with process(). |
| MutexLocker processLocker(m_processLock); |
| - OwnPtr<Panner> newPanner = Panner::create(model, sampleRate(), m_hrtfDatabaseLoader.get()); |
| + OwnPtr<Panner> newPanner = Panner::create(model, sampleRate(), hrtfDatabaseLoader()); |
| m_panner = newPanner.release(); |
| m_panningModel = model; |
| } |