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

The ambisonic multi-decoder. More...

#include <Decoder.h>

Inheritance diagram for Hoa2D::DecoderMulti:
Hoa2D::Ambisonic Hoa2D::Planewaves

Public Types

enum  Mode { Regular = 0, Irregular = 1, Binaural = 2 }
 

Public Member Functions

 DecoderMulti (unsigned int order)
 The multi-decoder constructor. More...
 
 ~DecoderMulti ()
 The multi-decoder destructor. More...
 
void setDecodingMode (Mode mode)
 Set the decoding mode. More...
 
Mode getDecodingMode () const
 Retrieve the decoding mode. More...
 
void setNumberOfChannels (unsigned int numberOfChannels)
 Set the number of channels for the regular or irregular decoding. More...
 
unsigned int getNumberOfChannels () const
 Retrieve the number of channels. More...
 
void setChannelsOffset (double offset)
 Set the offset of the channels for the regular decoding. More...
 
double getChannelsOffset () const
 Get the offset of the channels of the regular decoding. More...
 
void setChannelAzimuth (unsigned int index, double azimuth)
 Set the azimuth of a channel for the irregular decoding mode. More...
 
void setChannelsAzimtuh (double *azimuths)
 Set the azimtuh of all the channels for the irregular decoding mode. More...
 
void setSampleRate (unsigned int sampleRate)
 Set the sample rate. More...
 
void setVectorSize (unsigned int vectorSize)
 Set the vector size. More...
 
void setPinnaSize (DecoderBinaural::PinnaSize pinnaSize)
 Set the pinna size. More...
 
bool getBinauralState () const
 Retrieve if the binaural decoder is ready to process. More...
 
DecoderBinaural::PinnaSize getPinnaSize () const
 Retrieve if the pinna size of the binaural decoder. 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...
 
void processBinaural (const float *const *inputs, float **outputs)
 This method performs the binaural decoding with single precision. More...
 
void processBinaural (const double *const *inputs, double **outputs)
 This method performs the binaural decoding with double precision. More...
 
void processRegular (const float *inputs, float *outputs)
 This method performs the decoding depending of the mode with single precision. More...
 
void processRegular (const double *inputs, double *outputs)
 This method performs the regular decoding with single precision. More...
 
void processIrregular (const float *inputs, float *outputs)
 This method performs the irregular decoding with single precision. More...
 
void processIrregular (const double *inputs, double *outputs)
 This method performs the irregular decoding with single 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 multi-decoder.

The multi-decoder is a class that facilitates the use of the three decoder : regular, irregular and binaural.

Definition at line 306 of file Decoder.h.

Member Enumeration Documentation

Enumerator
Regular 

Regular Decoding

Irregular 

Irregular Decoding

Binaural 

Binaural Decoding

Definition at line 310 of file Decoder.h.

Constructor & Destructor Documentation

Hoa2D::DecoderMulti::DecoderMulti ( unsigned int  order)

The multi-decoder constructor.

The multi-decoder constructor allocates and initialize the three decoder. The default decoder will be the regular one with 2 * order + 2 number of channels.

Parameters
orderThe order

Definition at line 456 of file Decoder.cpp.

Hoa2D::DecoderMulti::~DecoderMulti ( )

The multi-decoder destructor.

The multi-decoder destructor free the memory.

Definition at line 537 of file Decoder.cpp.

Member Function Documentation

bool Hoa2D::DecoderMulti::getBinauralState ( ) const
inline

Retrieve if the binaural decoder is ready to process.

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

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

Definition at line 452 of file Decoder.h.

double Hoa2D::DecoderMulti::getChannelAbscissa ( unsigned int  index) const
inline

Retrieve the abscissa of a channel.

Retrieve the abscissa of a channel. The abscissa is between -1 and 1, -1 is the left of the soundfield, 0 is the center of the soundfield and 1 is the right of the soundfield. The maximum index must be the number of channels - 1.

Parameters
indexThe index of the loudspeaker.
Returns
The abscissa of the channel if the channel exists, otherwise the function generates an error.
See Also
getChannelAzimuth
getChannelOrdinate
getChannelName

Definition at line 501 of file Decoder.h.

double Hoa2D::DecoderMulti::getChannelAzimuth ( unsigned int  index) const
inline

Retrieve the azimuth of a channel.

Retrieve the azimuth of a channel. The azimuth of the channel is in radian, 0 radian is at the front of the soundfield and Pi is at the back of the sound field. The maximum index must be the number of channels - 1.

Parameters
indexThe index of the channel.
Returns
The azimuth of the channel if the channel exists, otherwise the function generates an error.
See Also
getChannelAbscissa
getChannelOrdinate
getChannelName

Definition at line 480 of file Decoder.h.

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

Retrieve a name for a channel.

Retrieve a name for a channel in a std::string format, look at each decoder for further informations.

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

Definition at line 538 of file Decoder.h.

double Hoa2D::DecoderMulti::getChannelOrdinate ( unsigned int  index) const
inline

Retrieve the ordinate of a channel.

Retrieve the ordinate of a channel. The ordinate is between -1 and 1, -1 is the back of the soundfield, 0 is the center of the soundfield and 1 is the front of the soundfield. The maximum index must be the number of channels - 1.

Parameters
indexThe index of the channel.
Returns
The ordinate of the channel if the channel exists, otherwise the function generates an error.
See Also
getChannelAzimuth
getChannelAbscissa
getChannelName

