Musical Timeline Conversions

Detailed Description

Classes designed to perform conversions between musical and linear timelines.

Classes

class  ARA::TempoConverter< TempoContentReader >
 Efficient conversion between physical time in seconds and musical time in quarters. More...
 
class  ARA::BarSignaturesConverter< BarSignaturesContentReader >
 Mapping between a given quarter position and its associated bar signature and beat position. More...
 

Class Documentation

◆ ARA::TempoConverter

class ARA::TempoConverter

template<typename TempoContentReader>
class ARA::TempoConverter< TempoContentReader >

Efficient conversion between physical time in seconds and musical time in quarters.

Utilizes internal cache of last access to optimize next access if "close" to last access, which is the typical case during playback, when drawing a time line, etc. templated so it can be used in both hosts and plug-ins with content readers, or with any other data structure that provides a matching interface.

Public Member Functions

 TempoConverter (const TempoContentReader &contentReader)
 Construct using a host or plug-in kARAContentTypeTempoEntries reader.
 
ARAQuarterPosition getQuarterForTime (const ARATimePosition timePosition) const
 Convert a position in time to a quarter position.
 
ARATimePosition getTimeForQuarter (const ARAQuarterPosition quarterPosition) const
 Convert a quarter position to a position in time.
 

◆ ARA::BarSignaturesConverter

class ARA::BarSignaturesConverter

template<typename BarSignaturesContentReader>
class ARA::BarSignaturesConverter< BarSignaturesContentReader >

Mapping between a given quarter position and its associated bar signature and beat position.

Utilizes internal cache of last access to optimize next access if "close" to last access, which is the typical case during playback, when drawing a time line, etc. templated so it can be used in both hosts and plug-ins with content readers, or with any other data structure that provides a matching interface.

Public Member Functions

 BarSignaturesConverter (const BarSignaturesContentReader &reader) noexcept
 Construct using a host or plug-in kARAContentTypeBarSignatures reader.
 
const ARAContentBarSignature getBarSignatureForQuarter (const ARAQuarterPosition quarterPosition) const noexcept
 Look up the bar signature at a particular quarter position.
 
const ARAContentBarSignature getBarSignatureForBeat (const double beatPosition) const noexcept
 Look up the bar signature at a particular beat position.
 
double getBeatForQuarter (const ARAQuarterPosition quarterPosition) const noexcept
 Get the beat position for a particular quarter position.
 
ARAQuarterPosition getQuarterForBeat (const double beatPosition) const noexcept
 Get the quarter position for a particular beat position.
 
double getBeatDistanceFromBarStartForQuarter (const ARAQuarterPosition quarterPosition) const noexcept
 Get the distance in beats from the start of the bar signature at quarterPosition.
 
int getBarIndexForQuarter (const ARAQuarterPosition quarterPosition) const noexcept
 Get the index of the bar at quarterPosition. Relatively expensive since bar indices aren't cached in the current implementation.
 
ARAQuarterPosition getQuarterForBarIndex (const int barIndex) const noexcept
 Get the quarter position of the start of the bar at barIndex. Relatively expensive since bar indices aren't cached in the current implementation.
 

Static Public Member Functions

static double getBeatsPerQuarter (const ARAContentBarSignature &barSignature) noexcept
 Get the beats per quarter for barSignature.
 
static double getQuartersPerBar (const ARAContentBarSignature &barSignature) noexcept
 Get the quarters per bar for barSignature.