Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::sound::base::MIDITime Class Reference

A class that represents a musical position within a MIDI sequence. More...

#include <omSoundMIDITime.h>

Public Member Functions

 MIDITime ()
 Create a new default MIDI time object with the default tempo of 120 quarter notes per minute. More...
 
 MIDITime (Float newTempo, Index newMeasure, Float newBeat, TimeSignature newTimeSignature)
 Create a new MIDI Time object with the specified tempo, measure index, beat number, and time signature. More...
 
Float getTempo () const
 Return the number of quarter notes per minutes for the current position in the MIDI sequence. More...
 
void setTempo (Float newTempo)
 Return the number of quarter notes per minutes for the current position in the MIDI sequence. More...
 
Index getMeasure () const
 The index of the current measure within the MIDI sequence. More...
 
void setMeasure (Index newMeasure)
 Set the index of the current measure within the MIDI sequence. More...
 
Float getBeat () const
 Return the fractional number of time signature beats since the beginning of the measure. More...
 
void setBeat (Float newBeat)
 Set the fractional number of time signature beats since the beginning of the measure. More...
 

Detailed Description

A class that represents a musical position within a MIDI sequence.

This position is used for MIDI playback and sequencing, as well as synchronizing audio effects with MIDI data.

The MIDI time is represented by a tempo, measure index, time signature, and fractional number of beats since the beginning of the measure.

Constructor & Destructor Documentation

om::sound::base::MIDITime::MIDITime ( )
inline

Create a new default MIDI time object with the default tempo of 120 quarter notes per minute.

om::sound::base::MIDITime::MIDITime ( Float  newTempo,
Index  newMeasure,
Float  newBeat,
TimeSignature  newTimeSignature 
)
inline

Create a new MIDI Time object with the specified tempo, measure index, beat number, and time signature.

Member Function Documentation

Float om::sound::base::MIDITime::getTempo ( ) const
inline

Return the number of quarter notes per minutes for the current position in the MIDI sequence.

This value can be used to convert the beat value into a time in seconds.

void om::sound::base::MIDITime::setTempo ( Float  newTempo)
inline

Return the number of quarter notes per minutes for the current position in the MIDI sequence.

This value can be used to convert the beat value into a time in seconds.

The new tempo is clamped to be greater than or equal to 0.

Index om::sound::base::MIDITime::getMeasure ( ) const
inline

The index of the current measure within the MIDI sequence.

This value should not be used to compute the current time position within the MIDI sequence (along with the time signature and tempo), because the time signature and tempo may change throughout a given sequence, making a simple computation of the current time impossible given only the measure index.

void om::sound::base::MIDITime::setMeasure ( Index  newMeasure)
inline

Set the index of the current measure within the MIDI sequence.

This value should not be used to compute the current time position within the MIDI sequence (along with the time signature and tempo), because the time signature and tempo may change throughout a given sequence, making a simple computation of the current time impossible given only the measure index.

Float om::sound::base::MIDITime::getBeat ( ) const
inline

Return the fractional number of time signature beats since the beginning of the measure.

This value is represented in units of the time signature, so if the time signature is 6/8, the beat value can be in the range from 0 to 5.99999 and indicates the number of eigth notes since the start of the measure.

void om::sound::base::MIDITime::setBeat ( Float  newBeat)
inline

Set the fractional number of time signature beats since the beginning of the measure.

This value is represented in units of the time signature, so if the time signature is 6/8, the beat value can be in the range from 0 to 5.99999 and indicates the number of eigth notes since the start of the measure.

The new beat value is clamped to be greater than 0.


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