tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
tracktion::engine::TransportControl Class Reference

Controls the transport of an Edit's playback. More...

#include "tracktion_TransportControl.h"

Inheritance diagram for tracktion::engine::TransportControl:
juce::ChangeBroadcaster juce::Timer

Classes

struct  ButtonRepeater
 
struct  FileFlushTimer
 
struct  Listener
 Listener interface to be notified of changes to the transport. More...
 
struct  PlayHeadWrapper
 
struct  ReallocationInhibitor
 Prevents the nodes being regenerated while one of these exists, e.g. More...
 
struct  ScopedContextAllocator
 Frees the playback context and then re-allocates it upon destruction. More...
 
struct  ScopedPlaybackRestarter
 Is an Edit is playing back, this resumes playback when destroyed. More...
 
struct  ScreenSaverDefeater
 
struct  SectionPlayer
 
struct  TransportState
 Represents the state of an Edit's transport. More...
 

Public Member Functions

 TransportControl (Edit &, const juce::ValueTree &)
 Constructs a TransportControl for an Edit.
 
 ~TransportControl () override
 Destructor.
 
void play (bool justSendMMCIfEnabled)
 Starts playback of an Edit.
 
void playFromStart (bool justSendMMCIfEnabled)
 Sets the position to the startPosition and begins playback from there.
 
void playSectionAndReset (TimeRange rangeToPlay)
 Plays a section of an Edit then stops playback, useful for previewing clips.
 
void record (bool justSendMMCIfEnabled, bool allowRecordingIfNoInputsArmed=false)
 Starts recording.
 
void stop (bool discardRecordings, bool clearDevices, bool canSendMMCStop=true)
 Stops recording, creating clips of newyly recorded files/MIDI data.
 
void stopIfRecording ()
 Stops playback only if recording is currently in progress.
 
void stopRecording (bool discardRecordings=false)
 Stops recording without stopping playback.
 
juce::Result applyRetrospectiveRecord (bool armedOnly)
 Applys a retrospective record to any assigned input devices, creating clips for any historical input.
 
juce::Array< juce::FilegetRetrospectiveRecordAsAudioFiles ()
 Perfoms a retrospective record operation and returns any new files.
 
void syncToEdit (Edit *editToSyncTo, bool syncToTargetLoopLength)
 Syncs this Edit's playback to another Edit.
 
bool isPlaying () const
 Returns true if the transport is playing.
 
bool isRecording () const
 Returns true if recording is in progress.
 
bool isSafeRecording () const
 Returns true if safe-recording is in progress.
 
bool isStopping () const
 Returns true if the transport is currently being stopped.
 
bool isRecordingStopping () const
 Returns true if a recording is currently being stopped.
 
TimePosition getTimeWhenStarted () const
 Returns the time when the transport was started.
 
TimePosition getPosition () const
 Returns the current transport position.
 
void setPosition (TimePosition)
 Sets a new transport position.
 
void setPosition (TimePosition timeToMoveTo, TimePosition timeToPerformJump)
 Sets a new transport position to take effect at a given time.
 
void setUserDragging (bool)
 Signifies a scrub-drag operation has started/stopped.
 
bool isUserDragging () const noexcept
 Returns true if a drag/scrub operation has been enabled.
 
bool isPositionUpdatingFromPlayhead () const
 Returns true if the current position change was triggered from an update directly from the playhead (rather than a call to setCurrentPosition).
 
void setLoopIn (TimePosition)
 Sets the loop in position.
 
void setLoopOut (TimePosition)
 Sets a loop out position.
 
void setLoopPoint1 (TimePosition)
 Sets a loop point 1 position.
 
void setLoopPoint2 (TimePosition)
 Sets a loop point 2 position.
 
void setLoopRange (TimeRange)
 Sets the loop points from a given range.
 
TimeRange getLoopRange () const noexcept
 Returns the loop range.
 
void setSnapType (TimecodeSnapType)
 Sets a snap type to use.
 
