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 | List of all members
tracktion::graph::PlayHead Class Reference

Converts a monotonically increasing reference range in to a timeline range. More...

#include "tracktion_PlayHead.h"

Public Member Functions

 PlayHead () noexcept
 Creates a PlayHead.
 
void setPosition (int64_t newPosition)
 Sets the timeline position of the play head and if it is different logs a user interaction.
 
void play (juce::Range< int64_t > rangeToPlay, bool looped)
 Plays a range in a loop.
 
void play ()
 Starts playback from the last position.
 
void playSyncedToRange (juce::Range< int64_t > rangeToPlay)
 Takes the play position directly from the playout range.
 
void stop ()
 Stops the play head.
 
int64_t getPosition () const
 Returns the current timeline position.
 
int64_t getUnloopedPosition () const
 Returns the current timeline position ignoring any loop range which might have been set.
 
void overridePosition (int64_t newPosition)
 Adjust position without triggering a 'user interaction' change.
 
bool isPlaying () const noexcept
 Returns true is the play head is currently playing.
 
bool isStopped () const noexcept
 Returns true is the play head is currently stopped.
 
bool isLooping () const noexcept
 Returns true is the play head is in loop mode.
 
bool isRollingIntoLoop () const noexcept
 Returns true is the play head is looping but playing before the loop start position.
 
juce::Range< int64_tgetLoopRange () const noexcept
 Returns the looped playback range.
 
void setLoopRange (bool loop, juce::Range< int64_t > loopRange, bool updatePosition=true)
 Sets a playback range and whether to loop or not.
 
void setRollInToLoop (int64_t playbackPosition)
 Puts the play head in to roll in to loop mode.
 
void setUserIsDragging (bool)
 Sets the user dragging which logs a user interaction and enables scrubbing mode.
 
bool isUserDragging () const
 Returns true if the user is dragging.
 
std::chrono::system_clock::time_point getLastUserInteractionTime () const
 Returns the time of the last user interaction, either a setPosition or setUserIsDragging call.
 
void setScrubbingBlockLength (int64_t numSamples)
 Sets the length of the small looped blocks to play while scrubbing.
 
int64_t getScrubbingBlockLength () const
 Returns the length of the small looped blocks to play while scrubbing.
 
int64_t referenceSamplePositionToTimelinePosition (int64_t referenceSamplePosition) const
 Converts a reference sample position to a timeline position.
 
int64_t referenceSamplePositionToTimelinePositionUnlooped (int64_t referenceSamplePosition) const
 Converts a reference sample position to a timeline position as if there was no looping set.
 
juce::Range< int64_treferenceSampleRangeToSourceRangeUnlooped (juce::Range< int64_t > sourceReferenceSampleRange) const
 Converts a reference sample range to a timeline range as if there was no looping set.
 
void setReferenceSampleRange (juce::Range< int64_t > sampleRange)
 Sets the reference sample count, adjusting the timeline if the play head is playing.
 
juce::Range< int64_tgetReferenceSampleRange () const
 Returns the reference sample count.
 
int64_t getPlayoutSyncPosition () const
 Returns the playout sync position.
 

Static Public Member Functions

static int64_t linearPositionToLoopPosition (int64_t position, juce::Range< int64_t > loopRange)
 Converts a linear timeline position to a position wrapped in the loop.
 

Detailed Description

Converts a monotonically increasing reference range in to a timeline range.

This can then get converted to a real-time range using the playback sample rate. This also handles looping and scrubbing and keeps track of when the play position was last set.

Definition at line 51 of file tracktion_PlayHead.h.

Constructor & Destructor Documentation

◆ PlayHead()

tracktion::graph::PlayHead::PlayHead ( )
noexcept

Creates a PlayHead.

Definition at line 185 of file tracktion_PlayHead.h.

Member Function Documentation

◆ getLastUserInteractionTime()

std::chrono::system_clock::time_point tracktion::graph::PlayHead::getLastUserInteractionTime ( ) const

Returns the time of the last user interaction, either a setPosition or setUserIsDragging call.

Definition at line 295 of file tracktion_PlayHead.h.

◆ getLoopRange()

juce::Range< int64_t > tracktion::graph::PlayHead::getLoopRange ( ) const
noexcept

Returns the looped playback range.

Definition at line 258 of file tracktion_PlayHead.h.

◆ getPlayoutSyncPosition()

int64_t tracktion::graph::PlayHead::getPlayoutSyncPosition ( ) const

Returns the playout sync position.

For syncing a reference position to a timeline position.

Definition at line 358 of file tracktion_PlayHead.h.

◆ getPosition()

int64_t tracktion::graph::PlayHead::getPosition ( ) const

Returns the current timeline position.

Definition at line 226 of file tracktion_PlayHead.h.

◆ getReferenceSampleRange()

juce::Range< int64_t > tracktion::graph::PlayHead::getReferenceSampleRange ( ) const

Returns the reference sample count.

Definition at line 353 of file tracktion_PlayHead.h.

◆ getScrubbingBlockLength()

int64_t tracktion::graph::PlayHead::getScrubbingBlockLength ( ) const

Returns the length of the small looped blocks to play while scrubbing.

Definition at line 306 of file tracktion_PlayHead.h.

◆ getUnloopedPosition()

int64_t tracktion::graph::PlayHead::getUnloopedPosition ( ) const

