HoaLibrary  2.0
High Order Ambisonics Library
 All Classes Namespaces Functions Enumerations Enumerator
Public Types | Public Member Functions | List of all members
Hoa2D::DecoderBinaural Class Reference

The ambisonic binaural decoder. More...

#include <Decoder.h>

Inheritance diagram for Hoa2D::DecoderBinaural:
Hoa2D::Ambisonic Hoa2D::Planewaves

Public Types

enum  PinnaSize { Small = 0, Large = 1 }
 

Public Member Functions

 DecoderBinaural (unsigned int order)
 The binaural decoder constructor. More...
 
 ~DecoderBinaural ()
 The binaural decoder destructor. More...
 
void setSampleRate (unsigned int sampleRate)
 Set the sample rate. More...
 
void setVectorSize (unsigned int vectorSize)
 Set the vector size. More...
 
bool getState () const
 Retrieve if the decoder is ready to process. More...
 
void setPinnaSize (PinnaSize pinnaSize)
 Set the pinna size. More...
 
PinnaSize getPinnaSize () const
 Retrieve the pinna size. More...
 
std::string getChannelName (unsigned int index)
 Retrieve a name for a channel. More...
 
void process (const float *const *inputs, float **outputs)
 This method performs the binaural decoding with single precision. More...
 
void process (const double *const *inputs, double **outputs)
 This method performs the binaural decoding with double precision. More...
 
- Public Member Functions inherited from Hoa2D::Ambisonic
 Ambisonic (unsigned int order)
 The ambisonic constructor. More...
 
 ~Ambisonic ()
 The ambisonic destructor. More...
 
unsigned int getOrder () const
 Retrieve the decomposition order. More...
 
unsigned int getNumberOfHarmonics () const
 Retrieve the number of harmonics. More...
 
long getHarmonicArgument (unsigned int index) const
 Retrieve the argument of an harmonic. More...
 
long getHarmonicBand (unsigned int index) const
 Retrieve the band of an harmonic. More...
 
std::string getHarmonicsName (unsigned int index) const
 Retrieve a name for an harmonic. More...
 
- Public Member Functions inherited from Hoa2D::Planewaves
 Planewaves (unsigned int numberOfChannels)
 The planewaves constructor. More...
 
 ~Planewaves ()
 The planewaves destructor. More...
 
unsigned int getNumberOfChannels () const
 Retrieve the number of channels. More...
 
double getChannelAzimuth (unsigned int index) const
 Retrieve the azimuth of a channel. More...
 
double getChannelAbscissa (unsigned int index) const
 Retrieve the abscissa of a channel. More...
 
double getChannelOrdinate (unsigned int index) const
 Retrieve the ordinate of a channel. More...
 
std::string getChannelName (unsigned int index)
 Retrieve a name for a channel. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Hoa2D::Planewaves
void setChannelAzimuth (unsigned int index, double azimuth)
 Set the azimuth of a channel. More...
 
void setChannelsAzimuth (double *azimuths)
 Set the azimtuh of all the channels. More...
 

Detailed Description

The ambisonic binaural decoder.

The binaural decoder should be used to decode an ambisonic sound field for headphones.

Definition at line 172 of file Decoder.h.

Member Enumeration Documentation

Enumerator
Small 

Small Pinna Size

Large 

Large Pinna Size

Definition at line 176 of file Decoder.h.

Constructor & Destructor Documentation

Hoa2D::DecoderBinaural::DecoderBinaural ( unsigned int  order)

The binaural decoder constructor.

The binaural decoder constructor allocates and initialize the member values to the decoding matrix depending of a decomposition order and a number of channels. The order and the number of channels must be at least 1 and the maximum order is 35. It is essential to set the sample rate and the vector size to load the impulse response and to be able to use the binaural decoding. The binaural process is optimized for block processing. The HRTF are from the MIT database.

Parameters
orderThe order

Definition at line 203 of file Decoder.cpp.

Hoa2D::DecoderBinaural::~DecoderBinaural ( )

The binaural decoder destructor.

The binaural decoder destructor free the memory.

Definition at line 430 of file Decoder.cpp.

Member Function Documentation

std::string Hoa2D::DecoderBinaural::getChannelName ( unsigned int  index)
inline

Retrieve a name for a channel.

Retrieve a name for a channel in a std::string format that will be "Headphone Left" or "Headphone Right".

Parameters
indexThe index of a channel.
Returns
The method returns a name for the channel.

Definition at line 276 of file Decoder.h.

PinnaSize Hoa2D::DecoderBinaural::getPinnaSize ( ) const
inline

Retrieve the pinna size.

Retrieve the current size of the pinna.

Returns
The function returns the pinna size used to compute the HRTF.

Definition at line 264 of file Decoder.h.

bool Hoa2D::DecoderBinaural::getState ( ) const
inline

Retrieve if the decoder is ready to process.

Retrieve if the impulses has been loaded and the matrix allocated.

Returns
The function returns true if the decoder is ready to process and false if not.

Definition at line 243 of file Decoder.h.

void Hoa2D::DecoderBinaural::process ( const float *const *  inputs,
float **  outputs 
)

This method performs the binaural decoding with single precision.

You should use this method for not-in-place processing and performs the binaural decoding on block of samples. The inputs matrix contains the spherical harmonics samples : inputs[number of harmonics][vector size] and the outputs array contains the headphones samples : outputs[2][vector size].

Parameters
inputsThe input samples.
outputsThe output array that contains samples destinated to channels.

Definition at line 359 of file Decoder.cpp.

void Hoa2D::DecoderBinaural::process ( const double *const *  inputs,
double **  outputs 
)

This method performs the binaural decoding with double precision.

You should use this method for not-in-place processing and performs the binaural decoding on block of samples. The inputs matrix contains the spherical harmonics samples : inputs[number of harmonics][vector size] and the outputs array contains the headphones samples : outputs[2][vector size].

Parameters
inputThe input samples.
outputsThe output array that contains samples destinated to channels.

Definition at line 390 of file Decoder.cpp.

void Hoa2D::DecoderBinaural::setPinnaSize ( PinnaSize  pinnaSize)

Set the pinna size.

Set the pinna size used to compute the HRTF. Setting the pinna size will re-allocate the vector to compute the binaural decoding.

Parameters
pinnaSizeThe pinna size.

Definition at line 236 of file Decoder.cpp.

void Hoa2D::DecoderBinaural::setSampleRate ( unsigned int  sampleRate)

Set the sample rate.

Set the sample rate. The sample will change the impulse responses size and their sizes increase with it. The valid sample rate are 44100, 48000, 88200 and 9600. Setting the sample rate will load the impulse responses, it is essential to define it before the digital signal processing.

Parameters
sampleRateThe sample rate.
See Also
setVectorSize

Definition at line 247 of file Decoder.cpp.

void Hoa2D::DecoderBinaural::setVectorSize ( unsigned int  vectorSize)

Set the vector size.

Set the vector size. Setting the sample size will allocate the vector to compute the binaural decoding..

Parameters
vectorSizeThe vector size.
See Also
setSampleRate

Definition at line 323 of file Decoder.cpp.