TracktionEngine
Public Member Functions | Public Attributes | List of all members
tracktion::engine::TempoSequence Class Reference

Holds a list of TempoSetting objects, to form a sequence of tempo changes. More...

Inheritance diagram for tracktion::engine::TempoSequence:

Public Member Functions

 TempoSequence (Edit &)
 Creates a TempoSequence for an Edit. More...
 
 ~TempoSequence () override
 Destructor. More...
 
EditgetEdit () const
 Returns the Edit this TempoSequence refers to. More...
 
const juce::ValueTree & getState () const
 Returns the state this TempoSequence models. More...
 
void setState (const juce::ValueTree &, bool remapEdit)
 Sets the state this TempoSequence should refer to. More...
 
void createEmptyState ()
 Resets this to a default, empty state. More...
 
void copyFrom (const TempoSequence &)
 Copies the contents of another TempoSequence. More...
 
const juce::Array< TimeSigSetting * > & getTimeSigs () const
 Returns an array of the TimeSigSetting. More...
 
int getNumTimeSigs () const
 Returns the number of TimeSigSetting[s] in the sequence. More...
 
TimeSigSettinggetTimeSig (int index) const
 Returns the TimeSigSetting at a given index. More...
 
TimeSigSettinggetTimeSigAt (TimePosition) const
 Returns the TimeSigSetting at a given position. More...
 
TimeSigSettinggetTimeSigAt (BeatPosition) const
 Returns the TimeSigSetting at a given position. More...
 
int indexOfTimeSigAt (TimePosition) const
 Returns the index of TimeSigSetting at a given position. More...
 
int indexOfTimeSig (const TimeSigSetting *) const
 Returns the index of a given TimeSigSetting. More...
 
const juce::Array< TempoSetting * > & getTempos () const
 Returns the TempoSettings. More...
 
int getNumTempos () const
 Returns the current number of TempoSettings. More...
 
TempoSettinggetTempo (int index) const
 Returns the TempoSetting at the given index. More...
 
TempoSettinggetTempoAt (TimePosition) const
 Returns the TempoSetting at the given position. More...
 
TempoSettinggetTempoAt (BeatPosition) const
 Returns the TempoSetting at the given position. More...
 
double getBpmAt (TimePosition) const
 Returns the tempo at a given position. More...
 
double getBeatsPerSecondAt (TimePosition, bool lengthOfOneBeatDependsOnTimeSignature=false) const
 Returns the tempo at a given position. More...
 
bool isTripletsAtTime (TimePosition) const
 Returns true if the TempoSetting is triplets at the given time. More...
 
int indexOfTempoAt (TimePosition) const
 Returns the index of the TempoSetting at the given position. More...
 
int indexOfNextTempoAt (TimePosition) const
 Returns the index of the TempoSetting after the given position. More...
 
int indexOfTempo (const TempoSetting *) const
 Returns the index of the given TempoSetting. More...
 
int countTemposInRegion (TimeRange) const
 Returns the number of TempoSetting[s] in the given range. More...
 
TempoSetting::Ptr insertTempo (TimePosition)
 Inserts a tempo break that can be edited later. More...
 
TempoSetting::Ptr insertTempo (BeatPosition, double bpm, float curve)
 Inserts a tempo with a bpm and curve value. More...
 
TimeSigSetting::Ptr insertTimeSig (TimePosition)
 Inserts a new TimeSigSetting at the given position. More...
 
TimeSigSetting::Ptr insertTimeSig (BeatPosition)
 Inserts a new TimeSigSetting at the given position. More...
 
void removeTempo (int index, bool remapEdit)
 Removes the TempoSetting at a given index. More...
 
void removeTemposBetween (TimeRange, bool remapEdit)
 Removes any TempoSetting[s] within the range. More...
 
void removeTimeSig (int index)
 Removes the TimeSigSetting at a given index. More...
 
void removeTimeSigsBetween (TimeRange)
 Removes any TimeSigSetting[s] within the range. More...
 
void moveTempoStart (int index, BeatDuration deltaBeats, bool snapToBeat)
 Moves the TempoSetting at a given index by a number of beats. More...
 
void moveTimeSigStart (int index, BeatDuration deltaBeats, bool snapToBeat)
 Moves the TimeSigSetting at a given index by a number of beats. More...
 
void insertSpaceIntoSequence (TimePosition time, TimeDuration amountOfSpaceInSeconds, bool snapToBeat)
 Inserts space in to a sequence, shifting TempoSettings and TimeSigs. More...
 
void deleteRegion (TimeRange)
 Removes a region in a sequence, shifting TempoSettings and TimeSigs. More...
 
