JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::AudioPlayHead::PositionInfo Class Reference

Describes the time at the start of the current audio callback. More...

#include <juce_AudioPlayHead.h>

Collaboration diagram for juce::AudioPlayHead::PositionInfo:

Public Member Functions

Optional< int64_t > getBarCount () const
 The number of bars since the beginning of the timeline.
 
Optional< double > getBpm () const
 Returns the bpm, if available.
 
Optional< double > getEditOriginTime () const
 For timecode, the position of the start of the timeline, in seconds from 00:00:00:00.
 
Optional< FrameRategetFrameRate () const
 The video frame rate, if available.
 
Optional< uint64_tgetHostTimeNs () const
 Get the host's callback time in nanoseconds, if available.
 
bool getIsLooping () const
 True if the transport is currently looping.
 
bool getIsPlaying () const
 True if the transport is currently playing.
 
bool getIsRecording () const
 True if the transport is currently recording.
 
Optional< LoopPointsgetLoopPoints () const
 Returns host loop points, if available.
 
Optional< double > getPpqPosition () const
 The current play position, in units of quarter-notes.
 
Optional< double > getPpqPositionOfLastBarStart () const
 The position of the start of the last bar, in units of quarter-notes.
 
Optional< int64_t > getTimeInSamples () const
 Returns the number of samples that have elapsed.
 
Optional< double > getTimeInSeconds () const
 Returns the number of seconds that have elapsed.
 
Optional< TimeSignaturegetTimeSignature () const
 Returns the time signature, if available.
 
bool operator!= (const PositionInfo &other) const noexcept
 
bool operator== (const PositionInfo &other) const noexcept
 
void setBarCount (Optional< int64_t > barCountIn)
 
void setBpm (Optional< double > bpmIn)
 
void setEditOriginTime (Optional< double > editOriginTimeIn)
 
void setFrameRate (Optional< FrameRate > frameRateIn)
 
void setHostTimeNs (Optional< uint64_t > hostTimeNsIn)
 
void setIsLooping (bool isLoopingIn)
 
void setIsPlaying (bool isPlayingIn)
 
void setIsRecording (bool isRecordingIn)
 
void setLoopPoints (Optional< LoopPoints > loopPointsIn)
 
void setPpqPosition (Optional< double > ppqPositionIn)
 
void setPpqPositionOfLastBarStart (Optional< double > positionIn)
 
void setTimeInSamples (Optional< int64_t > timeInSamplesIn)
 
void setTimeInSeconds (Optional< double > timeInSecondsIn)
 
void setTimeSignature (Optional< TimeSignature > timeSignatureIn)
 

Private Types

enum  {
  flagTimeSignature = 1 << 0 ,
  flagLoopPoints = 1 << 1 ,
  flagFrameRate = 1 << 2 ,
  flagTimeSeconds = 1 << 3 ,
  flagLastBarStartPpq = 1 << 4 ,
  flagPpqPosition = 1 << 5 ,
  flagOriginTime = 1 << 6 ,
  flagTempo = 1 << 7 ,
  flagTimeSamples = 1 << 8 ,
  flagBarCount = 1 << 9 ,
  flagHostTimeNs = 1 << 10 ,
  flagIsPlaying = 1 << 11 ,
  flagIsRecording = 1 << 12 ,
  flagIsLooping = 1 << 13
}
 

Private Member Functions

bool getFlag (int64_t flagToCheck) const
 
template<typename Value >
Optional< ValuegetOptional (int64_t flagToCheck, Value value) const
 
void setFlag (int64_t flagToCheck, bool value)
 
template<typename Value >
void setOptional (int64_t flagToCheck, Value &value, Optional< Value > opt)
 

Private Attributes

int64_t barCount = 0
 
int64_t flags = 0
 
FrameRate frame = FrameRateType::fps23976
 
uint64_t hostTimeNs = 0
 
double lastBarStartPpq = 0.0
 
LoopPoints loopPoints
 
double originTime = 0.0
 
double positionPpq = 0.0
 
double tempoBpm = 0.0
 
int64_t timeInSamples = 0
 
double timeInSeconds = 0.0
 