TimecodeSnapType getSnapType () const noexcept
 Returns the current snap type.
 
EditPlaybackContextgetCurrentPlaybackContext () const
 Returns the active EditPlaybackContext if this Edit is attached to the DeviceManager for playback.
 
bool isPlayContextActive () const
 Returns true if this Edit is attached to the DeviceManager for playback.
 
void ensureContextAllocated (bool alwaysReallocate=false)
 Ensures an active EditPlaybackContext has been created so this Edit can be played back.
 
void freePlaybackContext ()
 Detaches the current EditPlaybackContext, removing it from the DeviceManager.
 
void triggerClearDevicesOnStop ()
 Triggers a graph rebuild when playback stops.
 
void forceOrphanFreezeAndProxyFilesPurge ()
 Triggers a cleanup of any unused freeze and proxy files.
 
void setRewindButtonDown (bool isDown)
 Starts/stops a rewind operation.
 
void setFastForwardButtonDown (bool isDown)
 Starts/stops a fast-forward operation.
 
void nudgeLeft ()
 Moves the transport back slightly.
 
void nudgeRight ()
 Moves the transport forwards slightly.
 
void editHasChanged ()
 Triggers a playback graph rebuild.
 
bool isAllowedToReallocate () const noexcept
 Returns true if no ReallocationInhibitors currently exist.
 
void addListener (Listener *l)
 Adds a Listener.
 
void removeListener (Listener *l)
 Removes a Listener.
 
void callRecordingAboutToStartListeners (InputDeviceInstance &, EditItemID)
 
void callRecordingAboutToStopListeners (InputDeviceInstance &, EditItemID)
 
void callRecordingFinishedListeners (InputDeviceInstance &, EditItemID, juce::ReferenceCountedArray< Clip >)
 
- Public Member Functions inherited from juce::ChangeBroadcaster
void addChangeListener (ChangeListener *listener)
 
void removeChangeListener (ChangeListener *listener)
 
void removeAllChangeListeners ()
 
void sendChangeMessage ()
 
void sendSynchronousChangeMessage ()
 
void dispatchPendingMessages ()
 

Static Public Member Functions

static juce::Array< TransportControl * > getAllActiveTransports (Engine &)
 Returns all the active TransportControl[s] in the Engine.
 
static int getNumPlayingTransports (Engine &)
 Returns the number of Edits currently playing.
 
static void stopAllTransports (Engine &, bool discardRecordings, bool clearDevices)
 Stops all TransportControl[s] in the Engine playing.
 
static std::vector< std::unique_ptr< ScopedContextAllocator > > restartAllTransports (Engine &, bool clearDevices)
 Restarts all TransportControl[s] in the Edit.
 

Public Attributes

Engineengine
 The Engine this Edit belongs to.
 
Editedit
 The Edit this transport belongs to.
 
juce::ValueTree state
 The state of this transport.
 
juce::CachedValue< TimePositionstartPosition
 The position to start playing from.
 
juce::CachedValue< TimePositionposition
 
juce::CachedValue< TimePositionloopPoint1
 
juce::CachedValue< TimePositionloopPoint2
 
juce::CachedValue< TimeDurationscrubInterval
 
juce::CachedValue< bool > snapToTimecode
 
juce::CachedValue< bool > looping
 

Detailed Description

Controls the transport of an Edit's playback.

This is responsible for starting/stopping playback and recording and changing the position etc. It deals with looping/fast forward etc. and is resonsible for managing the EditPlaybackContext which attaches the Edit to the DeviceManager.

It also has higher level user concepts such as dragging/scrubbing.

See also
EditPlaybackContext, DeviceManager

You shouldn't need to directly create one of these, create an Edit and then obtain it from there.

See also
Edit::getTransport

Definition at line 56 of file tracktion_TransportControl.h.

Constructor & Destructor Documentation

◆ TransportControl()

tracktion::engine::TransportControl::TransportControl ( Edit ed,
const juce::ValueTree v 
)

