maiacore 1.10.1
Music analisys library
TimeSignature Class Reference

Represents a musical time signature (meter) for a measure. More...

#include <time-signature.h>

Public Member Functions

 TimeSignature (const int timeUpper=4, const int timeLower=4)
 Constructs a TimeSignature with specified upper and lower values. More...
 
int getUpperValue () const
 Returns the upper value (numerator) of the time signature. More...
 
int getLowerValue () const
 Returns the lower value (denominator) of the time signature. More...
 
void setUpperValue (int upperValue)
 Sets the upper value (numerator) of the time signature. More...
 
void setLowerValue (int lowerValue)
 Sets the lower value (denominator) of the time signature. More...
 
METRIC getMetric () const
 Returns the metric type of the time signature (simple, compound, or irregular). More...
 
const std::string getMetricAsString () const
 Returns the metric type as a string ("SIMPLE", "COMPOUND", "IRREGULAR"). More...
 

Detailed Description

Represents a musical time signature (meter) for a measure.

The TimeSignature class provides methods for setting and querying the upper and lower values of the time signature, as well as determining the metric type (simple, compound, or complex). It is designed for music analysis, computational musicology, and MusicXML processing.

Constructor & Destructor Documentation

◆ TimeSignature()

TimeSignature::TimeSignature ( const int  timeUpper = 4,
const int  timeLower = 4 
)

Constructs a TimeSignature with specified upper and lower values.

Parameters
timeUpperNumerator of the time signature (default: 4).
timeLowerDenominator of the time signature (default: 4).

Member Function Documentation

◆ getLowerValue()

int TimeSignature::getLowerValue ( ) const

Returns the lower value (denominator) of the time signature.

Returns
Integer representing the denominator.

◆ getMetric()

METRIC TimeSignature::getMetric ( ) const

Returns the metric type of the time signature (simple, compound, or irregular).

Simple: 2/4, 3/4, 4/4, 2/8, 3/8, 4/8, etc.; Compound: 6/8, 9/8, 12/8, 6/4, 9/4, 15/16, etc.; Irregular: 5/4, 7/8, 11/8, 13/8, etc.

Returns
METRIC enum value.

◆ getMetricAsString()

const std::string TimeSignature::getMetricAsString ( ) const

Returns the metric type as a string ("SIMPLE", "COMPOUND", "IRREGULAR").

Returns
String representation of the metric type.

◆ getUpperValue()

int TimeSignature::getUpperValue ( ) const

Returns the upper value (numerator) of the time signature.

Returns
Integer representing the numerator.

◆ setLowerValue()

void TimeSignature::setLowerValue ( int  lowerValue)

Sets the lower value (denominator) of the time signature.

Parameters
lowerValueNew denominator value.

◆ setUpperValue()

void TimeSignature::setUpperValue ( int  upperValue)

Sets the upper value (numerator) of the time signature.

Parameters
upperValueNew numerator value.

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