TimeSignature timeSignature
 

Detailed Description

Describes the time at the start of the current audio callback.

Not all hosts and plugin formats can provide all of the possible time information, so most of the getter functions in this class return an Optional that will only be engaged if the host provides the corresponding information. As a plugin developer, you should code defensively so that the plugin behaves sensibly even when the host fails to provide timing information.

A default-constructed instance of this class will return nullopt from all functions that return an Optional.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
flagTimeSignature 
flagLoopPoints 
flagFrameRate 
flagTimeSeconds 
flagLastBarStartPpq 
flagPpqPosition 
flagOriginTime 
flagTempo 
flagTimeSamples 
flagBarCount 
flagHostTimeNs 
flagIsPlaying 
flagIsRecording 
flagIsLooping 

Member Function Documentation

◆ getBarCount()

Optional< int64_t > juce::AudioPlayHead::PositionInfo::getBarCount ( ) const
inline

The number of bars since the beginning of the timeline.

This value isn't available in all hosts or in all plugin formats.

◆ getBpm()

Optional< double > juce::AudioPlayHead::PositionInfo::getBpm ( ) const
inline

Returns the bpm, if available.

◆ getEditOriginTime()

Optional< double > juce::AudioPlayHead::PositionInfo::getEditOriginTime ( ) const
inline

For timecode, the position of the start of the timeline, in seconds from 00:00:00:00.

◆ getFlag()

bool juce::AudioPlayHead::PositionInfo::getFlag ( int64_t  flagToCheck) const
inlineprivate

◆ getFrameRate()

Optional< FrameRate > juce::AudioPlayHead::PositionInfo::getFrameRate ( ) const
inline

The video frame rate, if available.

◆ getHostTimeNs()

Optional< uint64_t > juce::AudioPlayHead::PositionInfo::getHostTimeNs ( ) const
inline

Get the host's callback time in nanoseconds, if available.

◆ getIsLooping()

bool juce::AudioPlayHead::PositionInfo::getIsLooping ( ) const
inline

True if the transport is currently looping.

◆ getIsPlaying()

bool juce::AudioPlayHead::PositionInfo::getIsPlaying ( ) const
inline

True if the transport is currently playing.

◆ getIsRecording()

bool juce::AudioPlayHead::PositionInfo::getIsRecording ( ) const
inline

True if the transport is currently recording.

(When isRecording is true, then isPlaying will also be true).

◆ getLoopPoints()

Optional< LoopPoints > juce::AudioPlayHead::PositionInfo::getLoopPoints ( ) const
inline

Returns host loop points, if available.

◆ getOptional()

template<typename Value >
Optional< Value > juce::AudioPlayHead::PositionInfo::getOptional ( int64_t  flagToCheck,
Value  value 
) const
inlineprivate

◆ getPpqPosition()

Optional< double > juce::AudioPlayHead::PositionInfo::getPpqPosition ( ) const
inline

The current play position, in units of quarter-notes.

◆ getPpqPositionOfLastBarStart()

Optional< double > juce::AudioPlayHead::PositionInfo::getPpqPositionOfLastBarStart ( ) const
inline

The position of the start of the last bar, in units of quarter-notes.

This is the time from the start of the timeline to the start of the current bar, in ppq units.

Note - this value may be unavailable on some hosts, e.g. Pro-Tools.

◆ getTimeInSamples()

Optional< int64_t > juce::AudioPlayHead::PositionInfo::getTimeInSamples ( ) const
inline

Returns the number of samples that have elapsed.

◆ getTimeInSeconds()

Optional< double > juce::AudioPlayHead::PositionInfo::getTimeInSeconds ( ) const
inline

Returns the number of seconds that have elapsed.

◆ getTimeSignature()

Optional< TimeSignature > juce::AudioPlayHead::PositionInfo::getTimeSignature ( ) const
inline

Returns the time signature, if available.

◆ operator!=()

bool juce::AudioPlayHead::PositionInfo::operator!= ( const PositionInfo other) const
inlinenoexcept

◆ operator==()

bool juce::AudioPlayHead::PositionInfo::operator== ( const PositionInfo other) const
inlinenoexcept