Constructs a TransportControl for an Edit.

Definition at line 846 of file tracktion_TransportControl.cpp.

◆ ~TransportControl()

tracktion::engine::TransportControl::~TransportControl ( )
override

Destructor.

Definition at line 871 of file tracktion_TransportControl.cpp.

Member Function Documentation

◆ addListener()

void tracktion::engine::TransportControl::addListener ( Listener l)

Adds a Listener.

Definition at line 370 of file tracktion_TransportControl.h.

◆ applyRetrospectiveRecord()

juce::Result tracktion::engine::TransportControl::applyRetrospectiveRecord ( bool  armedOnly)

Applys a retrospective record to any assigned input devices, creating clips for any historical input.

Definition at line 930 of file tracktion_TransportControl.cpp.

◆ callRecordingAboutToStartListeners()

void tracktion::engine::TransportControl::callRecordingAboutToStartListeners ( InputDeviceInstance in,
EditItemID  targetID 
)

Definition at line 706 of file tracktion_TransportControl.cpp.

◆ callRecordingAboutToStopListeners()

void tracktion::engine::TransportControl::callRecordingAboutToStopListeners ( InputDeviceInstance in,
EditItemID  targetID 
)

Definition at line 711 of file tracktion_TransportControl.cpp.

◆ callRecordingFinishedListeners()

void tracktion::engine::TransportControl::callRecordingFinishedListeners ( InputDeviceInstance ,
EditItemID  ,
juce::ReferenceCountedArray< Clip  
)

Definition at line 717 of file tracktion_TransportControl.cpp.

◆ editHasChanged()

void tracktion::engine::TransportControl::editHasChanged ( )

Triggers a playback graph rebuild.

Called internally by Edit objects to rebuild the node graph when things change.

Definition at line 727 of file tracktion_TransportControl.cpp.

◆ ensureContextAllocated()

void tracktion::engine::TransportControl::ensureContextAllocated ( bool  alwaysReallocate = false)

Ensures an active EditPlaybackContext has been created so this Edit can be played back.

Parameters
alwaysReallocateIf true, this will always create a new playback graph.

Definition at line 772 of file tracktion_TransportControl.cpp.

◆ forceOrphanFreezeAndProxyFilesPurge()

void tracktion::engine::TransportControl::forceOrphanFreezeAndProxyFilesPurge ( )

Triggers a cleanup of any unused freeze and proxy files.

Definition at line 810 of file tracktion_TransportControl.cpp.

◆ freePlaybackContext()

void tracktion::engine::TransportControl::freePlaybackContext ( )

Detaches the current EditPlaybackContext, removing it from the DeviceManager.

Can be used to free up resources if you have multiple Edits open.

Definition at line 792 of file tracktion_TransportControl.cpp.

◆ getAllActiveTransports()

juce::Array< TransportControl * > tracktion::engine::TransportControl::getAllActiveTransports ( Engine engine)
static

Returns all the active TransportControl[s] in the Engine.

Definition at line 660 of file tracktion_TransportControl.cpp.

◆ getCurrentPlaybackContext()

EditPlaybackContext * tracktion::engine::TransportControl::getCurrentPlaybackContext ( ) const

Returns the active EditPlaybackContext if this Edit is attached to the DeviceManager for playback.

Definition at line 206 of file tracktion_TransportControl.h.

◆ getLoopRange()

TimeRange tracktion::engine::TransportControl::getLoopRange ( ) const
noexcept

Returns the loop range.

The loop range is between the two loop points.

Definition at line 1237 of file tracktion_TransportControl.cpp.

◆ getNumPlayingTransports()

int tracktion::engine::TransportControl::getNumPlayingTransports ( Engine engine)
static

Returns the number of Edits currently playing.

Definition at line 670 of file tracktion_TransportControl.cpp.

◆ getPosition()

TimePosition tracktion::engine::TransportControl::getPosition ( ) const

Returns the current transport position.

