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

class "multitrack". More...

#include <liblives.hpp>

Public Member Functions

bool isValid () const
 returns whether the multitrack is valid or not. More...
 
bool isActive () const
 returns whether the multitrack is active or not. More...
 
bool setCurrentTrack (int track) const
 Set the current track if isActive() is true. More...
 
int currentTrack () const
 If isActive() is true, then this method returns the current active track. More...
 
double setCurrentTime (double time) const
 Set the current playback start time in seconds. More...
 
double currentTime () const
 Return the current playback time in seconds. More...
 
livesString trackLabel (int track) const
 If isActive() is true, then this method returns the label for a track. More...
 
bool setTrackLabel (int track, livesString label=livesString()) const
 Set the label for a track. More...
 
lives_gravity_t gravity () const
 Returns the value of the multitrack gravity. More...
 
lives_gravity_t setGravity (lives_gravity_t mode) const
 Set the gravity mode for multitrack. More...
 
lives_insert_mode_t insertMode () const
 Returns the value of the multitrack insert mode. More...
 
lives_insert_mode_t setInsertMode (lives_insert_mode_t mode) const
 Set the gravity mode for multitrack. More...
 
int addVideoTrack (bool in_front) const
 Append a new video track into the timeline. More...
 
int numVideoTracks () const
 Returns the number of video tracks for multitrack. More...
 
int numAudioTracks () const
 Returns the number of audio backing tracks for multitrack. More...
 
double FPS () const
 Return the framerate of the multitrack in frames per second. More...
 
block insertBlock (clip c, bool ignore_selection_limits=false, bool without_audio=false) const
 Insert frames from clip c into currentTrack() at currentTime() If ignore_selection_limits is true, then all frames from the clip will be inserted, otherwise (the default) only frames from clip::selectionStart() to clip::selectionEnd() will be used. More...
 
livesString wipeLayout (bool force=false) const
 Wipe the current layout, leaving a blank layout. More...
 
livesString chooseLayout () const
 Allow the user to graphically choose a layout to load for the set. More...
 
livesStringList availableLayouts () const
 Return a list of the available layouts for the currently loaded set. More...
 
bool reloadLayout (livesString filename) const
 Reload the selected layout, replacing the current multitrack layout. More...
 
livesString saveLayout (livesString name) const
 Save the current layout using the name supplied. More...
 
livesString saveLayout () const
 Save the current layout using the current layout name. More...
 
clip render (bool render_audio=true, bool normalise_audio=true) const
 Render the current layout to a new clip and return it. More...
 
effect autoTransition () const
 Returns the current autotransition effect for multitrack mode. More...
 
bool disableAutoTransition () const
 Set the current autotransition effect for multitrack mode to "None" (no effect). More...
 
bool setAutoTransition (effect autotrans) const
 Set the current autotransition effect for multitrack mode. More...
 
bool operator== (const multitrack &other) const
 

Protected Member Functions

 multitrack (livesApp *lives=NULL)
 multitrack
 

Protected Attributes

livesAppm_lives
 The linked LiVES application.
 

Detailed Description

class "multitrack".

Represents the multitrack object in a livesApp.

Member Function Documentation

int lives::multitrack::addVideoTrack ( bool  in_front) const

Append a new video track into the timeline.

Only works if isActive() is true, and livesApp::status() is LIVES_STATUS_READY.

Parameters
in_frontset to true to insert a video track in front of existing video tracks. Otherwise insert will be behind.
Returns
the index number of the newly added track, or -1 if the operation failed.
effect lives::multitrack::autoTransition ( ) const

Returns the current autotransition effect for multitrack mode.

If no effect is set, returns an invalid effect. If the owning livesApp::isInvalid() is true, or if livesApp::Status() is LIVES_STATUS_NOTREADY, returns an invalid effect.

Returns
the autotransition effect for multitrack.
See Also
setAutoTransition().
disableAutoTransition().
livesStringList lives::multitrack::availableLayouts ( ) const

Return a list of the available layouts for the currently loaded set.

If livesApp::isReady() is false, or if no set is loaded, then an empty livesStringList is returned.

Returns
list of available layouts for the currently loaded set
See Also
reloadLayout().
livesString lives::multitrack::chooseLayout ( ) const

Allow the user to graphically choose a layout to load for the set.

Only works if livesApp::status() is LIVES_STATUS_READY and isActive() is true, otherwise an empty livesString is returned.

Returns
the name of the layout selected.
See Also
reloadLayout().
availableLayouts().
double lives::multitrack::currentTime ( ) const

Return the current playback time in seconds.

If isActive() is true this returns the current player time in the multitrack timeline (equivalent to to player::playbackTime(), and during playback, equivalent to player::elapsedTime() plus a constant offset). This function works when livesApp::status() is LIVE_STATUS_READY or LIVES_STATUS_PLAYING. If isActive() is false, 0. is returned.

Returns
the current clip playback time.
See Also
setCurrentTime().
currentAudioTime().
elapsedTime().
int lives::multitrack::currentTrack ( ) const

If isActive() is true, then this method returns the current active track.