◆ setBarCount()

void juce::AudioPlayHead::PositionInfo::setBarCount ( Optional< int64_t >  barCountIn)
inline
See also
getBarCount()

◆ setBpm()

void juce::AudioPlayHead::PositionInfo::setBpm ( Optional< double >  bpmIn)
inline
See also
getBpm()

◆ setEditOriginTime()

void juce::AudioPlayHead::PositionInfo::setEditOriginTime ( Optional< double >  editOriginTimeIn)
inline

◆ setFlag()

void juce::AudioPlayHead::PositionInfo::setFlag ( int64_t  flagToCheck,
bool  value 
)
inlineprivate

◆ setFrameRate()

void juce::AudioPlayHead::PositionInfo::setFrameRate ( Optional< FrameRate frameRateIn)
inline
See also
getFrameRate()

◆ setHostTimeNs()

void juce::AudioPlayHead::PositionInfo::setHostTimeNs ( Optional< uint64_t hostTimeNsIn)
inline
See also
getHostTimeNs()

◆ setIsLooping()

void juce::AudioPlayHead::PositionInfo::setIsLooping ( bool  isLoopingIn)
inline
See also
getIsLooping()

◆ setIsPlaying()

void juce::AudioPlayHead::PositionInfo::setIsPlaying ( bool  isPlayingIn)
inline
See also
getIsPlaying()

◆ setIsRecording()

void juce::AudioPlayHead::PositionInfo::setIsRecording ( bool  isRecordingIn)
inline

◆ setLoopPoints()

void juce::AudioPlayHead::PositionInfo::setLoopPoints ( Optional< LoopPoints loopPointsIn)
inline
See also
getLoopPoints()

◆ setOptional()

template<typename Value >
void juce::AudioPlayHead::PositionInfo::setOptional ( int64_t  flagToCheck,
Value value,
Optional< Value opt 
)
inlineprivate

◆ setPpqPosition()

void juce::AudioPlayHead::PositionInfo::setPpqPosition ( Optional< double >  ppqPositionIn)
inline

◆ setPpqPositionOfLastBarStart()

void juce::AudioPlayHead::PositionInfo::setPpqPositionOfLastBarStart ( Optional< double >  positionIn)
inline

◆ setTimeInSamples()

void juce::AudioPlayHead::PositionInfo::setTimeInSamples ( Optional< int64_t >  timeInSamplesIn)
inline

◆ setTimeInSeconds()

void juce::AudioPlayHead::PositionInfo::setTimeInSeconds ( Optional< double >  timeInSecondsIn)
inline

◆ setTimeSignature()

void juce::AudioPlayHead::PositionInfo::setTimeSignature ( Optional< TimeSignature timeSignatureIn)
inline

Member Data Documentation

◆ barCount

int64_t juce::AudioPlayHead::PositionInfo::barCount = 0
private

◆ flags

int64_t juce::AudioPlayHead::PositionInfo::flags = 0
private

◆ frame

FrameRate juce::AudioPlayHead::PositionInfo::frame = FrameRateType::fps23976
private

◆ hostTimeNs

uint64_t juce::AudioPlayHead::PositionInfo::hostTimeNs = 0
private

◆ lastBarStartPpq

double juce::AudioPlayHead::PositionInfo::lastBarStartPpq = 0.0
private

◆ loopPoints

LoopPoints juce::AudioPlayHead::PositionInfo::loopPoints
private

◆ originTime

double juce::AudioPlayHead::PositionInfo::originTime = 0.0
private

◆ positionPpq

double juce::AudioPlayHead::PositionInfo::positionPpq = 0.0
private

◆ tempoBpm

double juce::AudioPlayHead::PositionInfo::tempoBpm = 0.0
private

◆ timeInSamples

int64_t juce::AudioPlayHead::PositionInfo::timeInSamples = 0
private

◆ timeInSeconds

double juce::AudioPlayHead::PositionInfo::timeInSeconds = 0.0
private

◆ timeSignature

TimeSignature juce::AudioPlayHead::PositionInfo::timeSignature
private

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