CSL  5.2
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>

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

 HRTFDatabase (const char *folder)
 constructor that loads from a folder (protected)
void loadFromFolder (const char *folder) throw (CException)
 load a set of HRTFs from a folder or a file list file
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
unsigned mWindowSize
 FFT sizes (1024)
unsigned mHRTFLength
 513
unsigned mHRIRLength
 The length of the Head Related Impulse Response (8192)

Static Protected Attributes

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

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)

Definition at line 196 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 163 of file BinauralDB.cpp.

void HRTFDatabase::Reload ( char *  folder)
static

load the singleton from the given data folder

Definition at line 184 of file BinauralDB.cpp.

Referenced by convertDB().

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

bulk-convert DBs

Definition at line 541 of file BinauralDB.cpp.

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

unsigned HRTFDatabase::numHRTFs ( )

Total number of HRTFs loaded into the database.

Definition at line 460 of file BinauralDB.cpp.

unsigned HRTFDatabase::windowSize ( )

The size of the analysis window (in samples).

Definition at line 466 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 472 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 478 of file BinauralDB.cpp.

unsigned HRTFDatabase::numBlocks ( )

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

Definition at line 484 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 437 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 426 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 406 of file BinauralDB.cpp.

References csl::logMsg().

unsigned HRTFDatabase::size ( )

returns the size on bytes of the receiver's storage

dump the DB as a single binary file

Definition at line 417 of file BinauralDB.cpp.

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

Definition at line 498 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

load a set of HRTFs from a folder or a file list file

Definition at line 243 of file BinauralDB.cpp.

References CSL_NAME_LEN, and FLIST_NAME.

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

Definition at line 252 of file BinauralDB.cpp.

References csl::CSL_FFT_COMPLEX, CSL_NAME_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 160 of file BinauralDB.h.

unsigned csl::HRTFDatabase::mWindowSize
protected

FFT sizes (1024)

Definition at line 162 of file BinauralDB.h.

unsigned csl::HRTFDatabase::mHRTFLength
protected

513

Definition at line 163 of file BinauralDB.h.

unsigned csl::HRTFDatabase::mHRIRLength
protected

The length of the Head Related Impulse Response (8192)

Definition at line 164 of file BinauralDB.h.

HRTFDatabase * HRTFDatabase::mDatabase = 0
staticprotected

The protected single instance of the HRTF Database.

HRTFDatabase.

Definition at line 166 of file BinauralDB.h.


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