SPAOP
|
A class for objects representing a WONDER source with all its properties. More...
#include <Source.h>
Public Types | |
enum | AutomatedParameters { typeParam = 0, xPosParam, yPosParam, angleParam, dopplParam, totalNumParams } |
Parameters that can be automated by the host must be accessed using this enum. More... | |
enum | SourceTypes { plane = 0, point } |
WONDER's different source types. More... | |
Public Member Functions | |
Source (int id=0) | |
Constructor. More... | |
virtual | ~Source () |
Destructor. More... | |
int | getNumParameters () const |
Returns the total numbers of parameters that can be accessed via enum AutomatedParameters. More... | |
float | getParameter (int index) const |
Returns the normalized value of the parameter. More... | |
void | setParameter (int index, float newValue) |
Sets a parameter from its normalized value. More... | |
void | setParameterUnnormalized (int index, float newUnnormalizedValue) |
Sets a parameter from its unnormalized value. More... | |
const std::string | getParameterName (int index) const |
Returns the name of the parameter. More... | |
const std::string | getParameterText (int index) const |
Returns the string representation of the parameter's current value. More... | |
float | getParameterByText (int index, const std::string ¶meterText) const |
Returns the value a parameter would have if it was set to the value represented by the parameterText string (normalized within [0.0 , 1.0]). More... | |
float | getDenormalizedParameter (int index) const |
Returns the denormalized value of the parameter. More... | |
bool | getBooleanizedParameter (int index) const |
Returns false, if the parameter's value is 0.0 (otherwise true). More... | |
int | getType () const |
Returns 0, if this is a "plane" source, or 1, it's a point source. More... | |
float | getXPos () const |
Returns the x-axis coordinate of this source. More... | |
float | getYPos () const |
Returns the y-axis coordinate of this source. More... | |
float | getAngle () const |
Returns the angle of a plain source in degree (irrelevant for point sources). More... | |
bool | dopplerIsEnabled () const |
Returns true, if the doppler effect is enabled. More... | |
int | getID () const |
Returns the WONDER source ID. More... | |
bool | setID (int id) |
Sets the WONDER source ID. More... | |
std::string | getName () const |
Returns the source's name. More... | |
void | setName (const std::string &name) |
Sets the source's name. More... | |
const Colour | getCoulour () const |
Returns the source's colour. More... | |
void | setColour (uint8_t red, uint8_t green, uint8_t blue) |
Sets the source's colour (for use in GUIs). More... | |
void | setColour (Colour colour) |
Sets the source's colour (for use in GUIs). More... | |
uint8_t | getRed () const |
Returns the red value of this source's colour (as in RGB). More... | |
void | setRed (uint8_t red) |
Sets the red value of this source's colour (as in RGB). More... | |
uint8_t | getGreen () const |
Returns the green value of this source's colour (as in RGB). More... | |
void | setGreen (uint8_t green) |
Sets the green value of this source's colour (as in RGB). More... | |
uint8_t | getBlue () const |
Returns the blue value of this source's colour (as in RGB). More... | |
void | setBlue (uint8_t blue) |
Sets the red value of this source's colour (as in RGB). More... | |
bool | isActive () const |
Returns true, if the source is active within WONDER. More... | |
void | setIsActive (bool isActive) |
Sets the "source is active" status. More... | |
Static Public Member Functions | |
static std::string | getParameterTextByValue (int index, float value) |
Returns the parameter's (denormalized) string representation for a given (normalized) value. More... | |
static float | getParameterDefaultValue (int index) |
Returns the default (=initial) value of the parameter. More... | |
static float | normalizeParameter (int index, float unnormalized) |
Normalizes a parameter to the range of [0.0 ; 1.0]. More... | |
static float | denormalizeParameter (int index, float normalized) |
Scales a parameter from the range of [0.0 ; 1.0] to the value it represents to the user (for GUI, getParameterText, ...). More... | |
A class for objects representing a WONDER source with all its properties.
(This is just a container storing the source's parameter values, offering a range of convenient getters and setters. To actually manipulate a source by sending OSC messages to WONDER, have a look at SourceController.)
Parameters that are suitable for automation can be accessed via an index system as float values normalized within [0.0 , 1.0] (as used by most audio plugin interfaces). Alternative setters and getters for non-normalized values are available as well.
Parameters that can be automated by the host must be accessed using this enum.
Enumerator | |
---|---|
typeParam |
The (WONDER) source type.
|
xPosParam |
The source's x-axis coordinate. |
yPosParam |
The source's y-axis coordinate. |
angleParam |
The angle of a plain source. |
dopplParam |
Doppler effect (on/off). |
totalNumParams |
Total number of (automated) parameters. This does NOT represent an actual parameter. |
wonder::Source::Source | ( | int | id = 0 | ) |
Constructor.
id | The wonder-specific ID of the source. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation. |
|
virtual |
Destructor.
|
static |
Scales a parameter from the range of [0.0 ; 1.0] to the value it represents to the user (for GUI, getParameterText, ...).
For the coordinates, denormalization depends on the maximum coordinates range defined via COORD_MAX and COORD_MIN.
index | A parameter index as specified by enum Source::AutomatedParameters. |
normalized | The normalized value of the specified parameter whose unnormalized representaion shall be returned. |
bool wonder::Source::dopplerIsEnabled | ( | ) | const |
Returns true, if the doppler effect is enabled.
float wonder::Source::getAngle | ( | ) | const |
Returns the angle of a plain source in degree (irrelevant for point sources).
uint8_t wonder::Source::getBlue | ( | ) | const |
Returns the blue value of this source's colour (as in RGB).
bool wonder::Source::getBooleanizedParameter | ( | int | index | ) | const |
Returns false, if the parameter's value is 0.0 (otherwise true).
index | A parameter index as specified by enum Source::AutomatedParameters. |
const Colour wonder::Source::getCoulour | ( | ) | const |
Returns the source's colour.
float wonder::Source::getDenormalizedParameter | ( | int | index | ) | const |
Returns the denormalized value of the parameter.
For the coordinates, denormalization depends on the maximum coordinates range defined via COORD_MAX and COORD_MIN.
index | A parameter index as specified by enum Source::AutomatedParameters. |
uint8_t wonder::Source::getGreen | ( | ) | const |
Returns the green value of this source's colour (as in RGB).
int wonder::Source::getID | ( | ) | const |
Returns the WONDER source ID.
std::string wonder::Source::getName | ( | ) | const |
Returns the source's name.
int wonder::Source::getNumParameters | ( | ) | const |
Returns the total numbers of parameters that can be accessed via enum AutomatedParameters.
float wonder::Source::getParameter | ( | int | index | ) | const |
Returns the normalized value of the parameter.
index | A parameter index as specified by enum Source::AutomatedParameters. |
float wonder::Source::getParameterByText | ( | int | index, |
const std::string & | parameterText | ||
) | const |
Returns the value a parameter would have if it was set to the value represented by the parameterText string (normalized within [0.0 , 1.0]).
index | A parameter index as specified by enum Source::AutomatedParameters. |
parameterText | A string describing a (unnormalized) value of that parameter. |
|
static |
Returns the default (=initial) value of the parameter.
index | A parameter index as specified by enum Source::AutomatedParameters. |
const std::string wonder::Source::getParameterName | ( | int | index | ) | const |
Returns the name of the parameter.
index | A parameter index as specified by enum Source::AutomatedParameters. |
const std::string wonder::Source::getParameterText | ( | int | index | ) | const |
Returns the string representation of the parameter's current value.
index | A parameter index as specified by enum Source::AutomatedParameters. |
|
static |
Returns the parameter's (denormalized) string representation for a given (normalized) value.
index | A parameter index as specified by enum Source::AutomatedParameters. |
value | The normalized value of the specified parameter whose (unnormalized) string representaion shall be returned. |
uint8_t wonder::Source::getRed | ( | ) | const |
Returns the red value of this source's colour (as in RGB).
int wonder::Source::getType | ( | ) | const |
Returns 0, if this is a "plane" source, or 1, it's a point source.
float wonder::Source::getXPos | ( | ) | const |
Returns the x-axis coordinate of this source.
float wonder::Source::getYPos | ( | ) | const |
Returns the y-axis coordinate of this source.
bool wonder::Source::isActive | ( | ) | const |
Returns true, if the source is active within WONDER.
(This is just a getter for the value that was set via Source::setIsActive.)
|
static |
Normalizes a parameter to the range of [0.0 ; 1.0].
For the coordinates, normalization depends on the maximum coordinates range defined via COORD_MAX and COORD_MIN.
index | A parameter index as specified by enum Source::AutomatedParameters. |
unnormalized | The unnormalized value of the specified parameter whose normalized float representaion shall be returned. |
void wonder::Source::setBlue | ( | uint8_t | blue | ) |
Sets the red value of this source's colour (as in RGB).
void wonder::Source::setColour | ( | uint8_t | red, |
uint8_t | green, | ||
uint8_t | blue | ||
) |
Sets the source's colour (for use in GUIs).
void wonder::Source::setColour | ( | Colour | colour | ) |
Sets the source's colour (for use in GUIs).
void wonder::Source::setGreen | ( | uint8_t | green | ) |
Sets the green value of this source's colour (as in RGB).
bool wonder::Source::setID | ( | int | id | ) |
Sets the WONDER source ID.
void wonder::Source::setIsActive | ( | bool | isActive | ) |
Sets the "source is active" status.
void wonder::Source::setName | ( | const std::string & | name | ) |
Sets the source's name.
void wonder::Source::setParameter | ( | int | index, |
float | newValue | ||
) |
Sets a parameter from its normalized value.
index | A parameter index as specified by enum Source::AutomatedParameters. |
newValue | the new value for that parameter, normalized within [0.0 , 1.0]. |
void wonder::Source::setParameterUnnormalized | ( | int | index, |
float | newUnnormalizedValue | ||
) |
Sets a parameter from its unnormalized value.
index | A parameter index as specified by enum Source::AutomatedParameters. |
newUnnormalizedValue | the new value for that parameter, not normalized. |
void wonder::Source::setRed | ( | uint8_t | red | ) |
Sets the red value of this source's colour (as in RGB).