csl::SpeakerLayout Class Reference

#include <SpeakerLayout.h>

Inheritance diagram for csl::SpeakerLayout:

csl::Model csl::StereoSpeakerLayout List of all members.

Detailed Description

A speaker layout holds a set of loudspeakers. Each speaker has a position (in a space, where measurements are assumed to be from the center point of the space (also the center of the coordinate system). To simplify usage, a default layout will be created when instantiating any object that uses the speaker layout. If the user does not specify a layout then the default layout is used. Any layout can be set to become default (by calling setDefaultSpeakerLayout()) so new objects that require a SpeakerLayout make use of this prefered layout without the need of passing it explicitly per instance. Using multiple layouts is still possible by passing the desired layout to the object that will use it. In that case, this object will go with this layout instead of the default.

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.


Public Member Functions

 SpeakerLayout (char *filePath=NULL)
 Creates an empty speaker layout. Optionally reads loudspeaker layout from file.
 ~SpeakerLayout ()
 destructor
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.
unsigned numSpeakers () const
void normalizeSpeakerDistances (float radius=0)
 Returns the number of loudspeakers in the layout.
SpeakerspeakerAtIndex (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.
SpeakerLayoutoperator= (const SpeakerLayout &layout)
 Overloaded "=" operator allows copying the layout.

Static Public Member Functions

static SpeakerLayoutdefaultSpeakerLayout ()
 Returns a pointer to the defalut layout. If not default exists, it creates one.
static void setDefaultSpeakerLayout (SpeakerLayout *defalutLayout)
 Use it to set a layout as default. Clients (e.g. a Panner) can then make use of this layout.

Private Attributes

vector< Speaker * > mSpeakers
 Vector of pointers to the loudspeakers.
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 SpeakerLayoutsDefaultSpeakerLayout = 0


Constructor & Destructor Documentation

SpeakerLayout::SpeakerLayout 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).

SpeakerLayout::~SpeakerLayout  ) 
 

destructor


Member Function Documentation

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.

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.

Note:
As a suggestion, set the default layout before creating any Panners. Otherwise they'll have to rebuild their data.

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.

unsigned csl::SpeakerLayout::numSpeakers  )  const [inline]
 

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.

Parameters:
radius is optional. If not set, it finds the best radius by analyzing the layout.

Speaker* csl::SpeakerLayout::speakerAtIndex unsigned  speakerIndex  )  const [inline]
 

Returns the speaker at the specified index.

bool csl::SpeakerLayout::isPeriphonic  )  [inline]
 

void SpeakerLayout::dump  ) 
 

If any of the speakers in the layout has an elevation other than 0, it returns true.

SpeakerLayout & SpeakerLayout::operator= const SpeakerLayout layout  ) 
 

Overloaded "=" operator allows copying the layout.


Member Data Documentation

vector<Speaker *> csl::SpeakerLayout::mSpeakers [private]
 

Vector of pointers to the loudspeakers.

unsigned csl::SpeakerLayout::mDimensions [private]
 

SpeakerLayout * SpeakerLayout::sDefaultSpeakerLayout = 0 [static, private]
 

float* csl::SpeakerLayout::mSpeakerDistanceDeltas [private]
 

Holds the diference of the optimal speaker distance and the real one. Only used if distances are normalized.


The documentation for this class was generated from the following files:
Generated on Fri Apr 6 20:18:22 2007 for CSL by  doxygen 1.4.5-20051010