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

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 &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]). 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...
 

Detailed Description

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.

Member Enumeration Documentation

Parameters that can be automated by the host must be accessed using this enum.

Enumerator
typeParam 

The (WONDER) source type.

See Also
enum SourceTypes.
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's different source types.

Enumerator
plane 

A plane wave source.

point 

A point source.

Constructor & Destructor Documentation

wonder::Source::Source ( int  id = 0)

Constructor.

Parameters
idThe 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.
wonder::Source::~Source ( )
virtual

Destructor.

Member Function Documentation

float wonder::Source::denormalizeParameter ( int  index,
float  normalized 
)
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.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
normalizedThe normalized value of the specified parameter whose unnormalized representaion shall be returned.
Returns
The unnormalized representation of the value that was passed.
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).

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
Returns
false, if the parameter's value is 0.0 (otherwise true).
const Colour wonder::Source::getCoulour ( ) const

Returns the source's colour.

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.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
Returns
The current unnormalized value of that parameter.
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.

Parameters
indexA 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]).

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
parameterTextA string describing a (unnormalized) value of that parameter.
Returns
The normalized value corresponding to the parameterText. In case a numeric value was passed for a numeric parameter and it exceeds the parameter's range, the minimum/maximum value of that parameter is returned. In case an invalid string was passed, the current value of that parameter is returned.
float wonder::Source::getParameterDefaultValue ( int  index)
static

Returns the default (=initial) value of the parameter.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
Returns
The default (=intial) value for the specified paremeter.
const std::string wonder::Source::getParameterName ( int  index) const

Returns the name of the parameter.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
Returns
A string describing the specified parameter.
const std::string wonder::Source::getParameterText ( int  index) const

Returns the string representation of the parameter's current value.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
Returns
A string describing the current (unnormalized) value of the parameter.
std::string wonder::Source::getParameterTextByValue ( int  index,
float  value 
)
static

Returns the parameter's (denormalized) string representation for a given (normalized) value.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
valueThe normalized value of the specified parameter whose (unnormalized) string representaion shall be returned.
Returns
A string describing the (unnormalized) value corresponding to the value that was passed as parameter.
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.

See Also
enum SourceTypes.
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.)

float wonder::Source::normalizeParameter ( int  index,
float  unnormalized 
)
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.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
unnormalizedThe unnormalized value of the specified parameter whose normalized float representaion shall be returned.
Returns
The normalized representation of the value that was passed. If the unnormalized value that was passed exceeds the range of the parameter, 0.0 or 1.0 is 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.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
newValuethe 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.

Parameters
indexA parameter index as specified by enum Source::AutomatedParameters.
newUnnormalizedValuethe 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).