BeatPosition toBeats (TimePosition) const
 Converts a time to a number of beats. More...
 
BeatRange toBeats (TimeRange) const
 Converts a time range to a beat range. More...
 
BeatPosition toBeats (tempo::BarsAndBeats) const
 Converts a number of BarsAndBeats to a position. More...
 
TimePosition toTime (BeatPosition) const
 Converts a number of beats a time. More...
 
TimeRange toTime (BeatRange) const
 Converts a beat range to a time range. More...
 
TimePosition toTime (tempo::BarsAndBeats) const
 Converts a number of BarsAndBeats to a position. More...
 
tempo::BarsAndBeats toBarsAndBeats (TimePosition) const
 Converts a time to a number of BarsAndBeats. More...
 
const tempo::Sequence & getInternalSequence () const
 N.B. More...
 
tempo::BarsAndBeats timeToBarsBeats (TimePosition) const
 
TimePosition barsBeatsToTime (tempo::BarsAndBeats) const
 
BeatPosition barsBeatsToBeats (tempo::BarsAndBeats) const
 
BeatPosition timeToBeats (TimePosition time) const
 
BeatRange timeToBeats (TimeRange range) const
 
TimePosition beatsToTime (BeatPosition beats) const
 
TimeRange beatsToTime (BeatRange range) const
 
TimeSigSettinggetTimeSigAtBeat (BeatPosition) const
 
TempoSettinggetTempoAtBeat (BeatPosition) const
 
juce::UndoManager * getUndoManager () const noexcept
 
juce::String getSelectableDescription () override
 
void freeResources ()
 
void updateTempoData ()
 
- Public Member Functions inherited from tracktion::engine::Selectable
 Selectable ()
 
virtual ~Selectable ()
 
virtual void selectionStatusChanged (bool isNowSelected)
 Can be overridden to tell this object that it has just been selected or deselected. More...
 
virtual void changed ()
 This should be called to send a change notification to any SelectableListeners that are registered with this object. More...
 
virtual void selectableAboutToBeDeleted ()
 Called just before the selectable is about to be deleted so any subclasses should still be valid at this point. More...
 
void addSelectableListener (SelectableListener *)
 
void removeSelectableListener (SelectableListener *)
 
void cancelAnyPendingUpdates ()
 If changed() has been called, this will cancel any pending async change notificaions. More...
 
void deselect ()
 
void propertiesChanged ()
 
void notifyListenersOfDeletion ()
 
WeakRef getWeakRef ()
 

Public Attributes

Editedit
 The Edit this sequence belongs to. More...
 
- Public Attributes inherited from tracktion::engine::Selectable
WeakRef::Master masterReference
 

Additional Inherited Members

- Public Types inherited from tracktion::engine::Selectable
using WeakRef = juce::WeakReference< Selectable >
 
- Static Public Member Functions inherited from tracktion::engine::Selectable
static void initialise ()
 
static bool isSelectableValid (const Selectable *) noexcept
 checks whether this object has been deleted. More...
 

Detailed Description

Holds a list of TempoSetting objects, to form a sequence of tempo changes.

You can query this at particular points, but it's wise to use a tempo::Sequence::Position object to iterate it.

See also
createPosition

Constructor & Destructor Documentation

◆ TempoSequence()

tracktion::engine::TempoSequence::TempoSequence ( Edit )

Creates a TempoSequence for an Edit.

◆ ~TempoSequence()

tracktion::engine::TempoSequence::~TempoSequence ( )
override

Destructor.

Member Function Documentation

◆ getEdit()

Edit& tracktion::engine::TempoSequence::getEdit ( ) const

Returns the Edit this TempoSequence refers to.

References edit.

◆ getState()

const juce::ValueTree& tracktion::engine::TempoSequence::getState ( ) const

Returns the state this TempoSequence models.

◆ setState()

void tracktion::engine::TempoSequence::setState ( const juce::ValueTree &  ,
bool  remapEdit 
)

Sets the state this TempoSequence should refer to.

◆ createEmptyState()

void tracktion::engine::TempoSequence::createEmptyState ( )

Resets this to a default, empty state.

◆ copyFrom()

void tracktion::engine::TempoSequence::copyFrom ( const TempoSequence )

Copies the contents of another TempoSequence.

◆ getTimeSigs()

const juce::Array<TimeSigSetting*>& tracktion::engine::TempoSequence::getTimeSigs ( ) const

Returns an array of the TimeSigSetting.

◆ getNumTimeSigs()

int tracktion::engine::TempoSequence::getNumTimeSigs ( ) const

Returns the number of TimeSigSetting[s] in the sequence.

