CSL  6.0
csl::HRTFDatabase Class Reference

HRTFDatabase: has a vector of HRTFs and can access them by position – hrtfAt(CPoint) – or by index – hrtfAt(unsigned). Implemented as a Singleton because it's large (typ 188 HRTFs, 25 MB). Create it with a folder/resource name, it reads "files.txt" for a list of HRIR files to load. This has a number of file/folder/DB IO methods for load/store of bulk HRTF data sets in IRCAM format and CSL's pre-processed HRTF.dat files. More...

#include <BinauralDB.h>

Public Member Functions

 ~HRTFDatabase ()
 
unsigned numHRTFs ()
 Total number of HRTFs loaded into the database. More...
 
unsigned windowSize ()
 The size of the analysis window (in samples). More...
 
unsigned hrtfLength ()
 The length (in samples) of the Transfer Function buffer. More...
 
unsigned hrirLength ()
 The length (in samples) of the impulse responses loaded. More...
 
unsigned numBlocks ()
 The length (in windows) of the impulse responses loaded. More...
 
unsigned hrtfAt (CPoint srcPos)
 answer the index of the HRTF nearest the given point More...
 
HRTFhrtfAt (unsigned index)
 answer an HRTF* by index More...
 
void dump (bool verbose=false)
 Print all the HRTFs in the database. More...
 
unsigned size ()
 returns the size on bytes of the receiver's storage More...
 
void storeToDB (const char *filename, const char *same) throw (CException)
 

Static Public Member Functions

static HRTFDatabaseDatabase ()
 accessor for the singleton instance (lazy init) More...
 
static void Destroy ()
 free the instance More...
 
static void Reload (char *folder)
 load the singleton from the given data folder More...
 
static void convertDB (const char *listname) throw (CException)
 bulk-convert DBs More...
 

Protected Member Functions

 HRTFDatabase (const char *folder)
 constructor that loads from a folder (protected) load a set of HRTFs from a folder or a file list file More...
 
void loadFromFolder (const char *folder) throw (CException)
 
void loadFromFile (const char *filename) throw (CException)
 
void loadFromDB (const char *dbName) throw (CException)
 

Protected Attributes

HRTFVector mHRTFVector
 vector of the HRTFs that constitute the database More...
 
unsigned mWindowSize
 FFT sizes (1024) More...
 
unsigned mHRTFLength
 513 More...
 
unsigned mHRIRLength
 The length of the Head Related Impulse Response (8192) More...
 

Static Protected Attributes

static HRTFDatabasemDatabase = 0
 The protected single instance of the HRTF Database. More...
 

Detailed Description

HRTFDatabase: has a vector of HRTFs and can access them by position – hrtfAt(CPoint) – or by index – hrtfAt(unsigned). Implemented as a Singleton because it's large (typ 188 HRTFs, 25 MB). Create it with a folder/resource name, it reads "files.txt" for a list of HRIR files to load. This has a number of file/folder/DB IO methods for load/store of bulk HRTF data sets in IRCAM format and CSL's pre-processed HRTF.dat files.

Definition at line 128 of file BinauralDB.h.

Constructor & Destructor Documentation

csl::HRTFDatabase::~HRTFDatabase ( )
inline

Definition at line 130 of file BinauralDB.h.

HRTFDatabase::HRTFDatabase ( const char *  folder)
protected

constructor that loads from a folder (protected) load a set of HRTFs from a folder or a file list file

Definition at line 194 of file BinauralDB.cpp.

References CSL_NAME_LEN, HRIR_SIZE, HRTF_BLOCK_SIZE, csl::kLogError, csl::logMsg(), and csl::CException::mMessage.

Member Function Documentation

HRTFDatabase * HRTFDatabase::Database ( )
static
void HRTFDatabase::Destroy ( )
static

free the instance

Definition at line 161 of file BinauralDB.cpp.

void HRTFDatabase::Reload ( char *  folder)
static

load the singleton from the given data folder

Definition at line 182 of file BinauralDB.cpp.

Referenced by convertDB().