The active track defines the insertion point for video and audio, along with the currentTime(). If isActive() is false, or the livesApp::status is not LIVES_STATUS_READY or LIVES_STATUS_PLAYING then the return value is undefined.

Returns
the current active track in multitrack mode. A value >= 0 represents a video track, a value < 0 represents a backing audio track.
See Also
setCurrentTrack().
bool lives::multitrack::disableAutoTransition ( ) const

Set the current autotransition effect for multitrack mode to "None" (no effect).

If the livesApp::status() is not LIVES_STATUS_READY or LIVES_STATUS_PLAYING, returns false and nothing happens.

Returns
true if the autotransition was disabled.
See Also
autoTransition().
setAutoTransition().
double lives::multitrack::FPS ( ) const

Return the framerate of the multitrack in frames per second.

If isActive() is false, returns 0. Otherwise when the livesAPP::status() is LIVES_STATUS_PLAYING, player::FPS() takes this value.

Returns
the framerate of the multitrack in frames per second.
lives_gravity_t lives::multitrack::gravity ( ) const

Returns the value of the multitrack gravity.

This value, together with the insertMode() defines what happens when a block is inserted, moved or deleted. If isActive() is false, the return value is undefined.

Returns
the multitrack gravity.
See Also
insertMode().
block lives::multitrack::insertBlock ( clip  c,
bool  ignore_selection_limits = false,
bool  without_audio = false 
) const

Insert frames from clip c into currentTrack() at currentTime() If ignore_selection_limits is true, then all frames from the clip will be inserted, otherwise (the default) only frames from clip::selectionStart() to clip::selectionEnd() will be used.

If without_audio is false (the default), audio is also inserted. Frames are automatically resampled to fit layout::fps(). Depending on the insertMode(), it may not be possible to do the insertion. In case of failure an invalid block is returned. If the current track is a backing audio track, then only audio is inserted; in this case if without_audio is true an invalid block is returned. Only works if livesApp::status() is LIVES_STATUS_READY and isActive() is true. Note: the actual place where the block ends up, and its final size depends on various factors such as the gravity() setting, the insertMode() setting, and the location of other blocks in the layout. The insertion may cause other blocks to relocate.

Parameters
cthe clip to insert from
ignore_selection_limitsif true then all frames from the clip will be inserted
without_audioif false then audio is also inserted
Returns
the newly inserted block.
See Also
setCurrentTrack().
setCurrentTime().
clip::setSelectionStart().
clip::setSelectionEnd().
setGravity().
block::remove().
lives_insert_mode_t lives::multitrack::insertMode ( ) const

Returns the value of the multitrack insert mode.

This value, together with gravity() defines what happens when a block is inserted, moved or deleted. If isActive() is false, the return value is undefined.

Returns
the multitrack insert mode.
See Also
gravity().
bool lives::multitrack::isActive ( ) const

returns whether the multitrack is active or not.

This is equivent to livesApp::mode() == LIVES_INTERFACE_MODE_MULTITRACK.

Returns
whether the multitrack is active or not.
bool lives::multitrack::isValid ( ) const

returns whether the multitrack is valid or not.

A valid multitrack is one which is owned by a valid livesApp, whose livesApp::status() is not LIVES_STATUS_NOTREADY.

Returns
whether the multitrack is valid
int lives::multitrack::numAudioTracks ( ) const

Returns the number of audio backing tracks for multitrack.

If isActive() is false, 0 is returned.

Returns
the number of audio tracks
int lives::multitrack::numVideoTracks ( ) const

Returns the number of video tracks for multitrack.

If isActive() is false, 0 is returned.

Returns
the number of video tracks
See Also
addVideoTrack()
bool lives::multitrack::operator== ( const multitrack other) const
inline
Returns
true if the two layouts have the same livesApp owner
bool lives::multitrack::reloadLayout ( livesString  filename) const

Reload the selected layout, replacing the current multitrack layout.

Only works if livesApp::status() is LIVES_STATUS_READY and isActive() is true. The layout must be "owned" by the currently loaded set, otherwise an error may be shown and it will not be loaded. If filename is an empty livesString, chooseLayout() will be called first to get the layout name. If livesApp::interactive() is true, the user will have a chance to save the current layout (if any) first.

Parameters
filenamethe filename of the layout to load
Returns
true if the specified layout could be loaded
See Also
chooseLayout().
availableLayouts().
saveLayout().
clip lives::multitrack::render ( bool  render_audio = true,
bool  normalise_audio = true 
) const

Render the current layout to a new clip and return it.

Only works if isActive() is true, and livesApp::status() is LIVES_STATUS_READY, and the current layout is not empty. If livesApp::interactive() is true, the user may choose to cancel the operation, or to render fewer than all frames. After rendering, if prefs::mtExitRender() is true, the livesApp::mode() will change to LIVES_INTERFACE_MODE_CLIPEDIT, and isActive() will change to false.

Parameters
render_audiotrue if audio should be rendered in addition to video.
normalise_audioif true then the audio volume is normalized (backing audio gets half volume, video tracks get half volume)
Returns
clip a new clip which contains the rendered video, or an invalid clip in case of failure.
livesString lives::multitrack::saveLayout ( livesString  name) const

