Lumiverse  2.5
A framework for creating lighting control applications
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Lumiverse::ShowControl::Playback Class Reference

A playback object manages layers, timelines, and coordinates their actions and updates. More...

#include <Playback.h>

Collaboration diagram for Lumiverse::ShowControl::Playback:
Collaboration graph
[legend]

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< LayergetLayer (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< TimelinegetTimeline (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...
 
RiggetRig ()
 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< CueListgetCueList (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, DeviceSetm_groups
 Stores named groups (DeviceSets) created by the user.
 
map< string, DynamicDeviceSetm_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.
 
Rigm_rig
 Pointer to the rig that this playback runs on.
 
unique_ptr< Programmerm_prog
 Programmer object owned by the Playback.
 

Detailed Description

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().

Constructor & Destructor Documentation

Lumiverse::ShowControl::Playback::Playback ( Rig rig,
float  gm = 1.0f 
)

Initializes a playback object.

Parameters
rigRig 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.

Parameters
rigRig that will run the cues in. If there's a mis-match, some weird stuff will happen.
filenameFile to load the playback from.

Member Function Documentation

bool Lumiverse::ShowControl::Playback::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.

Parameters
cueListCue list to add.
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.

Parameters
cueListIdCue list identifier
layerNameName of the layer to assign the cue list to.
resetCurrenCueSet 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

Parameters
layerThe layer to add to the Playback object.
Returns
True on success, false if a layer already exists with the same name
bool Lumiverse::ShowControl::Playback::addTimeline ( string  id,
shared_ptr< Timeline tl 
)

Add a Timeline to the Playback.

Parameters
idTimeline identifier, must be unique
tlTimeline object to add
Returns
true on success, false if a timeline with the given id already exists.
bool Lumiverse::ShowControl::Playback::attachToRig ( int  pid = 1)

Binds the update function for this playback to the Rig's update function.

Parameters
pidID to assign to the function. Defaults to 1. Must be positive.
Returns
True on success, false on failure
bool Lumiverse::ShowControl::Playback::deleteDynamicGroup ( string  name)

Deletes a dynamic group.

Parameters
nameName of the group to delete
Returns
True on success, false if a group with the given name does not exist
bool Lumiverse::ShowControl::Playback::deleteGroup ( string  name)

Deletes a group.

Parameters
nameName of the group to delete
Returns
True on success, false if a group with the given name does not exist
void Lumiverse::ShowControl::Playback::deleteTimeline ( string  id)

Deletes a Timeline from the Playback.

Parameters
idTimeline identifier
bool Lumiverse::ShowControl::Playback::detachFromRig ( )

Unbinds the update function for this playback from the Rig.

Returns
True on success, false on failure.
shared_ptr< CueList > Lumiverse::ShowControl::Playback::getCueList ( string  id)

Retrieves a cue list from the Playback.

Parameters
idCue list id.
Returns
Pointer to specified cue list. nullptr if cue list doesn't exist.
shared_ptr< Layer > Lumiverse::ShowControl::Playback::getLayer ( string  name)

Retrieves a pointer to the layer with the specified name.

Parameters
nameLayer name
Returns
Pointer to layer specified. nullptr if layer does not exist.
int Lumiverse::ShowControl::Playback::getNumCueLists ( )

Returns the number of cue lists contained in this Playback object.

Returns
Number of cue lists.
int Lumiverse::ShowControl::Playback::getNumLayers ( )

Returns the number of layers contained in this Playback object.

Returns
Number of layers.
shared_ptr< Timeline > Lumiverse::ShowControl::Playback::getTimeline ( string  id)

Gets a timeline from the Playback.

Parameters
idTimeline identifier
Returns
Shared Pointer to the requested Timeline object. nullptr if Timeline doesn't exist.
vector< string > Lumiverse::ShowControl::Playback::getTimelineNames ( )

Returns a list of Timeline ids contained in the Playback.

Returns
List of Timeline ids. Should be sorted according to C++ standard library string comparison.
void Lumiverse::ShowControl::Playback::removeCueListFromLayer ( string  layerName)

Removes a cue list assigned to a particular layer.

Parameters
layerNameName 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()

Parameters
filenamePath to file
overwriteIf a file with the specified name already exists, that file will be overwritten if overwrite is set to true. Defaults to false.
Returns
True on success, false on failure.
void Lumiverse::ShowControl::Playback::setGrandmaster ( float  val)

Sets the level of the grandmaster.

Parameters
valValue 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.

Parameters
nameName of the group
groupDynamicDeviceSet to be saved
overwriteIf set to true, will replace the group with the same name if it exists.
Returns
True on success, false if a group with the given name already exists and overwrite is set to false.
bool Lumiverse::ShowControl::Playback::storeGroup ( string  name,
DeviceSet  group,
bool  overwrite = false 
)

Saves a user-specified DeviceSet as a group in the Playback.

Parameters
nameName of the group
groupDeviceSet to be saved
overwriteIf set to true, will replace the group with the same name if it exists.
Returns
True on success, false if a group with the given name already exists and overwrite is set to false
JSONNode Lumiverse::ShowControl::Playback::toJSON ( )

Returns the JSON representation of this playback object.

Some things don't need to be saved since they'll be reconstructed on load. The state of the playback and the programmer will be constructed on load.

Returns
JSONNode containing all Playback information (includes the Rig)
void Lumiverse::ShowControl::Playback::update ( )

Sets the playback update rate.

Parameters
rateUpdate loop rate in cycles/second

Updates the layers contained by the Playback object and updates the Rig.


The documentation for this class was generated from the following files: