A container class holding multiple sources (IDs 0 to maxSources-1), accessible via their sourceIDs.
More...
#include <SourceCollection.h>
|
| SourceCollection (int maxSources=MAX_WONDER_SOURCES) |
| Constructor. More...
|
|
virtual | ~SourceCollection () |
| Destructor. More...
|
|
const Source & | getSource (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...
|
|
A container class holding multiple sources (IDs 0 to maxSources-1), accessible via their sourceIDs.
wonder::SourceCollection::~SourceCollection |
( |
| ) |
|
|
virtual |
void wonder::SourceCollection::activate |
( |
int |
sourceID | ) |
|
Sets a source's state to active.
- Parameters
-
sourceID | The ID of the source that shall be updated. |
void wonder::SourceCollection::deactivate |
( |
int |
sourceID | ) |
|
Sets a source's state to not active.
- Parameters
-
sourceID | The ID of the source that shall be updated. |
const int wonder::SourceCollection::getMaxSources |
( |
| ) |
const |
const Source & wonder::SourceCollection::getSource |
( |
int |
sourceID | ) |
const |
Returns a reference to one of the internal Source objects of this SourceCollection.
- Parameters
-
sourceID | the ID of the Source that shall be returned. |
- Returns
- A reference to the Source object with the specfied sourceID.
- Exceptions
-
std::out_of_range | If 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
-
sourceID | The ID of the source that shall be updated. |
angle | The unnormalized angle to be set (in degree). |
void wonder::SourceCollection::setColour |
( |
int |
sourceID, |
|
|
Colour |
colour |
|
) |
| |
Sets a source's colour.
- Parameters
-
sourceID | The ID of the source that shall be updated. |
colour | The colour to be set. |
void wonder::SourceCollection::setDopplerEffect |
( |
int |
sourceID, |
|
|
bool |
dopplerOn |
|
) |
| |
Sets a source's doppler effect setting.
- Parameters
-
sourceID | The ID of the source that shall be updated. |
dopplerOn | true if the doppler effect is activated. |
void wonder::SourceCollection::setName |
( |
int |
sourceID, |
|
|
const std::string & |
name |
|
) |
| |
Sets a source's name.
- Parameters
-
sourceID | The ID of the source that shall be updated. |
name | The name to be set. |
void wonder::SourceCollection::setParameterNormalized |
( |
int |
sourceID, |
|
|
int |
paramIndex, |
|
|
float |
normalizedValue |
|
) |
| |
Sets a parameter from its normalized value.
- Parameters
-
sourceID | The ID of the source that shall be updated. |
paramIndex | A parameter index as specified by enum SourceTypes. |
normalizedValue | the 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
-
sourceID | The ID of the source that shall be updated. |
paramIndex | A parameter index as specified by enum SourceTypes. |
unnormalizedValue | the new value for that parameter, not normalized. |
void wonder::SourceCollection::setPosition |
( |
int |
sourceID, |
|
|
float |
x, |
|
|
float |
y |
|
) |
| |
Sets a source's position parameters.
- Parameters
-
sourceID | The ID of the source that shall be updated. |
x | The unnormalized x-Coordinate to be set. |
y | The 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
-
sourceID | The ID of the source that shall be updated. |
type | The source's type to be set. |
- See Also
- enum SourceTypes