liblives  2.4.1-svn
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Protected Member Functions | List of all members
lives::effectKey Class Reference

class "effectKey". More...

#include <liblives.hpp>

Public Member Functions

 effectKey ()
 Creates a new, invalid effect key. More...
 
bool isValid () const
 Returns whether the effectKey is valid or not. More...
 
int key ()
 Return the (physical or virtual) key associated with this effectKey. More...
 
int numModes ()
 Return the number of modes for this effectKey slot. More...
 
int numMappedModes ()
 Return the number of mapped modes for this effectKey slot. More...
 
int setCurrentMode (int mode)
 Set the current mode this effectKey. More...
 
int currentMode ()
 Get the current mode for this effectKey. More...
 
bool setEnabled (bool setting)
 Enable an effect mapped to this effectKey, mode(). More...
 
bool enabled ()
 Return a value to indicate whether the effect mapped to this effectKey, mode() is active. More...
 
int appendMapping (effect e)
 Map an effect to the next unused mode for the effectKey. More...
 
bool removeMapping (int mode)
 Remove an effect from being mapped to this key. More...
 
effect at (int mode)
 Returns the effect mapped to the key at the specified mode. More...
 
bool operator== (const effectKey &other)
 

Protected Member Functions

 effectKey (livesApp *lives, int key)
 

Detailed Description

class "effectKey".

Represents a single effect key slot. A valid livesApp will have a map of these (effectKeyMapping()) whose size() is equal to prefs::rteKeysVirtual().

See Also
effectKeyMap::operator[]

Constructor & Destructor Documentation

lives::effectKey::effectKey ( )

Creates a new, invalid effect key.

effectKey

Member Function Documentation

int lives::effectKey::appendMapping ( effect  e)

Map an effect to the next unused mode for the effectKey.

Will only work if the livesApp::status() is LIVES_STATUS_PLAYING or LIVES_STATUS_READY. The effectKey and the effect must share the same owner livesApp, and both must be valid.

Parameters
ethe effect to append
Returns
the mode number the effect was mapped to, or -1 if the mapping failed.
See Also
removeMapping().
effect lives::effectKey::at ( int  mode)

Returns the effect mapped to the key at the specified mode.

If the effectKey is invalid, or if no effect is mapped to the mode, an invalid effect is returned.

Parameters
modethe specified mode.
Returns
the effect mapped to the key at the specified mode.
int lives::effectKey::currentMode ( )

Get the current mode for this effectKey.

If the effectKey is invalid, the current mode is -1.

Returns
the current mode of the effectKey.
See Also
setCurrentMode().
bool lives::effectKey::enabled ( )

Return a value to indicate whether the effect mapped to this effectKey, mode() is active.

If the effectKey is invalid, returns false.

Returns
true if the effect mapped at mode() is enabled.
See Also
setEnabled().
bool lives::effectKey::isValid ( ) const

Returns whether the effectKey is valid or not.

An effect key is valid if it is owned by a valid livesApp, and the livesApp::status() is not LIVES_STATUS_NOTREADY, and the key value is in the range 1 <= key <= prefs::rteKeysVirtual.

Returns
true if the effectKey is valid.
int lives::effectKey::key ( )

Return the (physical or virtual) key associated with this effectKey.

Effects (apart from generators) are applied in ascending key order. Physical keys (1 - 9) can also be toggled from the keyboard by simultaneously holding down the ctrl key, provided livesApp::interactive() is true. If the effectKey is invalid, 0 is returned.

Returns
the physical or virtual key associated with this effectKey.
int lives::effectKey::numMappedModes ( )

Return the number of mapped modes for this effectKey slot.

Modes run from 0 to numModes() - 1. When numMappedModes() == numModes() for an effectKey, no more effects may be mapped to it until a mapping is erased. If the effectKey is invalid, 0 will be returned.

Returns
the number of modes for this effectKey.
int lives::effectKey::numModes ( )

Return the number of modes for this effectKey slot.

Modes run from 0 to numModes() - 1. Effects can be mapped to modes in ascending order, but only one mode is the active mode for the effectKey. If the effectKey is invalid, 0 will be returned.

Returns
the number of modes for this effectKey.
bool lives::effectKey::operator== ( const effectKey other)
inline
Returns
true if the two effectKeys have the same livesApp and key value and belong to the same livesApp
bool lives::effectKey::removeMapping ( int  mode)

Remove an effect from being mapped to this key.

Will only work if the livesApp::status() is LIVES_STATUS_PLAYING or LIVES_STATUS_READY. If the effectKey is invalid, or if no effect is mapped to the mode, false is returned and nothing happens. If an effect is removed, effects mapped to higher mode numbers on the same effectKey will move down a mode to close the gap. Note: the currentMode() does not change unless this is the last mapped effect for this effectKey, so this may cause the currently enabled effect to change.

Parameters
modethe mode to remove the effect from.
Returns
true if an effect was unmapped.
See Also
appendMapping().
int lives::effectKey::setCurrentMode ( int  mode)

Set the current mode this effectKey.

Only works if the effecKey is valid, a valid effect is mapped to the mode, and livesApp::status() is LIVES_STATUS_PLAYING or LIVES_STATUS_READY.

Parameters
modethe mode to switch to.
Returns
the new mode of the effectKey.
See Also
currentMode().
numMappedModes().
bool lives::effectKey::setEnabled ( bool  setting)

Enable an effect mapped to this effectKey, mode().

Only works if the effecKey is valid, a valid effect is mapped to the mode, and livesApp::status() is LIVES_STATUS_PLAYING or LIVES_STATUS_READY.

Parameters
settingthe value to set to
Returns
the new state of the effectKey
See Also
enabled().

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