|
Lumiverse
2.5
A framework for creating lighting control applications
|
This class implements a sine-wave effect. More...
#include <SineWave.h>


Public Types | |
| enum | Mode { ABS, REL } |
| Encodes the behavior for this effect. More... | |
Public Member Functions | |
| SineWave (float period=1, float magnitude=0.5, float phase=0, float offset=0.5, Mode mode=ABS) | |
| Creates a new SineWave effect. More... | |
| SineWave (JSONNode node) | |
| Loads a SineWave effect from a JSONNode. More... | |
| virtual shared_ptr< LumiverseType > | getValueAtTime (string id, string paramName, LumiverseType *currentVal, size_t time, map< string, shared_ptr< Timeline > > &tls) override |
| Returns the value of the requested parameter according to the sine wave parameters. | |
| virtual size_t | getLoopLength () override |
| Returns the amount of time it takes to cycle through the sine wave once in milliseconds. | |
| virtual string | getTimelineTypeName () override |
| Returns the name of this type of timeline. | |
| virtual JSONNode | toJSON () override |
| Converts this timeline to a JSON node. | |
Public Member Functions inherited from Lumiverse::ShowControl::Timeline | |
| Timeline () | |
| Creates an empty timeline. | |
| Timeline (JSONNode data) | |
| Load a Timeline from JSON data. More... | |
| Timeline (const Timeline &other) | |
| Copies a timeline. | |
| void | operator= (const Timeline &other) |
| virtual | ~Timeline () |
| Deletes a timeline. | |
| string | getTimelineKey (Device *d, string paramName) |
| Gets the identifier used to refer to a device-parameter keyframe set. | |
| string | getTimelineKey (string id, string paramName) |
| Gets the identifier used to refer to a device-parameter keyframe set. | |
| Keyframe | getKeyframe (string identifier, size_t time) |
| Gets the keyframe for a given identifier and time. Read-only. More... | |
| map< string, Keyframe > | getKeyframes (Device *d, size_t time) |
| Gets the keyframes for a given device and time. Read-only. More... | |
| map< string, map< size_t, Keyframe > > & | getAllKeyframes () |
| Gets the keyframes for the entire timeline. | |
| void | setKeyframe (string identifier, size_t time, LumiverseType *data, bool ucs=false) |
| Sets the value for the specified keyframe. More... | |
| void | setKeyframe (Device *d, size_t time, bool ucs=false) |
| Sets the value of the keyframes for all parameters of the given device. | |
| void | setKeyframe (Rig *rig, size_t time, bool ucs=false) |
| Stores a keyframe from a rig. | |
| void | setKeyframe (DeviceSet devices, size_t time, bool ucs=false) |
| Stores a keyframe for a group of selected devices. | |
| void | setKeyframe (string identifier, size_t time, string timelineID, size_t offset=0) |
| Stores a nested timeline Keyframe for a particular identifier. | |
| void | setKeyframe (Device *d, size_t time, string timelineID, size_t offset=0) |
| Stores a nested timeline Keyframe for a device. | |
| void | setKeyframe (DeviceSet devices, size_t time, string timelineID, size_t offset=0) |
| Stores a nested timeline Keyframe for a group of selected devices. | |
| void | deleteKeyframe (string identifier, size_t time) |
| Deletes the keyframe with the specified identifier at the specified time. | |
| void | deleteKeyframe (Device *d, size_t time) |
| Deletes the keyframes for the specified device at the specified time. | |
| void | deleteKeyframe (DeviceSet devices, size_t time) |
| Deletes the keyframes for the specified devices at the specified time. | |
| void | moveKeyframe (string id, size_t oldTime, size_t newTime) |
| Moves a keyframe from one time to a different time. If a keyframe already exists at the target time, it is overwritten. | |
| void | deleteKeyframesAfter (string id, size_t start) |
| Deletes all keyframes for an id that occur after (>) the start time. | |
| void | deleteKeyframesBetween (size_t start, size_t end) |
| Deletes all keyframes between (start < keyframe < end) the specified times. | |
| bool | addEndEvent (string id, shared_ptr< Event > e) |
| Adds a new event to the end of the timeline. More... | |
| void | deleteEndEvent (string id) |
| Deletes an end event. More... | |
| bool | addEvent (size_t time, shared_ptr< Event > e) |
| Adds an Event to the Timeline. More... | |
| void | deleteEvent (size_t time, string id="") |
| Deletes Events from the Timeline. More... | |
| vector< shared_ptr< Event > > | getEvents (size_t time, string id="") |
| Gets Events at the specified time. More... | |
| shared_ptr< Event > | getEndEvent (string id) |
| Gets an end Event. More... | |
| multimap< size_t, shared_ptr< Event > > & | getAllEvents () |
| Returns the multimap containing the Events for this Timeline. | |
| map< string, shared_ptr< Event > > & | getAllEndEvents () |
| Returns the end Events for this Timeline. | |
| virtual void | executeEvents (size_t prevTime, size_t currentTime) |
| Executes the events between the specified times. More... | |
| virtual void | executeEndEvents () |
| Executes all end events in the timeline's list. | |
| virtual int | getLoops () |
| Returns the looping setting for this timeline. More... | |
| virtual void | setLoops (int loops) |
| Set the number of loops the timeline should execute. More... | |
| virtual size_t | getLength () |
| Gets the length of the timeline based on stored keyframes. More... | |
| virtual bool | isDone (size_t time, map< string, shared_ptr< Timeline > > &tls) |
| Indicates if the Timeline has no more keyframes after the specified time. More... | |
| virtual void | setCurrentState (map< string, map< string, LumiverseType * > > &state, shared_ptr< Timeline > active, size_t time) |
| Takes a state from the layer and updates the keyframes marked with "Use Current State". More... | |
| Keyframe | getPreviousKeyframe (string identifier, size_t time) |
| Gets the keyframe closest to happen at or before the given time. More... | |
| virtual size_t | getLoopTime (size_t time) |
| Returns the time adjusted for the number of loops the timeline can perfrom. | |
Private Attributes | |
| float | _period |
| Period of the sine wave. | |
| float | _magnitude |
| Magnitude of the sine wave. | |
| float | _phase |
| Phase of the sine wave. | |
| float | _offset |
| Vertical offset of the sine wave. | |
| Mode | _mode |
| Sine wave mode. | |
Additional Inherited Members | |
Protected Member Functions inherited from Lumiverse::ShowControl::Timeline | |
| void | updateKeyframeState (string id, string paramName, LumiverseType *param, shared_ptr< Timeline > tl, size_t time) |
| Updates the Keyframes marked as "Use Current State" in the Timeline's data. | |
| void | loadJSON (JSONNode node) |
| Initializes the timeline with the given JSONNode's data. | |
Protected Attributes inherited from Lumiverse::ShowControl::Timeline | |
| size_t | _length |
| Stores the length of the timeline. More... | |
| size_t | _loopLength |
| Stores the loop length of the timleine. More... | |
| int | _loops |
| Describes how many times the timeline should loop. More... | |
| bool | _lengthIsUpdated |
| Indicates if the timeline's length is updated. | |
| bool | _loopLengthIsUpdated |
| Indicates if the timeline's loop length is updated. | |
| map< string, map< size_t, Keyframe > > | _timelineData |
| Map from unique identifier to timeline keyframes. More... | |
| multimap< size_t, shared_ptr< Event > > | _events |
| List of events and times that the events happen. | |
| map< string, shared_ptr< Event > > | _endEvents |
| List of events to call at the end. More... | |
This class implements a sine-wave effect.
A demonstration of how to extend timelines to make different kinds of effects.
This class is intended for use as a sub-timeline as an effect. The function for this class is: f(t) = magnitude * sin(2 pi * _period * (t + _phase)) + _offset. Note that this current sine-wave effect class works on proportional values, meaning that if you have two different floats with different ranges, say for instance [0,1] and [0,100], the sine wave with magnitude 0.5 will have a magnitude of 0.5 and 50 respectively.
This type of timelines does not support colors. Any attempt to use a LumiverseColor with this class will result with getValueAtTime() returning a nullptr.
Encodes the behavior for this effect.
ABS = Absolute. Value from the sine function will fully override the current value for the device. REL = Relative. Value from the side function will be added to the the current value for the device.
| Lumiverse::ShowControl::SineWave::SineWave | ( | float | period = 1, |
| float | magnitude = 0.5, |
||
| float | phase = 0, |
||
| float | offset = 0.5, |
||
| Mode | mode = ABS |
||
| ) |
Creates a new SineWave effect.
The default sine wave is a wave that has a 1s period, magnitude of 0.5 (which makes for an amplitude of 1.0), no phase, and is offset so the range of the sine wave is from [0,1].
| period | Period of the sine wave, in seconds |
| magnitude | Magnitude of the sine wave. Note that the total height for the sine wave is doubled |
| phase | Phase of the sine wave. Adjusts the starting point on the curve. |
| offset | Vertical offset of the sinewave. |
| mode | Effect mode. |
| Lumiverse::ShowControl::SineWave::SineWave | ( | JSONNode | node | ) |
Loads a SineWave effect from a JSONNode.
If there are missing values in the JSONNode, the default values will be filled in.
1.8.10