N.B. This might be different from the actual audible time if the graph introduces latency.

See also
EditPlaybackContext::getAudibleTimelineTime, EditPlaybackContext::getLatencySamples

Definition at line 1151 of file tracktion_TransportControl.cpp.

◆ getRetrospectiveRecordAsAudioFiles()

juce::Array< juce::File > tracktion::engine::TransportControl::getRetrospectiveRecordAsAudioFiles ( )

Perfoms a retrospective record operation and returns any new files.

Definition at line 944 of file tracktion_TransportControl.cpp.

◆ getSnapType()

TimecodeSnapType tracktion::engine::TransportControl::getSnapType ( ) const
noexcept

Returns the current snap type.

Definition at line 202 of file tracktion_TransportControl.h.

◆ getTimeWhenStarted()

TimePosition tracktion::engine::TransportControl::getTimeWhenStarted ( ) const

Returns the time when the transport was started.

Definition at line 1034 of file tracktion_TransportControl.cpp.

◆ isAllowedToReallocate()

bool tracktion::engine::TransportControl::isAllowedToReallocate ( ) const
noexcept

Returns true if no ReallocationInhibitors currently exist.

Definition at line 744 of file tracktion_TransportControl.cpp.

◆ isPlayContextActive()

bool tracktion::engine::TransportControl::isPlayContextActive ( ) const

Returns true if this Edit is attached to the DeviceManager for playback.

Definition at line 209 of file tracktion_TransportControl.h.

◆ isPlaying()

bool tracktion::engine::TransportControl::isPlaying ( ) const

Returns true if the transport is playing.

(This is also true during recording).

Definition at line 1027 of file tracktion_TransportControl.cpp.

◆ isPositionUpdatingFromPlayhead()

bool tracktion::engine::TransportControl::isPositionUpdatingFromPlayhead ( ) const

Returns true if the current position change was triggered from an update directly from the playhead (rather than a call to setCurrentPosition).

Definition at line 1201 of file tracktion_TransportControl.cpp.

◆ isRecording()

bool tracktion::engine::TransportControl::isRecording ( ) const

Returns true if recording is in progress.

Definition at line 1028 of file tracktion_TransportControl.cpp.

◆ isRecordingStopping()

bool tracktion::engine::TransportControl::isRecordingStopping ( ) const

Returns true if a recording is currently being stopped.

You can use this to determine if a clip being added is from a recording or not.

Definition at line 1031 of file tracktion_TransportControl.cpp.

◆ isSafeRecording()

bool tracktion::engine::TransportControl::isSafeRecording ( ) const

Returns true if safe-recording is in progress.

Definition at line 1029 of file tracktion_TransportControl.cpp.

◆ isStopping()

bool tracktion::engine::TransportControl::isStopping ( ) const

Returns true if the transport is currently being stopped.

isPlaying will return false during this period but position changes etc. could still be sent out so this method lets you know if this.

Definition at line 1030 of file tracktion_TransportControl.cpp.

◆ isUserDragging()

bool tracktion::engine::TransportControl::isUserDragging ( ) const
noexcept

Returns true if a drag/scrub operation has been enabled.

See also
setUserDragging

Definition at line 1196 of file tracktion_TransportControl.cpp.

◆ nudgeLeft()

void tracktion::engine::TransportControl::nudgeLeft ( )

Moves the transport back slightly.

Definition at line 1137 of file tracktion_TransportControl.cpp.

◆ nudgeRight()

void tracktion::engine::TransportControl::nudgeRight ( )

Moves the transport forwards slightly.

Definition at line 1143 of file tracktion_TransportControl.cpp.

◆ play()

void tracktion::engine::TransportControl::play ( bool  justSendMMCIfEnabled)

Starts playback of an Edit.

Parameters
justSendMMCIfEnabledIf this is true, playback isn't actually started, an MMC message is just output and playback will start when the input MIDI device recieves one.

Definition at line 881 of file tracktion_TransportControl.cpp.

