Skip to content

Commit

Permalink
Initial implementation for sesquialtera
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Oct 18, 2023
1 parent 526cb8f commit ac7bf23
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/durationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ double DurationInterface::GetInterfaceAlignmentMensuralDuration(int num, int num
LogWarning("No current mensur for calculating duration");
return DUR_MENSURAL_REF;
}

bool modusMaiorPerfectus = (currentMensur->GetModusmaior() != MODUSMAIOR_2);
bool modusMinorPerfectus = (currentMensur->GetModusminor() != MODUSMINOR_2);
bool tempusPerfectum = (currentMensur->GetTempus() != TEMPUS_2);
Expand All @@ -113,9 +113,9 @@ double DurationInterface::GetInterfaceAlignmentMensuralDuration(int num, int num
else if (this->GetDurQuality() == DURQUALITY_mensural_perfecta) {
if (((this->GetDur() == DURATION_longa) && !modusMinorPerfectus)
|| ((this->GetDur() == DURATION_brevis) && !tempusPerfectum)
|| ((this->GetDur() == DURATION_semibrevis) && !prolatioMaior)
|| (this->GetDur() == DURATION_minima) || (this->GetDur() == DURATION_semiminima)
|| (this->GetDur() == DURATION_fusa) || (this->GetDur() == DURATION_semifusa)) {
|| ((this->GetDur() == DURATION_semibrevis) && !prolatioMaior) || (this->GetDur() == DURATION_minima)
|| (this->GetDur() == DURATION_semiminima) || (this->GetDur() == DURATION_fusa)
|| (this->GetDur() == DURATION_semifusa)) {
num *= 2;
numBase *= 3;
}
Expand All @@ -138,8 +138,23 @@ double DurationInterface::GetInterfaceAlignmentMensuralDuration(int num, int num
} // Any other case (minor, perfecta in tempus perfectum, and imperfecta in tempus imperfectum) follows the
// mensuration and has no @num and @numbase attributes

if (currentMensur->HasNum()) num *= currentMensur->GetNum();
if (currentMensur->HasNumbase()) numBase *= currentMensur->GetNumbase();
if (!currentMensur->HasLevel()) {
if (currentMensur->HasNum()) num *= currentMensur->GetNum();
if (currentMensur->HasNumbase()) numBase *= currentMensur->GetNumbase();
}
else {
// Sesquialtera - we currently expect `@num` and `@numbase` to be given
// Applies to semibrevis (and shorter)
if ((currentMensur->GetLevel() == DURATION_semibrevis) && (this->GetDur() >= DURATION_semibrevis)) {
if (currentMensur->HasNum()) num *= currentMensur->GetNum();
if (currentMensur->HasNumbase()) numBase *= currentMensur->GetNumbase();
}
// Applies to minima (and shorter)
else if ((currentMensur->GetLevel() == DURATION_minima) && (this->GetDur() >= DURATION_minima)) {
if (currentMensur->HasNum()) num *= currentMensur->GetNum();
if (currentMensur->HasNumbase()) numBase *= currentMensur->GetNumbase();
}
}

double ratio = 0.0;
double duration = (double)DUR_MENSURAL_REF;
Expand Down

0 comments on commit ac7bf23

Please sign in to comment.