TracktionEngine
Loading...
Searching...
No Matches
engine::EditPlaybackContext Class Reference

#include <tracktion_EditPlaybackContext.h>

Classes

struct  ScopedDeviceListReleaser
 Releases and then optionally reallocates the context's device list safely. More...
struct  RealtimePriorityDisabler
 Used to temporarily reduce the process priority if a long operation like a file save is taking place. More...

Public Member Functions

 EditPlaybackContext (TransportControl &)
 ~EditPlaybackContext ()
void removeInstanceForDevice (InputDevice &)
void addWaveInputDeviceInstance (InputDevice &)
 Note this doesn't check for device enablement.
void addMidiInputDeviceInstance (InputDevice &)
void clearNodes ()
void createPlayAudioNodes (TimePosition startTime)
void createPlayAudioNodesIfNeeded (TimePosition startTime)
void reallocate ()
void setInsertOptionalLastStageNodeForDeviceCallback (std::function< std::unique_ptr< graph::Node >(OutputDevice &, const CreateNodeParams &, std::unique_ptr< graph::Node >)>)
 Sets a callback used to add an additional final Node to each output device's chain when the playback graph is (re)built.
bool isPlaybackGraphAllocated () const
 Returns true if a playback graph is currently allocated.
void prepareForPlaying (TimePosition startTime)
void prepareForRecording (TimePosition startTime, TimePosition punchIn)
void syncToContext (EditPlaybackContext *contextToSyncTo, TimePosition previousBarTime, TimeDuration syncInterval)
tl::expected< Clip::Array, juce::String > stopRecording (InputDeviceInstance &, bool discardRecordings)
tl::expected< Clip::Array, juce::String > stopRecording (TimePosition unloopedEnd, bool discardRecordings)
juce::Result applyRetrospectiveRecord (juce::Array< Clip * > *clipsCreated=nullptr, bool armedOnly=false)
juce::Array< InputDeviceInstance * > getAllInputs ()
InputDeviceInstance * getInputFor (InputDevice *) const
OutputDeviceInstance * getOutputFor (OutputDevice *) const
bool isPlaying () const
bool isLooping () const
bool isDragging () const
TimePosition getPosition () const
TimePosition getUnloopedPosition () const
TimeRange getLoopTimes () const
int getLatencySamples () const
 Returns the overall latency of the currently prepared graph.
TimePosition getAudibleTimelineTime ()
double getSampleRate () const
void updateNumCPUs ()
void setSpeedCompensation (double plusOrMinus)
 This will increase/decrease playback speed by resampling, pitching the output up or down.
void setTempoAdjustment (double plusOrMinusProportion)
 This will increase/decrease playback speed by changing the tempo, maintaining pitch where possible.
void postPosition (TimePosition positionToJumpTo, std::optional< TimePosition > whenToJump={})
 Posts a transport position change.
std::optional< TimePosition > getPendingPositionChange () const
 Returns a pending position change if there is one.
void play ()
void stop ()
void postPlay ()
 Posts a transport position change so play can be synconrised with the next block.
bool isPlayPending () const
 Returns true if a play message has been posted but not dispatched.
std::optional< SyncPoint > getSyncPoint () const
 Returns the last reference sample position and the edit time and beat that it corresponded to.
TimePosition globalStreamTimeToEditTime (double) const
TimePosition globalStreamTimeToEditTimeUnlooped (double) const
void resyncToGlobalStreamTime (juce::Range< double >, double sampleRate)
tracktion::graph::PlayHead * getNodePlayHead () const
void blockUntilSyncPointChange ()
int getNumActivelyRecordingDevices () const
void incrementNumActivelyRecordingDevices ()
void decrementNumActivelyRecordingDevices ()

Static Public Member Functions

static void setThreadPoolStrategy (int)
static int getThreadPoolStrategy ()
static void enablePooledMemory (bool)
 Enables reusing of audio buffers during graph processing which may reduce the memory use at the cost of some additional overhead.
static void enableNodeMemorySharing (bool)
 Enables reusing of audio buffers during graph processing which may reduce the memory use at the cost of some additional overhead.
static void enableAudioWorkgroup (bool)
 Enables using AudioWorkgroups.

Public Attributes

Edit & edit
TransportControl & transport
LevelMeasurer masterLevels
MidiNoteDispatcher midiDispatcher

Constructor & Destructor Documentation

