JUCE: AudioPlayHead::PositionInfo Class Reference

JUCE

Public Member Functions | List of all members
AudioPlayHead::PositionInfo Class Reference
juce_audio_basics » audio_play_head

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

`#include <juce_AudioPlayHead.h>`

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

## 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 Function Documentation

## ◆ getTimeInSamples()

Optional< int64_t > AudioPlayHead::PositionInfo::getTimeInSamples | ( |  | ) | const

Returns the number of samples that have elapsed.

## ◆ setTimeInSamples()

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

See also
  getTimeInSamples()

## ◆ getTimeInSeconds()

Optional< double > AudioPlayHead::PositionInfo::getTimeInSeconds | ( |  | ) | const

Returns the number of seconds that have elapsed.

## ◆ setTimeInSeconds()

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

See also
  getTimeInSamples()

## ◆ getBpm()

Optional< double > AudioPlayHead::PositionInfo::getBpm | ( |  | ) | const

Returns the bpm, if available.

## ◆ setBpm()

void AudioPlayHead::PositionInfo::setBpm | ( | Optional< double > | bpmIn | ) |

See also
  getBpm()

## ◆ getTimeSignature()

Optional< TimeSignature > AudioPlayHead::PositionInfo::getTimeSignature | ( |  | ) | const

Returns the time signature, if available.

## ◆ setTimeSignature()

void AudioPlayHead::PositionInfo::setTimeSignature | ( | Optional< TimeSignature > | timeSignatureIn | ) |

See also
  getTimeSignature()

## ◆ getLoopPoints()

Optional< LoopPoints > AudioPlayHead::PositionInfo::getLoopPoints | ( |  | ) | const

Returns host loop points, if available.

## ◆ setLoopPoints()

void AudioPlayHead::PositionInfo::setLoopPoints | ( | Optional< LoopPoints > | loopPointsIn | ) |

See also
  getLoopPoints()

## ◆ getBarCount()

Optional< int64_t > AudioPlayHead::PositionInfo::getBarCount | ( |  | ) | const

The number of bars since the beginning of the timeline.

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

## ◆ setBarCount()

void AudioPlayHead::PositionInfo::setBarCount | ( | Optional< int64_t > | barCountIn | ) |

See also
  getBarCount()

## ◆ getPpqPositionOfLastBarStart()

Optional< double > AudioPlayHead::PositionInfo::getPpqPositionOfLastBarStart | ( |  | ) | const

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.

## ◆ setPpqPositionOfLastBarStart()

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

See also
  getPpqPositionOfLastBarStart()

## ◆ getFrameRate()

Optional< FrameRate > AudioPlayHead::PositionInfo::getFrameRate | ( |  | ) | const

The video frame rate, if available.

## ◆ setFrameRate()

void AudioPlayHead::PositionInfo::setFrameRate | ( | Optional< FrameRate > | frameRateIn | ) |

See also
  getFrameRate()

## ◆ getPpqPosition()

Optional< double > AudioPlayHead::PositionInfo::getPpqPosition | ( |  | ) | const

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

## ◆ setPpqPosition()

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

See also
  getPpqPosition()

## ◆ getEditOriginTime()

Optional< double > AudioPlayHead::PositionInfo::getEditOriginTime | ( |  | ) | const

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

## ◆ setEditOriginTime()

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

See also
  getEditOriginTime()

## ◆ getHostTimeNs()

Optional< uint64_t > AudioPlayHead::PositionInfo::getHostTimeNs | ( |  | ) | const

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

## ◆ setHostTimeNs()

void AudioPlayHead::PositionInfo::setHostTimeNs | ( | Optional< uint64_t > | hostTimeNsIn | ) |

See also
  getHostTimeNs()

## ◆ getIsPlaying()

bool AudioPlayHead::PositionInfo::getIsPlaying | ( |  | ) | const

True if the transport is currently playing.

## ◆ setIsPlaying()

void AudioPlayHead::PositionInfo::setIsPlaying | ( | bool | isPlayingIn | ) |

See also
  getIsPlaying()

## ◆ getIsRecording()

bool AudioPlayHead::PositionInfo::getIsRecording | ( |  | ) | const

True if the transport is currently recording.

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

## ◆ setIsRecording()

void AudioPlayHead::PositionInfo::setIsRecording | ( | bool | isRecordingIn | ) |

See also
  getIsRecording()

## ◆ getIsLooping()

bool AudioPlayHead::PositionInfo::getIsLooping | ( |  | ) | const

True if the transport is currently looping.

## ◆ setIsLooping()

void AudioPlayHead::PositionInfo::setIsLooping | ( | bool | isLoopingIn | ) |

See also
  getIsLooping()

## ◆ operator==()

bool AudioPlayHead::PositionInfo::operator== | ( | const PositionInfo & | other | ) | const
| noexcept

## ◆ operator!=()

bool AudioPlayHead::PositionInfo::operator!= | ( | const PositionInfo & | other | ) | const
| noexcept

References operator==().

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

- juce_AudioPlayHead.h