Add comment. Fix GetNoteRowsPerMeasure() returning note rows per beat.
This commit is contained in:
@@ -44,6 +44,9 @@ struct StopSegment
|
|||||||
bool operator<( const StopSegment &other ) const { return m_iStartRow < other.m_iStartRow; }
|
bool operator<( const StopSegment &other ) const { return m_iStartRow < other.m_iStartRow; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* This only supports simple time signatures. The upper number (called the numerator here, though this isn't
|
||||||
|
* properly a fraction) is the number of beats per measure. The lower number (denominator here)
|
||||||
|
* the the note value representing one beat. */
|
||||||
struct TimeSignatureSegment
|
struct TimeSignatureSegment
|
||||||
{
|
{
|
||||||
TimeSignatureSegment() : m_iStartRow(-1), m_iNumerator(4), m_iDenominator(4) { }
|
TimeSignatureSegment() : m_iStartRow(-1), m_iNumerator(4), m_iDenominator(4) { }
|
||||||
@@ -51,7 +54,12 @@ struct TimeSignatureSegment
|
|||||||
int m_iNumerator;
|
int m_iNumerator;
|
||||||
int m_iDenominator;
|
int m_iDenominator;
|
||||||
|
|
||||||
int GetNoteRowsPerMeasure() const { return (BeatToNoteRow(1) * 4) / m_iDenominator; }
|
/* With BeatToNoteRow(1) rows per beat, then we should have BeatToNoteRow(1)*m_iNumerator
|
||||||
|
* beats per measure. But if we assume that every BeatToNoteRow(1) rows is a quarter note,
|
||||||
|
* and we want the beats to be 1/m_iDenominator notes, then we should have
|
||||||
|
* BeatToNoteRow(1)*4 is rows per whole note and thus BeatToNoteRow(1)*4/m_iDenominator is
|
||||||
|
* rows per beat. Multiplying by m_iNumerator gives rows per measure. */
|
||||||
|
int GetNoteRowsPerMeasure() const { return BeatToNoteRow(1) * 4 * m_iNumerator / m_iDenominator; }
|
||||||
|
|
||||||
bool operator==( const TimeSignatureSegment &other ) const
|
bool operator==( const TimeSignatureSegment &other ) const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user