◆ EditPlaybackContext()

engine::EditPlaybackContext::EditPlaybackContext ( TransportControl & )

◆ ~EditPlaybackContext()

engine::EditPlaybackContext::~EditPlaybackContext ( )

Member Function Documentation

◆ removeInstanceForDevice()

void engine::EditPlaybackContext::removeInstanceForDevice ( InputDevice & )

◆ addWaveInputDeviceInstance()

void engine::EditPlaybackContext::addWaveInputDeviceInstance ( InputDevice & )

Note this doesn't check for device enablement.

◆ addMidiInputDeviceInstance()

void engine::EditPlaybackContext::addMidiInputDeviceInstance ( InputDevice & )

◆ clearNodes()

void engine::EditPlaybackContext::clearNodes ( )

◆ createPlayAudioNodes()

void engine::EditPlaybackContext::createPlayAudioNodes ( TimePosition startTime)

◆ createPlayAudioNodesIfNeeded()

void engine::EditPlaybackContext::createPlayAudioNodesIfNeeded ( TimePosition startTime)

◆ reallocate()

void engine::EditPlaybackContext::reallocate ( )

◆ setInsertOptionalLastStageNodeForDeviceCallback()

void engine::EditPlaybackContext::setInsertOptionalLastStageNodeForDeviceCallback ( std::function< std::unique_ptr< graph::Node >(OutputDevice &, const CreateNodeParams &, std::unique_ptr< graph::Node >)> )

Sets a callback used to add an additional final Node to each output device's chain when the playback graph is (re)built.

See CreateNodeParams::insertOptionalLastStageNodeForDevice. The callback is applied on the next graph build, so call reallocate()/Edit::restartPlayback() afterwards to apply it. As the context is recreated each time it's allocated, clients should re-set this from TransportControl::Listener::playbackContextChanged().

◆ isPlaybackGraphAllocated()

bool engine::EditPlaybackContext::isPlaybackGraphAllocated ( ) const

Returns true if a playback graph is currently allocated.

◆ prepareForPlaying()

void engine::EditPlaybackContext::prepareForPlaying ( TimePosition startTime)

◆ prepareForRecording()

void engine::EditPlaybackContext::prepareForRecording ( TimePosition startTime,
TimePosition punchIn )

◆ syncToContext()

void engine::EditPlaybackContext::syncToContext ( EditPlaybackContext * contextToSyncTo,
TimePosition previousBarTime,
TimeDuration syncInterval )

References EditPlaybackContext().

◆ stopRecording() [1/2]

tl::expected< Clip::Array, juce::String > engine::EditPlaybackContext::stopRecording ( InputDeviceInstance & ,
bool discardRecordings )

◆ stopRecording() [2/2]

tl::expected< Clip::Array, juce::String > engine::EditPlaybackContext::stopRecording ( TimePosition unloopedEnd,
bool discardRecordings )

◆ applyRetrospectiveRecord()

juce::Result engine::EditPlaybackContext::applyRetrospectiveRecord ( juce::Array< Clip * > * clipsCreated = nullptr,
bool armedOnly = false )

◆ getAllInputs()

juce::Array< InputDeviceInstance * > engine::EditPlaybackContext::getAllInputs ( )

◆ getInputFor()

InputDeviceInstance * engine::EditPlaybackContext::getInputFor ( InputDevice * ) const

◆ getOutputFor()

OutputDeviceInstance * engine::EditPlaybackContext::getOutputFor ( OutputDevice * ) const

◆ isPlaying()

bool engine::EditPlaybackContext::isPlaying ( ) const

◆ isLooping()

bool engine::EditPlaybackContext::isLooping ( ) const

◆ isDragging()

bool engine::EditPlaybackContext::isDragging ( ) const

◆ getPosition()

TimePosition engine::EditPlaybackContext::getPosition ( ) const

◆ getUnloopedPosition()

TimePosition engine::EditPlaybackContext::getUnloopedPosition ( ) const

◆ getLoopTimes()

TimeRange engine::EditPlaybackContext::getLoopTimes ( ) const

◆ getLatencySamples()

int engine::EditPlaybackContext::getLatencySamples ( ) const

Returns the overall latency of the currently prepared graph.

◆ getAudibleTimelineTime()

TimePosition engine::EditPlaybackContext::getAudibleTimelineTime ( )

◆ getSampleRate()

double engine::EditPlaybackContext::getSampleRate ( ) const

