Show three-quater notes correctly when showing note lengths is enabled

Not sure how these kinds of notes are officially called; this change is
actually just using a dotted half-note. Note that without this change such
notes would actually be displayed as whole note which would be wrong.
This commit is contained in:
Martchus 2024-01-21 23:03:10 +01:00
parent 568ee40c1b
commit 4dc5d6c887
4 changed files with 34 additions and 1 deletions

View File

@ -388,7 +388,7 @@ bool CDraw::drawNote(CSymbol* symbol, float x, float y, CSlot* slot, CColor colo
if (symbol->getType() <= PB_SYMBOL_crotchet)
solidNoteHead = true;
if (symbol->getType() <= PB_SYMBOL_minim)
if (symbol->getType() <= PB_SYMBOL_threequater)
showNoteStem = true;
if (showNoteStem)
@ -451,6 +451,34 @@ bool CDraw::drawNote(CSymbol* symbol, float x, float y, CSlot* slot, CColor colo
glEnd();
}
// draw a circle after the half note to make it a three-quater note
if (symbol->getType() == PB_SYMBOL_threequater) {
static constexpr auto radius = 4.0f;
x += 15.0f;
glBegin(GL_POLYGON);
glVertex2f(1.0f * radius + x, 0.0f * radius + y);
glVertex2f(0.951057f * radius + x, 0.309017f * radius + y);
glVertex2f(0.809017f * radius + x, 0.587785f * radius + y);
glVertex2f(0.587785f * radius + x, 0.809017f * radius + y);
glVertex2f(0.309017f * radius + x, 0.951057f * radius + y);
glVertex2f(6.12323e-17f * radius + x, 1.0f * radius + y);
glVertex2f(-0.309017f * radius + x, 0.951056f * radius + y);
glVertex2f(-0.587785f * radius + x, 0.809017f * radius + y);
glVertex2f(-0.809017f * radius + x, 0.587785f * radius + y);
glVertex2f(-0.951057f * radius + x, 0.309017f * radius + y);
glVertex2f(-1.0f * radius + x, -3.74507e-07f * radius + y);
glVertex2f(-0.951056f * radius + x, -0.309017f * radius + y);
glVertex2f(-0.809017f * radius + x, -0.587786f * radius + y);
glVertex2f(-0.587785f * radius + x, -0.809017f * radius + y);
glVertex2f(-0.309016f * radius + x, -0.951057f * radius + y);
glVertex2f(7.49014e-07f * radius + x, -1.0f * radius + y);
glVertex2f(0.309018f * radius + x, -0.951056f * radius + y);
glVertex2f(0.587786f * radius + x, -0.809016f * radius + y);
glVertex2f(0.809018f * radius + x, -0.587784f * radius + y);
glVertex2f(0.951057f * radius + x, -0.309016f * radius + y);
glEnd();
}
checkAccidental(*symbol, x, y);
return playable;

View File

@ -202,6 +202,7 @@ void CNotation::setupNotationParamaters()
cfg_param[NOTATE_quaverBoundary] = CMidiFile::ppqnAdjust(DEFAULT_PPQN/2 + 10);
cfg_param[NOTATE_crotchetBoundary] = CMidiFile::ppqnAdjust(DEFAULT_PPQN + 10);
cfg_param[NOTATE_minimBoundary] = CMidiFile::ppqnAdjust(DEFAULT_PPQN*2 + 10);
cfg_param[NOTATE_threequaterBoundary]= CMidiFile::ppqnAdjust(DEFAULT_PPQN*3 + 10);
cfg_param[NOTATE_semibreveBoundary] = CMidiFile::ppqnAdjust(DEFAULT_PPQN*4 + 10);
}
@ -230,6 +231,8 @@ void CNotation::calculateScoreNoteLength()
symbol->setNoteLength(PB_SYMBOL_crotchet);
else if (midiDuration < cfg_param[NOTATE_minimBoundary] )
symbol->setNoteLength(PB_SYMBOL_minim);
else if (midiDuration < cfg_param[NOTATE_threequaterBoundary] )
symbol->setNoteLength(PB_SYMBOL_threequater);
else
symbol->setNoteLength(PB_SYMBOL_semibreve);
}

View File

@ -163,6 +163,7 @@ enum {
NOTATE_quaverBoundary, // Quaver / Eighth note
NOTATE_crotchetBoundary, // Crotchet / Quarter note
NOTATE_minimBoundary, // Minim / Half note
NOTATE_threequaterBoundary, // Three-quater note (half note with dot)
NOTATE_semibreveBoundary, // Semibreve / Whole note
NOTATE_breveBoundary, // Breve / Double whole note
NOTATE_MAX_PARAMS // == MUST BE LAST ===

View File

@ -54,6 +54,7 @@ typedef enum
PB_SYMBOL_quaver, // Quaver / Eighth note
PB_SYMBOL_crotchet, // Crotchet / Quarter note
PB_SYMBOL_minim, // Minim / Half note
PB_SYMBOL_threequater, // Three-quater note
PB_SYMBOL_semibreve, // Semibreve / Whole note
PB_SYMBOL_breve, // Breve / Double whole note