20 #ifndef SOURCE_H_INCLUDED
21 #define SOURCE_H_INCLUDED
30 #define ANGLE_MAX 360.0
33 #define NORMALIZE(min, max, val) ((val)-(min)) / ((max)-(min))
34 #define DENORMALIZE(min, max, val) ((val) * ((max)-(min))) + (min)
36 #define SATURATE(x) ((x) < 0.0) ? 0.0 : (((x) > 1.0) ? 1.0 : (x))
38 #define COORD_NORM(x) NORMALIZE(COORD_MIN, COORD_MAX, (x))
39 #define COORD_DENORM(x) DENORMALIZE(COORD_MIN, COORD_MAX, (x))
266 void setName(
const std::string& name);
275 void setColour(uint8_t red, uint8_t green, uint8_t blue);
315 static std::string floatString(
float f);
320 #endif // SOURCE_H_INCLUDED
Doppler effect (on/off).
Definition: Source.h:87
void setGreen(uint8_t green)
Sets the green value of this source's colour (as in RGB).
Definition: Source.cpp:295
static std::string getParameterTextByValue(int index, float value)
Returns the parameter's (denormalized) string representation for a given (normalized) value...
Definition: Source.cpp:90
The source's x-axis coordinate.
Definition: Source.h:84
void setIsActive(bool isActive)
Sets the "source is active" status.
Definition: Source.cpp:315
void setParameter(int index, float newValue)
Sets a parameter from its normalized value.
Definition: Source.cpp:57
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 ...
Definition: Source.cpp:105
int getID() const
Returns the WONDER source ID.
Definition: Source.cpp:238
void setColour(uint8_t red, uint8_t green, uint8_t blue)
Sets the source's colour (for use in GUIs).
Definition: Source.cpp:268
float getDenormalizedParameter(int index) const
Returns the denormalized value of the parameter.
Definition: Source.cpp:197
virtual ~Source()
Destructor.
Definition: Source.cpp:36
float getAngle() const
Returns the angle of a plain source in degree (irrelevant for point sources).
Definition: Source.cpp:225
The angle of a plain source.
Definition: Source.h:86
uint8_t getGreen() const
Returns the green value of this source's colour (as in RGB).
Definition: Source.cpp:290
int getType() const
Returns 0, if this is a "plane" source, or 1, it's a point source.
Definition: Source.cpp:210
bool isActive() const
Returns true, if the source is active within WONDER.
Definition: Source.cpp:310
SourceTypes
WONDER's different source types.
Definition: Source.h:94
std::string getName() const
Returns the source's name.
Definition: Source.cpp:258
const Colour getCoulour() const
Returns the source's colour.
Definition: Source.cpp:253
A struct representing a (RGB) colour.
Definition: Colours.h:28
void setParameterUnnormalized(int index, float newUnnormalizedValue)
Sets a parameter from its unnormalized value.
Definition: Source.cpp:65
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...
Definition: Source.cpp:182
The source's y-axis coordinate.
Definition: Source.h:85
bool setID(int id)
Sets the WONDER source ID.
Definition: Source.cpp:243
AutomatedParameters
Parameters that can be automated by the host must be accessed using this enum.
Definition: Source.h:81
A plane wave source.
Definition: Source.h:96
const std::string getParameterName(int index) const
Returns the name of the parameter.
Definition: Source.cpp:70
The (WONDER) source type.
Definition: Source.h:83
void setRed(uint8_t red)
Sets the red value of this source's colour (as in RGB).
Definition: Source.cpp:285
bool getBooleanizedParameter(int index) const
Returns false, if the parameter's value is 0.0 (otherwise true).
Definition: Source.cpp:202
bool dopplerIsEnabled() const
Returns true, if the doppler effect is enabled.
Definition: Source.cpp:230
void setBlue(uint8_t blue)
Sets the red value of this source's colour (as in RGB).
Definition: Source.cpp:305
void setName(const std::string &name)
Sets the source's name.
Definition: Source.cpp:263
int getNumParameters() const
Returns the total numbers of parameters that can be accessed via enum AutomatedParameters.
Definition: Source.cpp:43
const std::string getParameterText(int index) const
Returns the string representation of the parameter's current value.
Definition: Source.cpp:85
uint8_t getBlue() const
Returns the blue value of this source's colour (as in RGB).
Definition: Source.cpp:300
float getYPos() const
Returns the y-axis coordinate of this source.
Definition: Source.cpp:220
static float normalizeParameter(int index, float unnormalized)
Normalizes a parameter to the range of [0.0 ; 1.0].
Definition: Source.cpp:154
A point source.
Definition: Source.h:97
A class for objects representing a WONDER source with all its properties.
Definition: Source.h:60
float getXPos() const
Returns the x-axis coordinate of this source.
Definition: Source.cpp:215
static float getParameterDefaultValue(int index)
Returns the default (=initial) value of the parameter.
Definition: Source.cpp:139
Source(int id=0)
Constructor.
Definition: Source.cpp:24
float getParameter(int index) const
Returns the normalized value of the parameter.
Definition: Source.cpp:48
uint8_t getRed() const
Returns the red value of this source's colour (as in RGB).
Definition: Source.cpp:280
Total number of (automated) parameters.
Definition: Source.h:89