◆ playFromStart()

void tracktion::engine::TransportControl::playFromStart ( bool  justSendMMCIfEnabled)

Sets the position to the startPosition and begins playback from there.

Definition at line 886 of file tracktion_TransportControl.cpp.

◆ playSectionAndReset()

void tracktion::engine::TransportControl::playSectionAndReset ( TimeRange  rangeToPlay)

Plays a section of an Edit then stops playback, useful for previewing clips.

Definition at line 893 of file tracktion_TransportControl.cpp.

◆ record()

void tracktion::engine::TransportControl::record ( bool  justSendMMCIfEnabled,
bool  allowRecordingIfNoInputsArmed = false 
)

Starts recording.

This will also start playback if stopped. The main difference between playback and recording is that if the playback is stopped, recording will pre-roll to count in. If playback is already playing, this will just start recording any armed inputs from the current time.

Parameters
justSendMMCIfEnabledIf this is true, playback isn't actually started, an MMC message is just output and recording will start when the input MIDI device recieves one.
allowRecordingIfNoInputsArmedIf true, no inputs need to actually be armed so you can live-punch on the fly.

Definition at line 901 of file tracktion_TransportControl.cpp.

◆ removeListener()

void tracktion::engine::TransportControl::removeListener ( Listener l)

Removes a Listener.

Definition at line 373 of file tracktion_TransportControl.h.

◆ restartAllTransports()

std::vector< std::unique_ptr< TransportControl::ScopedContextAllocator > > tracktion::engine::TransportControl::restartAllTransports ( Engine engine,
bool  clearDevices 
)
static

Restarts all TransportControl[s] in the Edit.

See also
stop.

Definition at line 681 of file tracktion_TransportControl.cpp.

◆ setFastForwardButtonDown()

void tracktion::engine::TransportControl::setFastForwardButtonDown ( bool  isDown)

Starts/stops a fast-forward operation.

Definition at line 1131 of file tracktion_TransportControl.cpp.

◆ setLoopIn()

void tracktion::engine::TransportControl::setLoopIn ( TimePosition  t)

Sets the loop in position.

Definition at line 1207 of file tracktion_TransportControl.cpp.

◆ setLoopOut()

void tracktion::engine::TransportControl::setLoopOut ( TimePosition  t)

Sets a loop out position.

Definition at line 1213 of file tracktion_TransportControl.cpp.

◆ setLoopPoint1()

void tracktion::engine::TransportControl::setLoopPoint1 ( TimePosition  t)

Sets a loop point 1 position.

Definition at line 1219 of file tracktion_TransportControl.cpp.

◆ setLoopPoint2()

void tracktion::engine::TransportControl::setLoopPoint2 ( TimePosition  t)

Sets a loop point 2 position.

Definition at line 1224 of file tracktion_TransportControl.cpp.

◆ setLoopRange()

void tracktion::engine::TransportControl::setLoopRange ( TimeRange  times)

Sets the loop points from a given range.

Definition at line 1229 of file tracktion_TransportControl.cpp.

◆ setPosition() [1/2]

void tracktion::engine::TransportControl::setPosition ( TimePosition  timeToMoveTo,
TimePosition  timeToPerformJump 
)

Sets a new transport position to take effect at a given time.

Definition at line 1164 of file tracktion_TransportControl.cpp.

◆ setPosition() [2/2]

void tracktion::engine::TransportControl::setPosition ( TimePosition  t)

Sets a new transport position.

Definition at line 1156 of file tracktion_TransportControl.cpp.

◆ setRewindButtonDown()

void tracktion::engine::TransportControl::setRewindButtonDown ( bool  isDown)

Starts/stops a rewind operation.

Definition at line 1125 of file tracktion_TransportControl.cpp.

◆ setSnapType()

void tracktion::engine::TransportControl::setSnapType ( TimecodeSnapType  newSnapType)

Sets a snap type to use.

Definition at line 1242 of file tracktion_TransportControl.cpp.