◆ updateNumCPUs()

void engine::EditPlaybackContext::updateNumCPUs ( )

◆ setSpeedCompensation()

void engine::EditPlaybackContext::setSpeedCompensation ( double plusOrMinus)

This will increase/decrease playback speed by resampling, pitching the output up or down.

◆ setTempoAdjustment()

void engine::EditPlaybackContext::setTempoAdjustment ( double plusOrMinusProportion)

This will increase/decrease playback speed by changing the tempo, maintaining pitch where possible.

◆ postPosition()

void engine::EditPlaybackContext::postPosition ( TimePosition positionToJumpTo,
std::optional< TimePosition > whenToJump = {} )

Posts a transport position change.

Using the second parameter it's possible to delay position changes in order to quantise them to some musical sense. Pending changes will be cancelled automatically if:

  • The transport is stopped
  • The playhead reaches the end of a loop position
  • The playhead passes the jump position
Parameters
positionToJumpToThe position to jump to
whenToJumpThe position the playhead should be at when performing the jump

◆ getPendingPositionChange()

std::optional< TimePosition > engine::EditPlaybackContext::getPendingPositionChange ( ) const

Returns a pending position change if there is one.

◆ play()

void engine::EditPlaybackContext::play ( )

◆ stop()

void engine::EditPlaybackContext::stop ( )

◆ postPlay()

void engine::EditPlaybackContext::postPlay ( )

Posts a transport position change so play can be synconrised with the next block.

◆ isPlayPending()

bool engine::EditPlaybackContext::isPlayPending ( ) const

Returns true if a play message has been posted but not dispatched.

◆ getSyncPoint()

std::optional< SyncPoint > engine::EditPlaybackContext::getSyncPoint ( ) const

Returns the last reference sample position and the edit time and beat that it corresponded to.

◆ globalStreamTimeToEditTime()

TimePosition engine::EditPlaybackContext::globalStreamTimeToEditTime ( double ) const

◆ globalStreamTimeToEditTimeUnlooped()

TimePosition engine::EditPlaybackContext::globalStreamTimeToEditTimeUnlooped ( double ) const

◆ resyncToGlobalStreamTime()

void engine::EditPlaybackContext::resyncToGlobalStreamTime ( juce::Range< double > ,
double sampleRate )

◆ getNodePlayHead()

tracktion::graph::PlayHead * engine::EditPlaybackContext::getNodePlayHead ( ) const

. Will be removed in a future release.

◆ blockUntilSyncPointChange()

void engine::EditPlaybackContext::blockUntilSyncPointChange ( )

◆ setThreadPoolStrategy()

void engine::EditPlaybackContext::setThreadPoolStrategy ( int )
static
See also
tracktion::graph::ThreadPoolStrategy

◆ getThreadPoolStrategy()

int engine::EditPlaybackContext::getThreadPoolStrategy ( )
static
See also
tracktion::graph::ThreadPoolStrategy

◆ enablePooledMemory()

void engine::EditPlaybackContext::enablePooledMemory ( bool )
static

Enables reusing of audio buffers during graph processing which may reduce the memory use at the cost of some additional overhead.

◆ enableNodeMemorySharing()

void engine::EditPlaybackContext::enableNodeMemorySharing ( bool )
static

Enables reusing of audio buffers during graph processing which may reduce the memory use at the cost of some additional overhead.

N.B. This is different from enablePooledMemory.

◆ enableAudioWorkgroup()

void engine::EditPlaybackContext::enableAudioWorkgroup ( bool )
static

Enables using AudioWorkgroups.

Currently experimental and only on macOS.

◆ getNumActivelyRecordingDevices()

int engine::EditPlaybackContext::getNumActivelyRecordingDevices ( ) const

◆ incrementNumActivelyRecordingDevices()

void engine::EditPlaybackContext::incrementNumActivelyRecordingDevices ( )

◆ decrementNumActivelyRecordingDevices()

void engine::EditPlaybackContext::decrementNumActivelyRecordingDevices ( )

Member Data Documentation

◆ edit

Edit& engine::EditPlaybackContext::edit

◆ transport

TransportControl& engine::EditPlaybackContext::transport

◆ masterLevels

LevelMeasurer engine::EditPlaybackContext::masterLevels

◆ midiDispatcher

MidiNoteDispatcher engine::EditPlaybackContext::midiDispatcher

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