◆ getTimeSig()

TimeSigSetting* tracktion::engine::TempoSequence::getTimeSig ( int  index) const

Returns the TimeSigSetting at a given index.

◆ getTimeSigAt() [1/2]

TimeSigSetting& tracktion::engine::TempoSequence::getTimeSigAt ( TimePosition  ) const

Returns the TimeSigSetting at a given position.

◆ getTimeSigAt() [2/2]

TimeSigSetting& tracktion::engine::TempoSequence::getTimeSigAt ( BeatPosition  ) const

Returns the TimeSigSetting at a given position.

◆ indexOfTimeSigAt()

int tracktion::engine::TempoSequence::indexOfTimeSigAt ( TimePosition  ) const

Returns the index of TimeSigSetting at a given position.

◆ indexOfTimeSig()

int tracktion::engine::TempoSequence::indexOfTimeSig ( const TimeSigSetting ) const

Returns the index of a given TimeSigSetting.

◆ getTempos()

const juce::Array<TempoSetting*>& tracktion::engine::TempoSequence::getTempos ( ) const

Returns the TempoSettings.

◆ getNumTempos()

int tracktion::engine::TempoSequence::getNumTempos ( ) const

Returns the current number of TempoSettings.

◆ getTempo()

TempoSetting* tracktion::engine::TempoSequence::getTempo ( int  index) const

Returns the TempoSetting at the given index.

◆ getTempoAt() [1/2]

TempoSetting& tracktion::engine::TempoSequence::getTempoAt ( TimePosition  ) const

Returns the TempoSetting at the given position.

◆ getTempoAt() [2/2]

TempoSetting& tracktion::engine::TempoSequence::getTempoAt ( BeatPosition  ) const

Returns the TempoSetting at the given position.

◆ getBpmAt()

double tracktion::engine::TempoSequence::getBpmAt ( TimePosition  ) const

Returns the tempo at a given position.

N.B. This is the actual tempo at the time, including any curves. I.e. it is not just the bpm of the previous TempoSetting

◆ getBeatsPerSecondAt()

double tracktion::engine::TempoSequence::getBeatsPerSecondAt ( TimePosition  ,
bool  lengthOfOneBeatDependsOnTimeSignature = false 
) const

Returns the tempo at a given position.

N.B. This is the actual tempo at the time, including any curves. I.e. it is not just the bpm of the previous TempoSetting

◆ isTripletsAtTime()

bool tracktion::engine::TempoSequence::isTripletsAtTime ( TimePosition  ) const

Returns true if the TempoSetting is triplets at the given time.

◆ indexOfTempoAt()

int tracktion::engine::TempoSequence::indexOfTempoAt ( TimePosition  ) const

Returns the index of the TempoSetting at the given position.

◆ indexOfNextTempoAt()

int tracktion::engine::TempoSequence::indexOfNextTempoAt ( TimePosition  ) const

Returns the index of the TempoSetting after the given position.

◆ indexOfTempo()

int tracktion::engine::TempoSequence::indexOfTempo ( const TempoSetting ) const

Returns the index of the given TempoSetting.

◆ countTemposInRegion()

int tracktion::engine::TempoSequence::countTemposInRegion ( TimeRange  ) const

Returns the number of TempoSetting[s] in the given range.

◆ insertTempo() [1/2]

TempoSetting::Ptr tracktion::engine::TempoSequence::insertTempo ( TimePosition  )

Inserts a tempo break that can be edited later.

◆ insertTempo() [2/2]

TempoSetting::Ptr tracktion::engine::TempoSequence::insertTempo ( BeatPosition  ,
double  bpm,
float  curve 
)

Inserts a tempo with a bpm and curve value.

See also
TempoSetting.

◆ insertTimeSig() [1/2]

TimeSigSetting::Ptr tracktion::engine::TempoSequence::insertTimeSig ( TimePosition  )

Inserts a new TimeSigSetting at the given position.

◆ insertTimeSig() [2/2]

TimeSigSetting::Ptr tracktion::engine::TempoSequence::insertTimeSig ( BeatPosition  )

Inserts a new TimeSigSetting at the given position.

◆ removeTempo()

void tracktion::engine::TempoSequence::removeTempo ( int  index,
bool  remapEdit 
)

Removes the TempoSetting at a given index.

Parameters
remapEditIf true, this will update the positions of Edit content

◆ removeTemposBetween()

void tracktion::engine::TempoSequence::removeTemposBetween ( TimeRange  ,
bool  remapEdit 
)

Removes any TempoSetting[s] within the range.

Parameters
remapEditIf true, this will update the positions of Edit content

◆ removeTimeSig()