void HRTFDatabase::convertDB ( const char *  listname)
throw (CException
)
static

bulk-convert DBs

Definition at line 538 of file BinauralDB.cpp.

References CSL_NAME_LEN, Database(), csl::CGestalt::dataFolder(), len, csl::logMsg(), Reload(), size, and storeToDB().

unsigned HRTFDatabase::numHRTFs ( )

Total number of HRTFs loaded into the database.

Definition at line 457 of file BinauralDB.cpp.

unsigned HRTFDatabase::windowSize ( )

The size of the analysis window (in samples).

Definition at line 463 of file BinauralDB.cpp.

Referenced by csl::BinauralPanner::BinauralPanner(), and csl::BinauralPanner::nextBuffer().

unsigned HRTFDatabase::hrtfLength ( )

The length (in samples) of the Transfer Function buffer.

Definition at line 469 of file BinauralDB.cpp.

Referenced by csl::BinauralPanner::BinauralPanner(), csl::BinauralSourceCache::BinauralSourceCache(), and csl::BinauralPanner::nextBuffer().

unsigned HRTFDatabase::hrirLength ( )

The length (in samples) of the impulse responses loaded.

Definition at line 475 of file BinauralDB.cpp.

unsigned HRTFDatabase::numBlocks ( )

The length (in windows) of the impulse responses loaded.

Definition at line 481 of file BinauralDB.cpp.

Referenced by csl::BinauralPanner::BinauralPanner().

unsigned HRTFDatabase::hrtfAt ( CPoint  srcPos)

answer the index of the HRTF nearest the given point

Definition at line 434 of file BinauralDB.cpp.

References csl::CPoint::distance2(), csl::kLogError, csl::logMsg(), and csl::CPoint::normalize().

Referenced by csl::BinauralPanner::nextBuffer().

HRTF * HRTFDatabase::hrtfAt ( unsigned  index)

answer an HRTF* by index

Definition at line 423 of file BinauralDB.cpp.

References csl::kLogError, and csl::logMsg().

void HRTFDatabase::dump ( bool  verbose = false)

Print all the HRTFs in the database.

Definition at line 403 of file BinauralDB.cpp.

References csl::logMsg(), and size.

unsigned HRTFDatabase::size ( )

returns the size on bytes of the receiver's storage

dump the DB as a single binary file

Definition at line 414 of file BinauralDB.cpp.

References size.

void HRTFDatabase::storeToDB ( const char *  filename,
const char *  same 
)
throw (CException
)

Definition at line 495 of file BinauralDB.cpp.

References CSL_DEGS_PER_RAD, csl::HRTF::mHrtfL, and csl::HRTF::mHrtfR.

Referenced by convertDB().

void HRTFDatabase::loadFromFolder ( const char *  folder)
throw (CException
)
protected

Definition at line 240 of file BinauralDB.cpp.

References CSL_NAME_LEN, and FLIST_NAME.

void HRTFDatabase::loadFromFile ( const char *  filename)
throw (CException
)
protected

Definition at line 249 of file BinauralDB.cpp.

References csl::CSL_FFT_COMPLEX, CSL_NAME_LEN, len, and csl::logMsg().

void HRTFDatabase::loadFromDB ( const char *  dbName)
throw (CException
)
protected

Member Data Documentation

HRTFVector csl::HRTFDatabase::mHRTFVector
protected

vector of the HRTFs that constitute the database

Definition at line 159 of file BinauralDB.h.

unsigned csl::HRTFDatabase::mWindowSize
protected

FFT sizes (1024)

Definition at line 161 of file BinauralDB.h.

unsigned csl::HRTFDatabase::mHRTFLength
protected

513

Definition at line 162 of file BinauralDB.h.

unsigned csl::HRTFDatabase::mHRIRLength
protected

The length of the Head Related Impulse Response (8192)

Definition at line 163 of file BinauralDB.h.

HRTFDatabase * HRTFDatabase::mDatabase = 0
staticprotected

The protected single instance of the HRTF Database.

HRTFDatabase.

Definition at line 165 of file BinauralDB.h.


The documentation for this class was generated from the following files: