|
TracktionEngine
|
Controls the transport of an Edit's playback. More...
#include <tracktion_TransportControl.h>
Inherits juce::ChangeBroadcaster, and juce::Timer.
Classes | |
| struct | Listener |
| Listener interface to be notified of changes to the transport. More... | |
| 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... | |
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 >) |
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.
| engine::TransportControl::TransportControl | ( | Edit & | , |
| const juce::ValueTree & | |||
| ) |
Constructs a TransportControl for an Edit.
|
override |
Destructor.
| void 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. |
| void engine::TransportControl::playFromStart | ( | bool | justSendMMCIfEnabled | ) |
Sets the position to the startPosition and begins playback from there.
| void engine::TransportControl::playSectionAndReset | ( | TimeRange | rangeToPlay | ) |
Plays a section of an Edit then stops playback, useful for previewing clips.
| void 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. |
| void 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 |
| void engine::TransportControl::stopIfRecording | ( | ) |
Stops playback only if recording is currently in progress.
| void engine::TransportControl::stopRecording | ( | bool | discardRecordings = false | ) |
Stops recording without stopping playback.
| juce::Result engine::TransportControl::applyRetrospectiveRecord | ( | bool | armedOnly | ) |
Applys a retrospective record to any assigned input devices, creating clips for any historical input.
| juce::Array< juce::File > engine::TransportControl::getRetrospectiveRecordAsAudioFiles | ( | ) |
Perfoms a retrospective record operation and returns any new files.
| void engine::TransportControl::syncToEdit | ( | Edit * | editToSyncTo, |
| bool | syncToTargetLoopLength | ||
| ) |
| bool engine::TransportControl::isPlaying | ( | ) | const |
Returns true if the transport is playing.
(This is also true during recording).
| bool engine::TransportControl::isRecording | ( | ) | const |
Returns true if recording is in progress.
| bool engine::TransportControl::isSafeRecording | ( | ) | const |
Returns true if safe-recording is in progress.
| bool 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.
| bool 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.
| TimePosition engine::TransportControl::getTimeWhenStarted | ( | ) | const |
Returns the time when the transport was started.
| TimePosition 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.
| void engine::TransportControl::setPosition | ( | TimePosition | ) |
Sets a new transport position.
| void engine::TransportControl::setPosition | ( | TimePosition | timeToMoveTo, |
| TimePosition | timeToPerformJump | ||
| ) |
Sets a new transport position to take effect at a given time.
| void engine::TransportControl::setUserDragging | ( | bool | ) |
Signifies a scrub-drag operation has started/stopped.
While dragging, a short section of the play position is looped repeatedly.
|
noexcept |
Returns true if a drag/scrub operation has been enabled.
| bool 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).
| void engine::TransportControl::setLoopIn | ( | TimePosition | ) |
Sets the loop in position.
| void engine::TransportControl::setLoopOut | ( | TimePosition | ) |
Sets a loop out position.
| void engine::TransportControl::setLoopPoint1 | ( | TimePosition | ) |
Sets a loop point 1 position.
| void engine::TransportControl::setLoopPoint2 | ( | TimePosition | ) |
Sets a loop point 2 position.
| void engine::TransportControl::setLoopRange | ( | TimeRange | ) |
Sets the loop points from a given range.
|
noexcept |
Returns the loop range.
The loop range is between the two loop points.
| void engine::TransportControl::setSnapType | ( | TimecodeSnapType | ) |
Sets a snap type to use.
|
noexcept |
Returns the current snap type.
| EditPlaybackContext * engine::TransportControl::getCurrentPlaybackContext | ( | ) | const |
Returns the active EditPlaybackContext if this Edit is attached to the DeviceManager for playback.
| bool engine::TransportControl::isPlayContextActive | ( | ) | const |
Returns true if this Edit is attached to the DeviceManager for playback.
| void 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. |
| void 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.
| void engine::TransportControl::triggerClearDevicesOnStop | ( | ) |
Triggers a graph rebuild when playback stops.
Used internally to adjust latency in response to plugin reported latency changes.
| void engine::TransportControl::forceOrphanFreezeAndProxyFilesPurge | ( | ) |
Triggers a cleanup of any unused freeze and proxy files.
| void engine::TransportControl::setRewindButtonDown | ( | bool | isDown | ) |
Starts/stops a rewind operation.
| void engine::TransportControl::setFastForwardButtonDown | ( | bool | isDown | ) |
Starts/stops a fast-forward operation.
| void engine::TransportControl::nudgeLeft | ( | ) |
Moves the transport back slightly.
| void engine::TransportControl::nudgeRight | ( | ) |
Moves the transport forwards slightly.
| void engine::TransportControl::editHasChanged | ( | ) |
Triggers a playback graph rebuild.
Called internally by Edit objects to rebuild the node graph when things change.
|
noexcept |
Returns true if no ReallocationInhibitors currently exist.
|
static |
Returns all the active TransportControl[s] in the Engine.
|
static |
Returns the number of Edits currently playing.
|
static |
Stops all TransportControl[s] in the Engine playing.
|
static |
Restarts all TransportControl[s] in the Edit.
| void engine::TransportControl::callRecordingAboutToStartListeners | ( | InputDeviceInstance & | , |
| EditItemID | |||
| ) |
| void engine::TransportControl::callRecordingAboutToStopListeners | ( | InputDeviceInstance & | , |
| EditItemID | |||
| ) |
| void engine::TransportControl::callRecordingFinishedListeners | ( | InputDeviceInstance & | , |
| EditItemID | , | ||
| juce::ReferenceCountedArray< Clip > | |||
| ) |
| Edit& engine::TransportControl::edit |
The Edit this transport belongs to.
| juce::ValueTree engine::TransportControl::state |
The state of this transport.
| juce::CachedValue<TimePosition> engine::TransportControl::startPosition |
The position to start playing from.
| juce::CachedValue<TimePosition> engine::TransportControl::position |
.
| juce::CachedValue<TimePosition> engine::TransportControl::loopPoint1 |
| juce::CachedValue<TimePosition> engine::TransportControl::loopPoint2 |
| juce::CachedValue<TimeDuration> engine::TransportControl::scrubInterval |
| juce::CachedValue<bool> engine::TransportControl::snapToTimecode |
.
| juce::CachedValue<bool> engine::TransportControl::looping |