SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
wonder::SourceCollection Class Reference

A container class holding multiple sources (IDs 0 to maxSources-1), accessible via their sourceIDs. More...

#include <SourceCollection.h>

Public Member Functions

 SourceCollection (int maxSources=MAX_WONDER_SOURCES)
 Constructor. More...
 
virtual ~SourceCollection ()
 Destructor. More...
 
const SourcegetSource (int sourceID) const
 Returns a reference to one of the internal Source objects of this SourceCollection. More...
 
const int getMaxSources () const
 Returns the number of Source objects that this SourceCollection contains. More...
 
bool setSource (const Source &source)
 Copies the parameters of a given Source object to the internal Source object with the same ID (if the ID is not out of range). More...
 
void activate (int sourceID)
 Sets a source's state to active. More...
 
void deactivate (int sourceID)
 Sets a source's state to not active. More...
 
void setPosition (int sourceID, float x, float y)
 Sets a source's position parameters. More...
 
void setAngle (int sourceID, float angle)
 Sets a source's angle parameter. More...
 
void setType (int sourceID, int type)
 Sets a source's type parameter. More...
 
void setName (int sourceID, const std::string &name)
 Sets a source's name. More...
 
void setColour (int sourceID, Colour colour)
 Sets a source's colour. More...
 
void setDopplerEffect (int sourceID, bool dopplerOn)
 Sets a source's doppler effect setting. More...
 
void setParameterNormalized (int sourceID, int paramIndex, float normalizedValue)
 Sets a parameter from its normalized value. More...
 
void setParameterUnnormalized (int sourceID, int paramIndex, float unnormalizedValue)
 Sets a source's parameter from its unnormalized value. More...
 

Detailed Description

A container class holding multiple sources (IDs 0 to maxSources-1), accessible via their sourceIDs.

Constructor & Destructor Documentation

wonder::SourceCollection::SourceCollection ( int  maxSources = MAX_WONDER_SOURCES)

Constructor.

Parameters
maxSourcesThe number of Source objects that this SourceCollection will contain.
wonder::SourceCollection::~SourceCollection ( )
virtual

Destructor.

Member Function Documentation

void wonder::SourceCollection::activate ( int  sourceID)

Sets a source's state to active.

Parameters
sourceIDThe ID of the source that shall be updated.
void wonder::SourceCollection::deactivate ( int  sourceID)

Sets a source's state to not active.

Parameters
sourceIDThe ID of the source that shall be updated.
const int wonder::SourceCollection::getMaxSources ( ) const

Returns the number of Source objects that this SourceCollection contains.

Returns
The number of Source objects that this SourceCollection contains.
const Source & wonder::SourceCollection::getSource ( int  sourceID) const

Returns a reference to one of the internal Source objects of this SourceCollection.

Parameters
sourceIDthe ID of the Source that shall be returned.
Returns
A reference to the Source object with the specfied sourceID.
Exceptions
std::out_of_rangeIf the sourceID is out of range, the vector used internally will throw std::out_of_range.
void wonder::SourceCollection::setAngle ( int  sourceID,
float  angle 
)

Sets a source's angle parameter.

Parameters
sourceIDThe ID of the source that shall be updated.
angleThe unnormalized angle to be set (in degree).
void wonder::SourceCollection::setColour ( int  sourceID,
Colour  colour 
)

Sets a source's colour.

Parameters
sourceIDThe ID of the source that shall be updated.
colourThe colour to be set.
void wonder::SourceCollection::setDopplerEffect ( int  sourceID,
bool  dopplerOn 
)

Sets a source's doppler effect setting.

Parameters
sourceIDThe ID of the source that shall be updated.
dopplerOntrue if the doppler effect is activated.
void wonder::SourceCollection::setName ( int  sourceID,
const std::string &  name 
)

Sets a source's name.

Parameters
sourceIDThe ID of the source that shall be updated.
nameThe name to be set.
void wonder::SourceCollection::setParameterNormalized ( int  sourceID,
int  paramIndex,
float  normalizedValue 
)

Sets a parameter from its normalized value.

Parameters
sourceIDThe ID of the source that shall be updated.
paramIndexA parameter index as specified by enum SourceTypes.
normalizedValuethe new value for that parameter, normalized within [0.0 , 1.0].
void wonder::SourceCollection::setParameterUnnormalized ( int  sourceID,
int  paramIndex,
float  unnormalizedValue 
)

Sets a source's parameter from its unnormalized value.

Parameters
sourceIDThe ID of the source that shall be updated.
paramIndexA parameter index as specified by enum SourceTypes.
unnormalizedValuethe new value for that parameter, not normalized.
void wonder::SourceCollection::setPosition ( int  sourceID,
float  x,
float  y 
)

Sets a source's position parameters.

Parameters
sourceIDThe ID of the source that shall be updated.
xThe unnormalized x-Coordinate to be set.
yThe unnormalized y-Coordinate to be set.
bool wonder::SourceCollection::setSource ( const Source source)

Copies the parameters of a given Source object to the internal Source object with the same ID (if the ID is not out of range).

Returns
true on success - false if the Source object's parameters could not be copied because the source's ID was out of range.
Warning
Take extra care that you really want to copy all of a Source's paramters (e.g. including isActive()).
void wonder::SourceCollection::setType ( int  sourceID,
int  type 
)

Sets a source's type parameter.

Parameters
sourceIDThe ID of the source that shall be updated.
typeThe source's type to be set.
See Also
enum SourceTypes