Save the current layout using the name supplied.

The layout will be saved in the layouts directory for the currently loaded set, so the name should not include any directory component. Only works if the livesApp::status() is LIVES_STATUS_READY, and the current layout is not empty, otherwise an empty livesString is returned. Note that this WILL work even if isActive() is false. If livesApp::interactive() is true, the user may choose to cancel the operation. If the layout name is empty, the user will be prompted graphically to enter a name. If the set name is empty, the user will be prompted to enter a set name (if livesApp::interactive() is true; otherwise this will fail and an empty string will be returned). Rarely it will not be possible to save a layout (if it was generated by recording events, and it contains generated audio or video).

Parameters
namethe name to save the layout
Returns
the filename the set was saved to, or empty livesString if saving failed.
See Also
wipeLayout().
reloadLayout();
set::setName().
livesString lives::multitrack::saveLayout ( ) const

Save the current layout using the current layout name.

Only works if the livesApp::status() is LIVES_STATUS_READY, and the current layout is not empty, otherwise an empty livesString is returned. Note that this WILL work even if isActive() is false. If livesApp::interactive() is true, the user may choose to cancel the operation. If the layout name has not been previously set, the user will be prompted graphically to enter a name. If the set name is empty, the user will be prompted to enter a set name (if livesApp::interactive() is true; otherwise this will fail and an empty string will be returned). Rarely it will not be possible to save a layout (if it was generated by recording events, and it contains generated audio or video).

Returns
the filename the set was saved to, or empty livesString if saving failed.
See Also
wipeLayout().
reloadLayout();
set::setName().
bool lives::multitrack::setAutoTransition ( effect  autotrans) const

Set the current autotransition effect for multitrack mode.

If the livesApp::status() is not LIVES_STATUS_READY or LIVES_STATUS_PLAYING, returns false and nothing happens. If the effect is not a transition, false is returned and nothing happens. If the effect is invalid, this is the same as calling disableAutoTransition().

Parameters
autotransthe new autotransition effect for multitrack.
Returns
true if the autotransition was changed.
See Also
autoTransition().
disableAutoTransition().
double lives::multitrack::setCurrentTime ( double  time) const

Set the current playback start time in seconds.

This is also the insertion point for insertBlock(). Only works if the livesApp::status() is LIVES_STATUS_READY and isActive() is true. Setting the current time may cause the timeline to stretch visually (i.e zoom out). The miminum value is 0.0; values < 0.0 will be ignored. This function is synonymous with player::setPlaybackTime().

Parameters
timethe time in seconds to set playback start time to.
Returns
the new playback start time.
See Also
currentTime().
bool lives::multitrack::setCurrentTrack ( int  track) const

Set the current track if isActive() is true.

Only works when livesApp::status() is LIVES_STATUS_READY or LIVES_STATUS_PLAYING.

Parameters
tracka value >= 0 represents a video track, a value < 0 represents a backing audio track.
Returns
true if the track setting was successful.
See Also
currentTrack().
lives_gravity_t lives::multitrack::setGravity ( lives_gravity_t  mode) const

Set the gravity mode for multitrack.

If isActive() is false, nothing happens and an undefined value is returned, otherwise if livesApp::status() is not LIVES_STATUS_READY or LIVES_STATUS_PLAYING, nothing happens.

Parameters
modethe new gravity mode to set.
Returns
the new gravity mode.
See Also
gravity().
lives_insert_mode_t lives::multitrack::setInsertMode ( lives_insert_mode_t  mode) const

Set the gravity mode for multitrack.

If isActive() is false, nothing happens and an undefined value is returned, otherwise if livesApp::status() is not LIVES_STATUS_READY or LIVES_STATUS_PLAYING, nothing happens.

Parameters
modethe new insert mode to set.
Returns
the new insert mode.
See Also
insertMode().
bool lives::multitrack::setTrackLabel ( int  track,
livesString  label = livesString() 
) const

Set the label for a track.

This is for display purposes only and has no other effect. If isActive() is false, the track label is not changed, and false is returned. If the label is not provided, or is an empty livesString, the user will be prompted to enter a name at runtime.

Parameters
trackthe track number. Must be >= 0.
labela livesString containing the text to label the track with.
Returns
true if it was possible to change the label.
See Also
trackLabel().
livesString lives::multitrack::trackLabel ( int  track) const

If isActive() is true, then this method returns the label for a track.

Parameters
trackthe track number. A value >= 0 represents a video track, a value < 0 represents a backing audio track.
Returns
the track label, or empty livesString if the specified track does not exist.
See Also
setTrackLabel().
livesString lives::multitrack::wipeLayout ( bool  force = false) const

Wipe the current layout, leaving a blank layout.

If force is false, then the user will have a chance to cancel (if livesApp::interactive() is true), or to save the layout. Only works if livesApp::status() is LIVES_STATUS_READY and isActive() is true. Otherwise, the layout will not be wiped, and an empty livesString will be returned.

Parameters
forceset to true to force the layout to be wiped.
Returns
the name which the layout was saved to, or empty livesString if it was not saved.

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