◆ setUserDragging()

void tracktion::engine::TransportControl::setUserDragging ( bool  b)

Signifies a scrub-drag operation has started/stopped.

While dragging, a short section of the play position is looped repeatedly.

Definition at line 1172 of file tracktion_TransportControl.cpp.

◆ stop()

void tracktion::engine::TransportControl::stop ( bool  discardRecordings,
bool  clearDevices,
bool  canSendMMCStop = true 
)

Stops recording, creating clips of newyly recorded files/MIDI data.

Parameters
discardRecordingsIf true, recordings will be discarded
clearDevicesIf true, the playback graph will be cleared
canSendMMCStopIf true, an MMC stop message will also be sent

Definition at line 906 of file tracktion_TransportControl.cpp.

◆ stopAllTransports()

void tracktion::engine::TransportControl::stopAllTransports ( Engine engine,
bool  discardRecordings,
bool  clearDevices 
)
static

Stops all TransportControl[s] in the Engine playing.

See also
stop.

Definition at line 675 of file tracktion_TransportControl.cpp.

◆ stopIfRecording()

void tracktion::engine::TransportControl::stopIfRecording ( )

Stops playback only if recording is currently in progress.

See also
isRecording

Definition at line 915 of file tracktion_TransportControl.cpp.

◆ stopRecording()

void tracktion::engine::TransportControl::stopRecording ( bool  discardRecordings = false)

Stops recording without stopping playback.

Definition at line 921 of file tracktion_TransportControl.cpp.

◆ syncToEdit()

void tracktion::engine::TransportControl::syncToEdit ( Edit editToSyncTo,
bool  syncToTargetLoopLength 
)

Syncs this Edit's playback to another Edit.

Parameters
editToSyncToThe Edit to sync playback to
syncToTargetLoopLengthIf true the sync interval will be the source's loop length, if false, it will be one bar

Definition at line 1001 of file tracktion_TransportControl.cpp.

◆ triggerClearDevicesOnStop()

void tracktion::engine::TransportControl::triggerClearDevicesOnStop ( )

Triggers a graph rebuild when playback stops.

Used internally to adjust latency in response to plugin reported latency changes.

Definition at line 799 of file tracktion_TransportControl.cpp.

Member Data Documentation

◆ edit

Edit& tracktion::engine::TransportControl::edit

The Edit this transport belongs to.

See also
Edit::getTransport.

Definition at line 377 of file tracktion_TransportControl.h.

◆ engine

Engine& tracktion::engine::TransportControl::engine

The Engine this Edit belongs to.

Definition at line 376 of file tracktion_TransportControl.h.

◆ looping

juce::CachedValue<bool> tracktion::engine::TransportControl::looping

Definition at line 387 of file tracktion_TransportControl.h.

◆ loopPoint1

juce::CachedValue<TimePosition> tracktion::engine::TransportControl::loopPoint1

Definition at line 384 of file tracktion_TransportControl.h.

◆ loopPoint2

juce::CachedValue<TimePosition> tracktion::engine::TransportControl::loopPoint2

Definition at line 384 of file tracktion_TransportControl.h.

◆ position

juce::CachedValue<TimePosition> tracktion::engine::TransportControl::position

Definition at line 383 of file tracktion_TransportControl.h.

◆ scrubInterval

juce::CachedValue<TimeDuration> tracktion::engine::TransportControl::scrubInterval

Definition at line 385 of file tracktion_TransportControl.h.

◆ snapToTimecode

juce::CachedValue<bool> tracktion::engine::TransportControl::snapToTimecode

Definition at line 387 of file tracktion_TransportControl.h.

◆ startPosition

juce::CachedValue<TimePosition> tracktion::engine::TransportControl::startPosition

The position to start playing from.

Definition at line 380 of file tracktion_TransportControl.h.

◆ state

juce::ValueTree tracktion::engine::TransportControl::state

The state of this transport.

Definition at line 378 of file tracktion_TransportControl.h.


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