Definition at line 521 of file Decoder.h.

double Hoa2D::DecoderMulti::getChannelsOffset ( ) const
inline

Get the offset of the channels of the regular decoding.

Retreive the azimuth offset of the channels in radian the regular decoding.

Returns
The offset of the channels if the regular decoding mode is active, otherwise it returns 0.

Definition at line 391 of file Decoder.h.

Mode Hoa2D::DecoderMulti::getDecodingMode ( ) const
inline

Retrieve the decoding mode.

Retrieve the current decoding mode of the multi-decoder.

Returns
The decoding mode;

Definition at line 352 of file Decoder.h.

unsigned int Hoa2D::DecoderMulti::getNumberOfChannels ( ) const
inline

Retrieve the number of channels.

Retrieve the number of channels of the planewave class.

Returns
The number of channels.

Definition at line 369 of file Decoder.h.

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

Retrieve if the pinna size of the binaural decoder.

Retrieve if the pinna size of the binaural decoder.

Returns
The function returns the pinna size of the binaural decoder.

Definition at line 465 of file Decoder.h.

void Hoa2D::DecoderMulti::processBinaural ( const float *const *  inputs,
float **  outputs 
)
inline

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 554 of file Decoder.h.

void Hoa2D::DecoderMulti::processBinaural ( const double *const *  inputs,
double **  outputs 
)
inline

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
inputsThe input samples.
outputsThe output array that contains samples destinated to channels.

Definition at line 565 of file Decoder.h.

void Hoa2D::DecoderMulti::processIrregular ( const float *  inputs,
float *  outputs 
)
inline

This method performs the irregular decoding with single precision.

You should use this method for in-place or not-in-place processing and performs the irregular decoding sample by sample. The inputs array contains the spherical harmonics samples and the minimum size must be the number of harmonics and the outputs array contains the channels samples and the minimum size must be the number of channels.

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

Definition at line 598 of file Decoder.h.

void Hoa2D::DecoderMulti::processIrregular ( const double *  inputs,
double *  outputs 
)
inline

This method performs the irregular decoding with single precision.

You should use this method for in-place or not-in-place processing and performs the irregular decoding sample by sample. The inputs array contains the spherical harmonics samples and the minimum size must be the number of harmonics and the outputs array contains the channels samples and the minimum size must be the number of channels.

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

Definition at line 609 of file Decoder.h.

void Hoa2D::DecoderMulti::processRegular ( const float *  inputs,
float *  outputs 
)
inline

This method performs the decoding depending of the mode 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 576 of file Decoder.h.

void Hoa2D::DecoderMulti::processRegular ( const double *  inputs,
double *  outputs 
)
inline

This method performs the regular decoding with single precision.

You should use this method for in-place or not-in-place processing and performs the regular decoding sample by sample. The inputs array contains the spherical harmonics samples and the minimum size must be the number of harmonics and the outputs array contains the channels samples and the minimym size must be the number of channels.

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

Definition at line 587 of file Decoder.h.

void Hoa2D::DecoderMulti::setChannelAzimuth ( unsigned int  index,
double  azimuth 
)

Set the azimuth of a channel for the irregular decoding mode.

Set the azimuth of a channel for the irregular decoding mode. The azimuth is in radian between 0 and 2 Pi, O is the front of the soundfield and Pi is the back of the sound field. The maximum index must be the number of channel - 1.

Parameters
indexThe index of the loudspeaker.
azimuthThe azimuth.
See Also
setChannelsAzimtuh

Definition at line 498 of file Decoder.cpp.

void Hoa2D::DecoderMulti::setChannelsAzimtuh ( double *  azimuths)

Set the azimtuh of all the channels for the irregular decoding mode.

Set the azimtuh of all the channels for the irregular decoding mode. It is more efficient to set all the channels azimuths at the same time because even if only one channel has changed, all the decoding matrix have to be recomputed. The azimuths are in radian between 0 and 2 Pi, O is the front of the soundfield and Pi is the back of the sound field. The azimtuhs array must have a minimum size of the number of channels.

Parameters
azimuthsThe azimuths array.
See Also
setChannelAzimuth

Definition at line 506 of file Decoder.cpp.

void Hoa2D::DecoderMulti::setChannelsOffset ( double  offset)

Set the offset of the channels for the regular decoding.

Set the azimuth offset of the channels in radian for the regular decoding, if the decoding mode.

Parameters
offsetAn azimuth value.

Definition at line 486 of file Decoder.cpp.

void Hoa2D::DecoderMulti::setDecodingMode ( Mode  mode)

Set the decoding mode.

Set the decoding mode. It will allocate the right decoder and initialize the class.

Parameters
modeThe decoding mode.

Definition at line 464 of file Decoder.cpp.

void Hoa2D::DecoderMulti::setNumberOfChannels ( unsigned int  numberOfChannels)

Set the number of channels for the regular or irregular decoding.

Set the number of channels for the regular or irregular decoding.

Parameters
numberOfChannelsThe number of channels.

Definition at line 469 of file Decoder.cpp.

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

Set the pinna size.

Set the pinna size of the binaural decoding.

Parameters
pinnaSizeThe pinna size.

Definition at line 514 of file Decoder.cpp.

void Hoa2D::DecoderMulti::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 519 of file Decoder.cpp.

void Hoa2D::DecoderMulti::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 rate.
See Also
setSampleRate

Definition at line 528 of file Decoder.cpp.