Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1557)

Unified Diff: Source/core/platform/audio/HRTFPanner.cpp

Issue 14636011: Support multiple HRTFDatabases for different sample-rates (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add ASSERT(isMainThread()) Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/platform/audio/HRTFPanner.h ('k') | Source/core/platform/audio/Panner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/audio/HRTFPanner.cpp
diff --git a/Source/core/platform/audio/HRTFPanner.cpp b/Source/core/platform/audio/HRTFPanner.cpp
index 44c859842a5d1b8e21aeeaa5c0711acc641f2ca0..39c13d2d39045c20d20c67eac4b46a61a297aeb6 100644
--- a/Source/core/platform/audio/HRTFPanner.cpp
+++ b/Source/core/platform/audio/HRTFPanner.cpp
@@ -32,7 +32,6 @@
#include "core/platform/audio/AudioBus.h"
#include "core/platform/audio/FFTConvolver.h"
#include "core/platform/audio/HRTFDatabase.h"
-#include "core/platform/audio/HRTFDatabaseLoader.h"
#include <wtf/MathExtras.h>
#include <wtf/RefPtr.h>
@@ -47,8 +46,9 @@ const double MaxDelayTimeSeconds = 0.002;
const int UninitializedAzimuth = -1;
const unsigned RenderingQuantum = 128;
-HRTFPanner::HRTFPanner(float sampleRate)
+HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader)
: Panner(PanningModelHRTF)
+ , m_databaseLoader(databaseLoader)
, m_sampleRate(sampleRate)
, m_crossfadeSelection(CrossfadeSelection1)
, m_azimuthIndex1(UninitializedAzimuth)
@@ -68,6 +68,7 @@ HRTFPanner::HRTFPanner(float sampleRate)
, m_tempL2(RenderingQuantum)
, m_tempR2(RenderingQuantum)
{
+ ASSERT(databaseLoader);
}
HRTFPanner::~HRTFPanner()
@@ -100,7 +101,7 @@ int HRTFPanner::calculateDesiredAzimuthIndexAndBlend(double azimuth, double& azi
if (azimuth < 0)
azimuth += 360.0;
- HRTFDatabase* database = HRTFDatabaseLoader::defaultHRTFDatabase();
+ HRTFDatabase* database = m_databaseLoader->database();
ASSERT(database);
int numberOfAzimuths = database->numberOfAzimuths();
@@ -134,8 +135,7 @@ void HRTFPanner::pan(double desiredAzimuth, double elevation, const AudioBus* in
return;
}
- // This code only runs as long as the context is alive and after database has been loaded.
- HRTFDatabase* database = HRTFDatabaseLoader::defaultHRTFDatabase();
+ HRTFDatabase* database = m_databaseLoader->database();
ASSERT(database);
if (!database) {
outputBus->zero();
« no previous file with comments | « Source/core/platform/audio/HRTFPanner.h ('k') | Source/core/platform/audio/Panner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698