TracktionEngine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
engine::LaunchHandle Class Reference

A handle used to control the launching of a clip. More...

#include <tracktion_LaunchHandle.h>

Classes

struct  SplitStatus
 Represents two beat ranges where the play state can be different in each. More...
 

Public Types

enum class  PlayState : char { stopped , playing }
 
enum class  QueueState : char { stopQueued , playQueued }
 

Public Member Functions

 LaunchHandle ()=default
 Creates a LaunchHandle.
 
 LaunchHandle (const LaunchHandle &)
 Creates a copy of another LaunchHandle.
 
PlayState getPlayingStatus () const
 Returns the current playback state.
 
std::optional< QueueState > getQueuedStatus () const
 Returns the current queue state.
 
std::optional< MonotonicBeat > getQueuedEventPosition () const
 Returns the current queued event time.
 
void play (std::optional< MonotonicBeat >)
 Start playing, optionally at a given beat position.
 
void stop (std::optional< MonotonicBeat >)
 Stop playing, optionally at a given beat position.
 
bool stopAtEndOfPlay (MonotonicBeat)
 Stops at the end of a timed play (a one-shot's length or a follow action's time), unless a play is queued, which then carries on instead.
 
void playSynced (const LaunchHandle &, std::optional< MonotonicBeat >)
 Starts playing, as if it was started at the same time as the given LaunchHandle.
 
void setLooping (std::optional< BeatDuration >)
 Sets a duration to loop.
 
void nudge (BeatDuration)
 Moves the playhead by a given number of beats.
 
SplitStatus advance (const SyncRange &)
 Advance the state.
 
std::optional< BeatRange > getPlayedRange () const
 Returns the Edit beat range this has been playing for: from the beat it would have started at to reach where it is now, to the current Edit position.
 
std::optional< MonotonicBeatRange > getPlayedMonotonicRange () const
 Returns the monotonic beat range this has been playing for.
 
std::optional< BeatRange > getLastPlayedRange () const
 

Detailed Description

A handle used to control the launching of a clip.

This doesn't directly map on to playback beat positions of the clip, it just handles the start/stop status in relation to the Edit timeline. Once this has been retrieved by calling update, this needs to be wrapped in to playback actions.

Member Enumeration Documentation

◆ PlayState

enum class engine::LaunchHandle::PlayState : char
strong
Enumerator
stopped 
playing 

◆ QueueState

enum class engine::LaunchHandle::QueueState : char
strong
Enumerator
stopQueued 
playQueued 

Constructor & Destructor Documentation

◆ LaunchHandle() [1/2]

engine::LaunchHandle::LaunchHandle ( )
default

Creates a LaunchHandle.

◆ LaunchHandle() [2/2]

engine::LaunchHandle::LaunchHandle ( const LaunchHandle &  )

Creates a copy of another LaunchHandle.

Member Function Documentation

◆ getPlayingStatus()

PlayState engine::LaunchHandle::getPlayingStatus ( ) const

Returns the current playback state.

◆ getQueuedStatus()

std::optional< QueueState > engine::LaunchHandle::getQueuedStatus ( ) const

Returns the current queue state.

◆ getQueuedEventPosition()

std::optional< MonotonicBeat > engine::LaunchHandle::getQueuedEventPosition ( ) const

Returns the current queued event time.

◆ play()

void engine::LaunchHandle::play ( std::optional< MonotonicBeat >  )

Start playing, optionally at a given beat position.

◆ stop()

void engine::LaunchHandle::stop ( std::optional< MonotonicBeat >  )

Stop playing, optionally at a given beat position.

◆ stopAtEndOfPlay()

bool engine::LaunchHandle::stopAtEndOfPlay ( MonotonicBeat  )

Stops at the end of a timed play (a one-shot's length or a follow action's time), unless a play is queued, which then carries on instead.

Returns
true if this stop was queued and no stop already was, so a follow action should run

◆ playSynced()

void engine::LaunchHandle::playSynced ( const LaunchHandle &  ,
std::optional< MonotonicBeat >   
)

Starts playing, as if it was started at the same time as the given LaunchHandle.

This can optionally be delayed by supplying a MonotonicBeat to start at.

◆ setLooping()

void engine::LaunchHandle::setLooping ( std::optional< BeatDuration >  )

Sets a duration to loop.

If enabled, this will loop the handle's play duration as if it was re-triggered every duration. Set the nullopt to cancel looping.

◆ nudge()

void engine::LaunchHandle::nudge ( BeatDuration  )

Moves the playhead by a given number of beats.

◆ advance()

SplitStatus engine::LaunchHandle::advance ( const SyncRange &  )

Advance the state.

N.B. This should only be called by the audio thread.

Parameters
SyncRangeThe current SyncRange. Used to sync launch positions to. A playing handle runs on its monotonic beats, so if the Edit position jumps (a relocate, stop-move-play or loop wrap) it carries on from where it was.
Returns
The unlooped Edit beat range split if there are different play/stop states. [[ audio_thread ]]

◆ getPlayedRange()

std::optional< BeatRange > engine::LaunchHandle::getPlayedRange ( ) const

Returns the Edit beat range this has been playing for: from the beat it would have started at to reach where it is now, to the current Edit position.

An Edit position jump moves its start with it. N.B. The length is unlooped.

◆ getPlayedMonotonicRange()

std::optional< MonotonicBeatRange > engine::LaunchHandle::getPlayedMonotonicRange ( ) const

Returns the monotonic beat range this has been playing for.

N.B. This is really only useful for syncing to other timeline events. Unlike getPlayedRange() it's unaffected by Edit position jumps.

◆ getLastPlayedRange()

std::optional< BeatRange > engine::LaunchHandle::getLastPlayedRange ( ) const

The range last played before stopping, as a start beat and the length of time it played for, which Edit position jumps don't change.


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