Lumiverse
2.5
A framework for creating lighting control applications
|
A playback object manages layers, timelines, and coordinates their actions and updates. More...
#include <Playback.h>
Public Member Functions | |
Playback (Rig *rig, float gm=1.0f) | |
Initializes a playback object. More... | |
Playback (Rig *rig, string filename) | |
Loads a playback object from a file. More... | |
void | start () |
Starts the playback loop in a separate thread. | |
void | stop () |
Stops the playback loop in a separate thread. | |
bool | isRunning () |
Returns the status of the playback update loop. | |
void | update () |
Sets the playback update rate. More... | |
bool | addLayer (shared_ptr< Layer > layer) |
Adds a layer to the playback. More... | |
shared_ptr< Layer > | getLayer (string name) |
Retrieves a pointer to the layer with the specified name. More... | |
void | deleteLayer (string name) |
Deletes a layer from the playback. | |
bool | addTimeline (string id, shared_ptr< Timeline > tl) |
Add a Timeline to the Playback. More... | |
void | deleteTimeline (string id) |
Deletes a Timeline from the Playback. More... | |
shared_ptr< Timeline > | getTimeline (string id) |
Gets a timeline from the Playback. More... | |
map< string, shared_ptr< Timeline > > & | getTimelines () |
Returns the map of all Timelines contained in the Playback. | |
bool | attachToRig (int pid=1) |
Binds the update function for this playback to the Rig's update function. More... | |
bool | detachFromRig () |
Unbinds the update function for this playback from the Rig. More... | |
const unique_ptr< Programmer > & | getProgrammer () |
Gets a reference to the programmer object stored by the playback. | |
bool | save (string filename, bool overwrite=false) |
Saves a JSON file containing all information stored by the playback, including the Rig. More... | |
JSONNode | toJSON () |
Returns the JSON representation of this playback object. More... | |
Rig * | getRig () |
Returns a pointer to the rig. | |
vector< string > | getLayerNames () |
Returns a list of the layer names contained in the Playback. | |
vector< string > | getTimelineNames () |
Returns a list of Timeline ids contained in the Playback. More... | |
const map< string, shared_ptr< Layer > > & | getLayers () |
Returns a reference to the layers in the Playback. | |
bool | loadJSON (JSONNode node) |
Loads data from a JSON object. | |
int | getNumLayers () |
Returns the number of layers contained in this Playback object. More... | |
bool | storeGroup (string name, DeviceSet group, bool overwrite=false) |
Saves a user-specified DeviceSet as a group in the Playback. More... | |
bool | storeDynamicGroup (string name, DynamicDeviceSet group, bool overwrite=false) |
Saves a user-specified DynamicDeviceSet as a group in the Playback. More... | |
bool | deleteGroup (string name) |
Deletes a group. More... | |
bool | deleteDynamicGroup (string name) |
Deletes a dynamic group. More... | |
DeviceSet | getGroup (string name) |
Gets a saved group. | |
DynamicDeviceSet | getDynamicGroup (string name) |
Gets a saved Dynamic group. | |
bool | groupExists (string name) |
Checks if a group with the given name exists. | |
bool | dynamicGroupExists (string name) |
Checks if a dynamic group with the given name exists. | |
const map< string, DeviceSet > & | getGroups () |
Get the map of groups in the Playback. | |
const map< string, DynamicDeviceSet > & | getDynamicGroups () |
Get the map of dynamic groups in the Playback. | |
void | setGrandmaster (float val) |
float | getGrandmaster () |
Gets the value of the grandmaster. | |
bool | addCueList (shared_ptr< CueList > cueList) |
Adds a cue list to the Playback If a list already exists with the same name, this function will return false. More... | |
shared_ptr< CueList > | getCueList (string id) |
Retrieves a cue list from the Playback. More... | |
void | deleteCueList (string id) |
Deletes a cue list from the Playback. | |
bool | addCueListToLayer (string cueListId, string layerName, bool resetCurrentCue=true) |
Assigns a cue list to a layer If one of the specified items doesn't exist, nothing will happen and this function will return false. More... | |
void | removeCueListFromLayer (string layerName) |
Removes a cue list assigned to a particular layer. More... | |
vector< string > | getCueListNames () |
Returns a list of the cue list names contained in the Playback. | |
int | getNumCueLists () |
Returns the number of cue lists contained in this Playback object. More... | |
Private Member Functions | |
bool | load (string filename) |
Load Playback data from a file. | |
Private Attributes | |
map< string, shared_ptr< Layer > > | m_layers |
Map of layer names to layers. | |
map< string, Device * > | m_state |
Copy of all devices in the rig. Current state of the playback. | |
map< string, DeviceSet > | m_groups |
Stores named groups (DeviceSets) created by the user. | |
map< string, DynamicDeviceSet > | m_dynGroups |
Stores named dynamic groups (DynamicDeviceSets) created by the user. | |
map< string, shared_ptr< Timeline > > | m_timelines |
Map of. | |
map< string, shared_ptr< CueList > > | m_cueLists |
Map of CueList ids to CueList objects. | |
bool | m_running |
True when the update loop is running. | |
int | m_funcId |
ID of the attached function in the rig update loop. | |
float | m_grandmaster |
Controls the overall level of parameters in the rig. | |
Rig * | m_rig |
Pointer to the rig that this playback runs on. | |
unique_ptr< Programmer > | m_prog |
Programmer object owned by the Playback. | |
A playback object manages layers, timelines, and coordinates their actions and updates.
Playbacks are typically attached to the main update loop in Rig and are limited in their update speed according to the speed of the Rig update loop. You can choose to run a Playback in a separate thread, though you'll need to create that thread yourself and call update() manually.
Playbacks manage a series of Layers, which can each have timelines running on them. The layers are updated by the Playback and then flattened down and sent to the Rig during each call to Playback::update().
Lumiverse::ShowControl::Playback::Playback | ( | Rig * | rig, |
float | gm = 1.0f |
||
) |
Initializes a playback object.
rig | Rig object associated with this playback. |
Lumiverse::ShowControl::Playback::Playback | ( | Rig * | rig, |
string | filename | ||
) |
Loads a playback object from a file.
Must specify a rig to associate with the playback object.
rig | Rig that will run the cues in. If there's a mis-match, some weird stuff will happen. |
filename | File to load the playback from. |
bool Lumiverse::ShowControl::Playback::addCueList | ( | shared_ptr< CueList > | cueList | ) |
bool Lumiverse::ShowControl::Playback::addCueListToLayer | ( | string | cueListId, |
string | layerName, | ||
bool | resetCurrentCue = true |
||
) |
Assigns a cue list to a layer If one of the specified items doesn't exist, nothing will happen and this function will return false.
cueListId | Cue list identifier |
layerName | Name of the layer to assign the cue list to. |
resetCurrenCue | Set to true to reset the current cue of the layer (resets to -1) |
bool Lumiverse::ShowControl::Playback::addLayer | ( | shared_ptr< Layer > | layer | ) |
Adds a layer to the playback.
Name is extracted from the layer settings
layer | The layer to add to the Playback object. |
bool Lumiverse::ShowControl::Playback::addTimeline | ( | string | id, |
shared_ptr< Timeline > | tl | ||
) |
bool Lumiverse::ShowControl::Playback::attachToRig | ( | int | pid = 1 | ) |
Binds the update function for this playback to the Rig's update function.
pid | ID to assign to the function. Defaults to 1. Must be positive. |
bool Lumiverse::ShowControl::Playback::deleteDynamicGroup | ( | string | name | ) |
Deletes a dynamic group.
name | Name of the group to delete |
bool Lumiverse::ShowControl::Playback::deleteGroup | ( | string | name | ) |
Deletes a group.
name | Name of the group to delete |
void Lumiverse::ShowControl::Playback::deleteTimeline | ( | string | id | ) |
bool Lumiverse::ShowControl::Playback::detachFromRig | ( | ) |
Unbinds the update function for this playback from the Rig.
shared_ptr< CueList > Lumiverse::ShowControl::Playback::getCueList | ( | string | id | ) |
shared_ptr< Layer > Lumiverse::ShowControl::Playback::getLayer | ( | string | name | ) |
Retrieves a pointer to the layer with the specified name.
name | Layer name |
int Lumiverse::ShowControl::Playback::getNumCueLists | ( | ) |
Returns the number of cue lists contained in this Playback object.
int Lumiverse::ShowControl::Playback::getNumLayers | ( | ) |
Returns the number of layers contained in this Playback object.
shared_ptr< Timeline > Lumiverse::ShowControl::Playback::getTimeline | ( | string | id | ) |
vector< string > Lumiverse::ShowControl::Playback::getTimelineNames | ( | ) |
void Lumiverse::ShowControl::Playback::removeCueListFromLayer | ( | string | layerName | ) |
Removes a cue list assigned to a particular layer.
layerName | Name of the layer |
bool Lumiverse::ShowControl::Playback::save | ( | string | filename, |
bool | overwrite = false |
||
) |
Saves a JSON file containing all information stored by the playback, including the Rig.
File will contain the Rig and everything contained in this playback file. Loading of this output file should be done by Playback::load()
filename | Path to file |
overwrite | If a file with the specified name already exists, that file will be overwritten if overwrite is set to true. Defaults to false. |
void Lumiverse::ShowControl::Playback::setGrandmaster | ( | float | val | ) |
Sets the level of the grandmaster.
val | Value between 0 and 1. Values outisde this range will be clamped. |
bool Lumiverse::ShowControl::Playback::storeDynamicGroup | ( | string | name, |
DynamicDeviceSet | group, | ||
bool | overwrite = false |
||
) |
Saves a user-specified DynamicDeviceSet as a group in the Playback.
name | Name of the group |
group | DynamicDeviceSet to be saved |
overwrite | If set to true, will replace the group with the same name if it exists. |
bool Lumiverse::ShowControl::Playback::storeGroup | ( | string | name, |
DeviceSet | group, | ||
bool | overwrite = false |
||
) |
Saves a user-specified DeviceSet as a group in the Playback.
name | Name of the group |
group | DeviceSet to be saved |
overwrite | If set to true, will replace the group with the same name if it exists. |
JSONNode Lumiverse::ShowControl::Playback::toJSON | ( | ) |
void Lumiverse::ShowControl::Playback::update | ( | ) |