Returns the current timeline position ignoring any loop range which might have been set.

Definition at line 231 of file tracktion_PlayHead.h.

◆ isLooping()

bool tracktion::graph::PlayHead::isLooping ( ) const
noexcept

Returns true is the play head is in loop mode.

Definition at line 254 of file tracktion_PlayHead.h.

◆ isPlaying()

bool tracktion::graph::PlayHead::isPlaying ( ) const
noexcept

Returns true is the play head is currently playing.

Definition at line 250 of file tracktion_PlayHead.h.

◆ isRollingIntoLoop()

bool tracktion::graph::PlayHead::isRollingIntoLoop ( ) const
noexcept

Returns true is the play head is looping but playing before the loop start position.

Definition at line 256 of file tracktion_PlayHead.h.

◆ isStopped()

bool tracktion::graph::PlayHead::isStopped ( ) const
noexcept

Returns true is the play head is currently stopped.

Definition at line 252 of file tracktion_PlayHead.h.

◆ isUserDragging()

bool tracktion::graph::PlayHead::isUserDragging ( ) const

Returns true if the user is dragging.

Definition at line 290 of file tracktion_PlayHead.h.

◆ linearPositionToLoopPosition()

int64_t tracktion::graph::PlayHead::linearPositionToLoopPosition ( int64_t  position,
juce::Range< int64_t loopRange 
)
static

Converts a linear timeline position to a position wrapped in the loop.

Definition at line 338 of file tracktion_PlayHead.h.

◆ overridePosition()

void tracktion::graph::PlayHead::overridePosition ( int64_t  newPosition)

Adjust position without triggering a 'user interaction' change.

Use when the position change actually maintains continuity - e.g. a tempo change.

Definition at line 236 of file tracktion_PlayHead.h.

◆ play() [1/2]

void tracktion::graph::PlayHead::play ( )

Starts playback from the last position.

Definition at line 207 of file tracktion_PlayHead.h.

◆ play() [2/2]

void tracktion::graph::PlayHead::play ( juce::Range< int64_t rangeToPlay,
bool  looped 
)

Plays a range in a loop.

Definition at line 199 of file tracktion_PlayHead.h.

◆ playSyncedToRange()

void tracktion::graph::PlayHead::playSyncedToRange ( juce::Range< int64_t rangeToPlay)

Takes the play position directly from the playout range.

This is for rendering, where there will be no master stream to sync to. N.B. this disables looping.

Definition at line 213 of file tracktion_PlayHead.h.

◆ referenceSamplePositionToTimelinePosition()

int64_t tracktion::graph::PlayHead::referenceSamplePositionToTimelinePosition ( int64_t  referenceSamplePosition) const

Converts a reference sample position to a timeline position.

Definition at line 312 of file tracktion_PlayHead.h.

◆ referenceSamplePositionToTimelinePositionUnlooped()

int64_t tracktion::graph::PlayHead::referenceSamplePositionToTimelinePositionUnlooped ( int64_t  referenceSamplePosition) const

Converts a reference sample position to a timeline position as if there was no looping set.

Definition at line 325 of file tracktion_PlayHead.h.

◆ referenceSampleRangeToSourceRangeUnlooped()

juce::Range< int64_t > tracktion::graph::PlayHead::referenceSampleRangeToSourceRangeUnlooped ( juce::Range< int64_t sourceReferenceSampleRange) const

Converts a reference sample range to a timeline range as if there was no looping set.

Definition at line 331 of file tracktion_PlayHead.h.

◆ setLoopRange()

void tracktion::graph::PlayHead::setLoopRange ( bool  loop,
juce::Range< int64_t loopRange,
bool  updatePosition = true 
)

Sets a playback range and whether to loop or not.

Definition at line 260 of file tracktion_PlayHead.h.

◆ setPosition()

void tracktion::graph::PlayHead::setPosition ( int64_t  newPosition)

Sets the timeline position of the play head and if it is different logs a user interaction.

Definition at line 191 of file tracktion_PlayHead.h.

◆ setReferenceSampleRange()

void tracktion::graph::PlayHead::setReferenceSampleRange ( juce::Range< int64_t sampleRange)

Sets the reference sample count, adjusting the timeline if the play head is playing.

Definition at line 345 of file tracktion_PlayHead.h.

◆ setRollInToLoop()

void tracktion::graph::PlayHead::setRollInToLoop ( int64_t  playbackPosition)

Puts the play head in to roll in to loop mode.

If this position is before the loop start position, the play head won't be wrapped to enable count in to loop recordings etc.

Definition at line 273 of file tracktion_PlayHead.h.

◆ setScrubbingBlockLength()

void tracktion::graph::PlayHead::setScrubbingBlockLength ( int64_t  numSamples)

Sets the length of the small looped blocks to play while scrubbing.

E.g. when the user is dragging.

Definition at line 301 of file tracktion_PlayHead.h.

◆ setUserIsDragging()

void tracktion::graph::PlayHead::setUserIsDragging ( bool  b)

Sets the user dragging which logs a user interaction and enables scrubbing mode.

Definition at line 284 of file tracktion_PlayHead.h.

◆ stop()

void tracktion::graph::PlayHead::stop ( )

Stops the play head.

Definition at line 219 of file tracktion_PlayHead.h.


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