void tracktion::engine::TempoSequence::removeTimeSig ( int  index)

Removes the TimeSigSetting at a given index.

◆ removeTimeSigsBetween()

void tracktion::engine::TempoSequence::removeTimeSigsBetween ( TimeRange  )

Removes any TimeSigSetting[s] within the range.

◆ moveTempoStart()

void tracktion::engine::TempoSequence::moveTempoStart ( int  index,
BeatDuration  deltaBeats,
bool  snapToBeat 
)

Moves the TempoSetting at a given index by a number of beats.

◆ moveTimeSigStart()

void tracktion::engine::TempoSequence::moveTimeSigStart ( int  index,
BeatDuration  deltaBeats,
bool  snapToBeat 
)

Moves the TimeSigSetting at a given index by a number of beats.

◆ insertSpaceIntoSequence()

void tracktion::engine::TempoSequence::insertSpaceIntoSequence ( TimePosition  time,
TimeDuration  amountOfSpaceInSeconds,
bool  snapToBeat 
)

Inserts space in to a sequence, shifting TempoSettings and TimeSigs.

◆ deleteRegion()

void tracktion::engine::TempoSequence::deleteRegion ( TimeRange  )

Removes a region in a sequence, shifting TempoSettings and TimeSigs.

◆ toBeats() [1/3]

BeatPosition tracktion::engine::TempoSequence::toBeats ( TimePosition  ) const

Converts a time to a number of beats.

◆ toBeats() [2/3]

BeatRange tracktion::engine::TempoSequence::toBeats ( TimeRange  ) const

Converts a time range to a beat range.

◆ toBeats() [3/3]

BeatPosition tracktion::engine::TempoSequence::toBeats ( tempo::BarsAndBeats  ) const

Converts a number of BarsAndBeats to a position.

◆ toTime() [1/3]

TimePosition tracktion::engine::TempoSequence::toTime ( BeatPosition  ) const

Converts a number of beats a time.

◆ toTime() [2/3]

TimeRange tracktion::engine::TempoSequence::toTime ( BeatRange  ) const

Converts a beat range to a time range.

◆ toTime() [3/3]

TimePosition tracktion::engine::TempoSequence::toTime ( tempo::BarsAndBeats  ) const

Converts a number of BarsAndBeats to a position.

◆ toBarsAndBeats()

tempo::BarsAndBeats tracktion::engine::TempoSequence::toBarsAndBeats ( TimePosition  ) const

Converts a time to a number of BarsAndBeats.

◆ getInternalSequence()

const tempo::Sequence& tracktion::engine::TempoSequence::getInternalSequence ( ) const

N.B.

It is only safe to call this from the message thread or during audio callbacks. Access at any other time could incur data races.

◆ timeToBarsBeats()

tempo::BarsAndBeats tracktion::engine::TempoSequence::timeToBarsBeats ( TimePosition  ) const

◆ barsBeatsToTime()

TimePosition tracktion::engine::TempoSequence::barsBeatsToTime ( tempo::BarsAndBeats  ) const

◆ barsBeatsToBeats()

BeatPosition tracktion::engine::TempoSequence::barsBeatsToBeats ( tempo::BarsAndBeats  ) const

◆ timeToBeats() [1/2]

BeatPosition tracktion::engine::TempoSequence::timeToBeats ( TimePosition  time) const

◆ timeToBeats() [2/2]

BeatRange tracktion::engine::TempoSequence::timeToBeats ( TimeRange  range) const

◆ beatsToTime() [1/2]

TimePosition tracktion::engine::TempoSequence::beatsToTime ( BeatPosition  beats) const

◆ beatsToTime() [2/2]

TimeRange tracktion::engine::TempoSequence::beatsToTime ( BeatRange  range) const

◆ getTimeSigAtBeat()

TimeSigSetting& tracktion::engine::TempoSequence::getTimeSigAtBeat ( BeatPosition  ) const

◆ getTempoAtBeat()

TempoSetting& tracktion::engine::TempoSequence::getTempoAtBeat ( BeatPosition  ) const

◆ getUndoManager()

juce::UndoManager* tracktion::engine::TempoSequence::getUndoManager ( ) const
noexcept

◆ getSelectableDescription()

juce::String tracktion::engine::TempoSequence::getSelectableDescription ( )
overridevirtual

◆ freeResources()

void tracktion::engine::TempoSequence::freeResources ( )

◆ updateTempoData()

void tracktion::engine::TempoSequence::updateTempoData ( )

Member Data Documentation

◆ edit

Edit& tracktion::engine::TempoSequence::edit

The Edit this sequence belongs to.

Referenced by getEdit().


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