11namespace tracktion {
inline namespace engine
15void toStart (TransportControl&,
const SelectableList&);
18void toEnd (TransportControl&,
const SelectableList&);
21void tabBack (TransportControl&);
27void markIn (TransportControl&);
30void markOut (TransportControl&);
35void scrub (TransportControl&,
double unitsForwards);
72 void play (
bool justSendMMCIfEnabled);
91 void record (
bool justSendMMCIfEnabled,
bool allowRecordingIfNoInputsArmed =
false);
98 void stop (
bool discardRecordings,
100 bool canSendMMCStop =
true);
124 void syncToEdit (
Edit* editToSyncTo,
bool syncToTargetLoopLength);
278 bool wasPlaying =
false;
300 bool wasAllocated =
false;
405 bool isDelayedChangePending =
false;
406 int loopUpdateCounter = 10;
407 bool isStopInProgress =
false;
408 bool recordingIsStoppingFlag =
false;
415 PlayingFlag (
Engine&)
noexcept;
416 ~PlayingFlag() noexcept;
421 std::unique_ptr<PlayingFlag> playingFlag;
422 void clearPlayingFlags();
430 bool lastPlayStatus = false, lastRecordStatus = false;
431 void startedOrStopped();
432 void releaseAudioNodes();
439 void performPositionChange();
440 void performRewindButtonChanged();
441 void performFastForwardButtonChanged();
442 void performNudgeLeft();
443 void performNudgeRight();
445 void sendMMC (const
juce::MidiMessage&);
446 void sendMMCCommand (
juce::MidiMessage::MidiMachineControlCommand);
447 bool sendMMCStartPlay();
448 bool sendMMCStartRecord();
450 bool areAnyInputsRecording();
458 void timerCallback() override;
The Tracktion Edit class!
The Engine is the central class for all tracktion sessions.
Controls the transport of an Edit's playback.
void playSectionAndReset(TimeRange rangeToPlay)
Plays a section of an Edit then stops playback, useful for previewing clips.
void setLoopIn(TimePosition)
Sets the loop in position.
void setFastForwardButtonDown(bool isDown)
Starts/stops a fast-forward operation.
TimePosition getPosition() const
Returns the current transport position.
void removeListener(Listener *l)
Removes a Listener.
void setLoopPoint2(TimePosition)
Sets a loop point 2 position.
TimecodeSnapType getSnapType() const noexcept
Returns the current snap type.
void ensureContextAllocated(bool alwaysReallocate=false)
Ensures an active EditPlaybackContext has been created so this Edit can be played back.
bool isPlayContextActive() const
Returns true if this Edit is attached to the DeviceManager for playback.
void syncToEdit(Edit *editToSyncTo, bool syncToTargetLoopLength)
Syncs this Edit's playback to another Edit.
juce::ValueTree state
The state of this transport.
bool isAllowedToReallocate() const noexcept
Returns true if no ReallocationInhibitors currently exist.
void setLoopRange(TimeRange)
Sets the loop points from a given range.
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 nudgeRight()
Moves the transport forwards slightly.
EditPlaybackContext * getCurrentPlaybackContext() const
Returns the active EditPlaybackContext if this Edit is attached to the DeviceManager for playback.
void freePlaybackContext()
Detaches the current EditPlaybackContext, removing it from the DeviceManager.
bool isRecordingStopping() const
Returns true if a recording is currently being stopped.
bool isRecording() const
Returns true if recording is in progress.
void setLoopPoint1(TimePosition)
Sets a loop point 1 position.
void play(bool justSendMMCIfEnabled)
Starts playback of an Edit.
void stopRecording(bool discardRecordings=false)
Stops recording without stopping playback.
bool isUserDragging() const noexcept
Returns true if a drag/scrub operation has been enabled.
void setUserDragging(bool)
Signifies a scrub-drag operation has started/stopped.
static void stopAllTransports(Engine &, bool discardRecordings, bool clearDevices)
Stops all TransportControl[s] in the Engine playing.
void forceOrphanFreezeAndProxyFilesPurge()
Triggers a cleanup of any unused freeze and proxy files.
void playFromStart(bool justSendMMCIfEnabled)
Sets the position to the startPosition and begins playback from there.
void nudgeLeft()
Moves the transport back slightly.
static juce::Array< TransportControl * > getAllActiveTransports(Engine &)
Returns all the active TransportControl[s] in the Engine.
~TransportControl() override
Destructor.
static int getNumPlayingTransports(Engine &)
Returns the number of Edits currently playing.
TimePosition getTimeWhenStarted() const
Returns the time when the transport was started.
bool isStopping() const
Returns true if the transport is currently being stopped.
bool isPositionUpdatingFromPlayhead() const
Returns true if the current position change was triggered from an update directly from the playhead (...
void editHasChanged()
Triggers a playback graph rebuild.
void stop(bool discardRecordings, bool clearDevices, bool canSendMMCStop=true)
Stops recording, creating clips of newyly recorded files/MIDI data.
void record(bool justSendMMCIfEnabled, bool allowRecordingIfNoInputsArmed=false)
Starts recording.
TimeRange getLoopRange() const noexcept
Returns the loop range.
void setPosition(TimePosition)
Sets a new transport position.
void setLoopOut(TimePosition)
Sets a loop out position.
bool isSafeRecording() const
Returns true if safe-recording is in progress.
void setRewindButtonDown(bool isDown)
Starts/stops a rewind operation.
void addListener(Listener *l)
Adds a Listener.
bool isPlaying() const
Returns true if the transport is playing.
Edit & edit
The Edit this transport belongs to.
void setSnapType(TimecodeSnapType)
Sets a snap type to use.
void stopIfRecording()
Stops playback only if recording is currently in progress.
Engine & engine
The Engine this Edit belongs to.
static std::vector< std::unique_ptr< ScopedContextAllocator > > restartAllTransports(Engine &, bool clearDevices)
Restarts all TransportControl[s] in the Edit.
juce::CachedValue< TimePosition > startPosition
The position to start playing from.
void triggerClearDevicesOnStop()
Triggers a graph rebuild when playback stops.
void markOut(TransportControl &tc)
Sets the mark out position to the current transport position.
void toStart(TransportControl &tc, const SelectableList &items)
Moves the transport to the start of the selected objects.
void freePlaybackContextIfNotRecording(TransportControl &tc)
Frees the playback context if no recording is in progress, useful for when an app is minimised.
void toEnd(TransportControl &tc, const SelectableList &items)
Moves the transport to the end of the selected objects.
void markIn(TransportControl &tc)
Sets the mark in position to the current transport position.
void tabBack(TransportControl &tc)
Moves the transport back to the previous point of interest.
void tabForward(TransportControl &tc)
Moves the transport forwards to the next point of interest.
void scrub(TransportControl &tc, double units)
Scrubs back and forth in 'units', where a unit is about 1/50th of the width of the strip window.
Holds a reference sample position and the Edit time and beat that it corresponds to.
Represents a position in real-life time.
ID for objects of type EditElement - e.g.
Listener interface to be notified of changes to the transport.
virtual void autoSaveNow()
Called periodically to indicate the Edit has changed in an audible way and should be auto-saved.
virtual void stopVideo()
Should stop video playback.
virtual ~Listener()
Destructor.
virtual void recordingAboutToStart(InputDeviceInstance &, EditItemID)
Called before recording start for a specific input instance.
virtual void recordingFinished(InputDeviceInstance &, EditItemID, const juce::ReferenceCountedArray< Clip > &)
Called when recording stops for a specific input instance.
virtual void recordingAboutToStop(InputDeviceInstance &, EditItemID)
Called before recording stops for a specific input instance.
virtual void playbackContextChanged()
Called when an EditPlaybackContext is created or deleted.
virtual void recordingStarted(SyncPoint, std::optional< TimeRange >)
Called when global recording starts.
virtual void recordingStopped(SyncPoint, bool)
Called when global recording stops.
virtual void setVideoPosition(TimePosition, bool)
Should set a new position for any playing video.
virtual void setAllLevelMetersActive(bool)
If false, levels should be cleared.
virtual void startVideo()
Should start video playback.
Prevents the nodes being regenerated while one of these exists, e.g.
~ReallocationInhibitor()
Enables playback graph regeneration.
Frees the playback context and then re-allocates it upon destruction.
~ScopedContextAllocator()
Allocated the Edit if it was allocated on construction.
ScopedContextAllocator(TransportControl &o)
Saves whether the Edit was allocated.
Is an Edit is playing back, this resumes playback when destroyed.
ScopedPlaybackRestarter(TransportControl &o)
Saves the playback state.
~ScopedPlaybackRestarter()
Starts playback if playing when constructed.
Represents the state of an Edit's transport.