#include <SpeakerLayout.h>

Public Member Functions | |
| SpeakerLayout (const char *filePath=NULL) | |
| Creates an empty speaker layout. Optionally reads loudspeaker layout from file. | |
| virtual | ~SpeakerLayout () |
| destructor | |
| void | readSpeakerFile (const char *filePath) |
| Reads the speaker listing file according to the specification. | |
| void | addSpeaker (float azimuth, float elevation=0.0, float radius=1.0) |
| Add a speaker specifying its position in degrees from the center of the listening space. | |
| void | addSpeaker (float x, float y, float z, float xNorm, float yNorm, float zNorm, float gain) |
| Add a WFS speaker. | |
| unsigned | numSpeakers () const |
| void | normalizeSpeakerDistances (float radius=0) |
| Returns the number of loudspeakers in the layout. | |
| Speaker * | speakerAtIndex (unsigned speakerIndex) const |
| Returns the speaker at the specified index. | |
| bool | isPeriphonic () |
| void | dump () |
| If any of the speakers in the layout has an elevation other than 0, it returns true. | |
| SpeakerLayout & | operator= (const SpeakerLayout &layout) |
| Overloaded "=" operator allows copying the layout. | |
Static Public Member Functions | |
| static SpeakerLayout * | defaultSpeakerLayout () |
| Returns a pointer to the defalut layout. If not default exists, it creates one. | |
| static void | setDefaultSpeakerLayout (SpeakerLayout *defaultLayout) |
| Use it to set a layout as default. Clients (e.g. a Panner) can then make use of this layout. | |
Protected Attributes | |
| vector< Speaker * > | mSpeakers |
| Vector of pointers to the loudspeakers. | |
Private Attributes | |
| unsigned | mDimensions |
| float * | mSpeakerDistanceDeltas |
| Holds the diference of the optimal speaker distance and the real one. Only used if distances are normalized. | |
Static Private Attributes | |
| static SpeakerLayout * | sDefaultSpeakerLayout = 0 |
Conventions used in this code: Coordinate system:
the layout is a passive object, meaning that it doesn't deal with processing any audio data. It only provides speaker positions. An "ActiveSpeakerLayout" is active and can be used as a UnitGenerator that compensates for speaker positions, etc.
| SpeakerLayout::SpeakerLayout | ( | const char * | filePath = NULL |
) |
Creates an empty speaker layout. Optionally reads loudspeaker layout from file.
Reads loudspeaker layout from a text file. Loudspeaker layouts provided as textfiles should folow the format below: -> A / indicates the start of a comment, which lasts until the end of the line (??????????????????????). -> The Keywords CARTESIAN, SPHERICAL-DEGREES, SPHERICAL-RADIANS are used to specify the format of the provided speaker positions. The class will do necessary conversions to the internal representation in spherical radians. If no keyword is specified, spherical radians are assumed(??????????????????????). -> Non-comment or non-keyword lines should contain speaker position information as three tab-separated coordinates. Each line will be interpreted as a new speaker. Examples of parsable speaker layout files are provided with the code (.dat files).
---> needs .wfs file description
References readSpeakerFile().
| SpeakerLayout::~SpeakerLayout | ( | ) | [virtual] |
| void SpeakerLayout::readSpeakerFile | ( | const char * | filePath | ) |
Reads the speaker listing file according to the specification.
References addSpeaker(), dump(), csl::kLogError, csl::logMsg(), csl::CPoint::x, csl::CPoint::y, and csl::CPoint::z.
Referenced by SpeakerLayout().
| SpeakerLayout * SpeakerLayout::defaultSpeakerLayout | ( | ) | [static] |
Returns a pointer to the defalut layout. If not default exists, it creates one.
Returns a reference to the default layout. If no layout has been set, it creates a stereo speaker layout.
References sDefaultSpeakerLayout.
Referenced by setDefaultSpeakerLayout(), and csl::SpatialPanner::update().
| void SpeakerLayout::setDefaultSpeakerLayout | ( | SpeakerLayout * | defalutLayout | ) | [static] |
Use it to set a layout as default. Clients (e.g. a Panner) can then make use of this layout.
The default speaker layout is used by Panners, when not specified otherwise. If using multiple Panners, but only one speaker setup, is best to set the layout as default, and then forget about that; Panners will know to use such layout.
References csl::Model::changed(), defaultSpeakerLayout(), and sDefaultSpeakerLayout.
| void SpeakerLayout::addSpeaker | ( | float | azimuth, | |
| float | elevation = 0.0, |
|||
| float | radius = 1.0 | |||
| ) |
Add a speaker specifying its position in degrees from the center of the listening space.
Add a speaker to the layout. Parameters should be specified in degrees.
References csl::Model::changed(), CSL_PI, mDimensions, and mSpeakers.
Referenced by readSpeakerFile(), and csl::StereoSpeakerLayout::StereoSpeakerLayout().
| void SpeakerLayout::addSpeaker | ( | float | x, | |
| float | y, | |||
| float | z, | |||
| float | xNorm, | |||
| float | yNorm, | |||
| float | zNorm, | |||
| float | gain | |||
| ) |
Add a WFS speaker.
Add a speaker to the layout. Parameters should be specified in x,y,z.
References csl::Model::changed(), and mSpeakers.
| unsigned csl::SpeakerLayout::numSpeakers | ( | ) | const [inline] |
References mSpeakers.
Referenced by csl::AmbisonicDecoder::asProjection(), csl::AmbisonicDecoder::asPseudoInverse(), dump(), csl::SpeakerLayoutExpert::findPannerFromLayout(), csl::SpeakerSetLayout::findSpeakerPairs(), csl::SpeakerSetLayout::findSpeakerTriplets(), csl::AmbisonicDecoder::initialize(), csl::AmbisonicDecoder::makeInPhase(), csl::AmbisonicDecoder::makeMaxRE(), csl::AmbisonicDecoder::makeTransposedReEncodingMatrix(), normalizeSpeakerDistances(), operator=(), csl::VBAP::speakerLayoutChanged(), csl::VBAP::VBAP(), and csl::AmbisonicDecoder::~AmbisonicDecoder().
| void SpeakerLayout::normalizeSpeakerDistances | ( | float | radius = 0 |
) |
Returns the number of loudspeakers in the layout.
Sets speaker distances to a fixed distance from the center of the listening space.
| radius | is optional. If not set, it finds the best radius by analyzing the layout. |
References mSpeakerDistanceDeltas, mSpeakers, and numSpeakers().
| Speaker* csl::SpeakerLayout::speakerAtIndex | ( | unsigned | speakerIndex | ) | const [inline] |
Returns the speaker at the specified index.
References mSpeakers.
Referenced by csl::SpeakerSetLayout::findSpeakerPairs(), csl::SpeakerSetLayout::findSpeakerTriplets(), csl::SpeakerSetLayout::invertTripleMatrix(), csl::AmbisonicDecoder::makeTransposedReEncodingMatrix(), and operator=().
| bool csl::SpeakerLayout::isPeriphonic | ( | ) | [inline] |
References mDimensions.
Referenced by csl::SpeakerSetLayout::SpeakerSetLayout(), and csl::VBAP::VBAP().
| void SpeakerLayout::dump | ( | void | ) |
If any of the speakers in the layout has an elevation other than 0, it returns true.
Prints the number of speakers in the layout and their position.
References mSpeakers, and numSpeakers().
Referenced by readSpeakerFile().
| SpeakerLayout & SpeakerLayout::operator= | ( | const SpeakerLayout & | layout | ) |
Overloaded "=" operator allows copying the layout.
References mSpeakers, numSpeakers(), and speakerAtIndex().
vector<Speaker *> csl::SpeakerLayout::mSpeakers [protected] |
Vector of pointers to the loudspeakers.
Referenced by addSpeaker(), dump(), normalizeSpeakerDistances(), numSpeakers(), operator=(), speakerAtIndex(), and ~SpeakerLayout().
unsigned csl::SpeakerLayout::mDimensions [private] |
Referenced by addSpeaker(), and isPeriphonic().
SpeakerLayout * SpeakerLayout::sDefaultSpeakerLayout = 0 [static, private] |
Referenced by defaultSpeakerLayout(), and setDefaultSpeakerLayout().
float* csl::SpeakerLayout::mSpeakerDistanceDeltas [private] |
Holds the diference of the optimal speaker distance and the real one. Only used if distances are normalized.
Referenced by normalizeSpeakerDistances().
1.5.8