|
tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications
« « « Anklang Documentation |
Controls the transport of an Edit's playback. More...
#include "tracktion_TransportControl.h"
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::File > | getRetrospectiveRecordAsAudioFiles () |
| 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. | |
| EditPlaybackContext * | getCurrentPlaybackContext () 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 | |
| Engine & | engine |
| The Engine this Edit belongs to. | |
| Edit & | edit |
| The Edit this transport belongs to. | |
| juce::ValueTree | state |
| The state of this transport. | |
| juce::CachedValue< TimePosition > | startPosition |
| The position to start playing from. | |
| juce::CachedValue< TimePosition > | position |
| juce::CachedValue< TimePosition > | loopPoint1 |
| juce::CachedValue< TimePosition > | loopPoint2 |
| juce::CachedValue< TimeDuration > | scrubInterval |
| juce::CachedValue< bool > | snapToTimecode |
| juce::CachedValue< bool > | looping |
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.
You shouldn't need to directly create one of these, create an Edit and then obtain it from there.
Definition at line 56 of file tracktion_TransportControl.h.
| 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.
|
override |
Destructor.
Definition at line 871 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::addListener | ( | Listener * | l | ) |
Adds a Listener.
Definition at line 370 of file tracktion_TransportControl.h.
| 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.
| void tracktion::engine::TransportControl::callRecordingAboutToStartListeners | ( | InputDeviceInstance & | in, |
| EditItemID | targetID | ||
| ) |
Definition at line 706 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::callRecordingAboutToStopListeners | ( | InputDeviceInstance & | in, |
| EditItemID | targetID | ||
| ) |
Definition at line 711 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::callRecordingFinishedListeners | ( | InputDeviceInstance & | , |
| EditItemID | , | ||
| juce::ReferenceCountedArray< Clip > | |||
| ) |
Definition at line 717 of file tracktion_TransportControl.cpp.
| 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.
| void tracktion::engine::TransportControl::ensureContextAllocated | ( | bool | alwaysReallocate = false | ) |
Ensures an active EditPlaybackContext has been created so this Edit can be played back.
| alwaysReallocate | If true, this will always create a new playback graph. |
Definition at line 772 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::forceOrphanFreezeAndProxyFilesPurge | ( | ) |
Triggers a cleanup of any unused freeze and proxy files.
Definition at line 810 of file tracktion_TransportControl.cpp.
| 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.
|
static |
Returns all the active TransportControl[s] in the Engine.
Definition at line 660 of file tracktion_TransportControl.cpp.
| 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.
|
noexcept |
Returns the loop range.
The loop range is between the two loop points.
Definition at line 1237 of file tracktion_TransportControl.cpp.
Returns the number of Edits currently playing.
Definition at line 670 of file tracktion_TransportControl.cpp.
| 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.
Definition at line 1151 of file tracktion_TransportControl.cpp.
| 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.
|
noexcept |
Returns the current snap type.
Definition at line 202 of file tracktion_TransportControl.h.
| TimePosition tracktion::engine::TransportControl::getTimeWhenStarted | ( | ) | const |
Returns the time when the transport was started.
Definition at line 1034 of file tracktion_TransportControl.cpp.
|
noexcept |
Returns true if no ReallocationInhibitors currently exist.
Definition at line 744 of file tracktion_TransportControl.cpp.
| 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.
| 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.
| 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.
| bool tracktion::engine::TransportControl::isRecording | ( | ) | const |
Returns true if recording is in progress.
Definition at line 1028 of file tracktion_TransportControl.cpp.
| 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.
| bool tracktion::engine::TransportControl::isSafeRecording | ( | ) | const |
Returns true if safe-recording is in progress.
Definition at line 1029 of file tracktion_TransportControl.cpp.
| 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.
|
noexcept |
Returns true if a drag/scrub operation has been enabled.
Definition at line 1196 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::nudgeLeft | ( | ) |
Moves the transport back slightly.
Definition at line 1137 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::nudgeRight | ( | ) |
Moves the transport forwards slightly.
Definition at line 1143 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::play | ( | bool | justSendMMCIfEnabled | ) |
Starts playback of an Edit.
| justSendMMCIfEnabled | If 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.
| 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.
| 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.
| 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.
| justSendMMCIfEnabled | If 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. |
| allowRecordingIfNoInputsArmed | If 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.
| void tracktion::engine::TransportControl::removeListener | ( | Listener * | l | ) |
Removes a Listener.
Definition at line 373 of file tracktion_TransportControl.h.
|
static |
Restarts all TransportControl[s] in the Edit.
Definition at line 681 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::setFastForwardButtonDown | ( | bool | isDown | ) |
Starts/stops a fast-forward operation.
Definition at line 1131 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::setLoopIn | ( | TimePosition | t | ) |
Sets the loop in position.
Definition at line 1207 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::setLoopOut | ( | TimePosition | t | ) |
Sets a loop out position.
Definition at line 1213 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::setLoopPoint1 | ( | TimePosition | t | ) |
Sets a loop point 1 position.
Definition at line 1219 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::setLoopPoint2 | ( | TimePosition | t | ) |
Sets a loop point 2 position.
Definition at line 1224 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::setLoopRange | ( | TimeRange | times | ) |
Sets the loop points from a given range.
Definition at line 1229 of file tracktion_TransportControl.cpp.
| 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.
| void tracktion::engine::TransportControl::setPosition | ( | TimePosition | t | ) |
Sets a new transport position.
Definition at line 1156 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::setRewindButtonDown | ( | bool | isDown | ) |
Starts/stops a rewind operation.
Definition at line 1125 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::setSnapType | ( | TimecodeSnapType | newSnapType | ) |
Sets a snap type to use.
Definition at line 1242 of file tracktion_TransportControl.cpp.
| 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.
| void tracktion::engine::TransportControl::stop | ( | bool | discardRecordings, |
| bool | clearDevices, | ||
| bool | canSendMMCStop = true |
||
| ) |
Stops recording, creating clips of newyly recorded files/MIDI data.
| discardRecordings | If true, recordings will be discarded |
| clearDevices | If true, the playback graph will be cleared |
| canSendMMCStop | If true, an MMC stop message will also be sent |
Definition at line 906 of file tracktion_TransportControl.cpp.
|
static |
Stops all TransportControl[s] in the Engine playing.
Definition at line 675 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::stopIfRecording | ( | ) |
Stops playback only if recording is currently in progress.
Definition at line 915 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::stopRecording | ( | bool | discardRecordings = false | ) |
Stops recording without stopping playback.
Definition at line 921 of file tracktion_TransportControl.cpp.
| void tracktion::engine::TransportControl::syncToEdit | ( | Edit * | editToSyncTo, |
| bool | syncToTargetLoopLength | ||
| ) |
Syncs this Edit's playback to another Edit.
| editToSyncTo | The Edit to sync playback to |
| syncToTargetLoopLength | If 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.
| 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.
| Edit& tracktion::engine::TransportControl::edit |
The Edit this transport belongs to.
Definition at line 377 of file tracktion_TransportControl.h.
| Engine& tracktion::engine::TransportControl::engine |
The Engine this Edit belongs to.
Definition at line 376 of file tracktion_TransportControl.h.
| juce::CachedValue<bool> tracktion::engine::TransportControl::looping |
Definition at line 387 of file tracktion_TransportControl.h.
| juce::CachedValue<TimePosition> tracktion::engine::TransportControl::loopPoint1 |
Definition at line 384 of file tracktion_TransportControl.h.
| juce::CachedValue<TimePosition> tracktion::engine::TransportControl::loopPoint2 |
Definition at line 384 of file tracktion_TransportControl.h.
| juce::CachedValue<TimePosition> tracktion::engine::TransportControl::position |
Definition at line 383 of file tracktion_TransportControl.h.
| juce::CachedValue<TimeDuration> tracktion::engine::TransportControl::scrubInterval |
Definition at line 385 of file tracktion_TransportControl.h.
| juce::CachedValue<bool> tracktion::engine::TransportControl::snapToTimecode |
Definition at line 387 of file tracktion_TransportControl.h.
| juce::CachedValue<TimePosition> tracktion::engine::TransportControl::startPosition |
The position to start playing from.
Definition at line 380 of file tracktion_TransportControl.h.
| juce::ValueTree tracktion::engine::TransportControl::state |
The state of this transport.
Definition at line 378 of file tracktion_TransportControl.h.