From d90deb7a13fb8bac3fca17dac0e2f3f21f383190 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 18 Oct 2023 15:34:52 +0200 Subject: [PATCH] Add variables in mensural duration calculation --- src/durationinterface.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/durationinterface.cpp b/src/durationinterface.cpp index 27c4ec698e0..8ebdb337d98 100644 --- a/src/durationinterface.cpp +++ b/src/durationinterface.cpp @@ -99,6 +99,11 @@ 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); + bool prolatioMaior = (currentMensur->GetProlatio() != PROLATIO_2); if (this->HasNum() || this->HasNumbase()) { if (this->HasNum()) num *= this->GetNum(); @@ -106,9 +111,9 @@ double DurationInterface::GetInterfaceAlignmentMensuralDuration(int num, int num } // perfecta in imperfect mensuration (two perfectas in the place of the original three imperfectas) else if (this->GetDurQuality() == DURQUALITY_mensural_perfecta) { - if (((this->GetDur() == DURATION_longa) && (currentMensur->GetModusminor() == MODUSMINOR_2)) - || ((this->GetDur() == DURATION_brevis) && (currentMensur->GetTempus() == TEMPUS_2)) - || ((this->GetDur() == DURATION_semibrevis) && (currentMensur->GetProlatio() == PROLATIO_2)) + 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)) { num *= 2; @@ -117,9 +122,9 @@ double DurationInterface::GetInterfaceAlignmentMensuralDuration(int num, int num } // imperfecta in perfect mensuration (three imperfectas in the place of the two original perfectas) else if (this->GetDurQuality() == DURQUALITY_mensural_imperfecta) { - if (((this->GetDur() == DURATION_longa) && (currentMensur->GetModusminor() != MODUSMINOR_2)) - || ((this->GetDur() == DURATION_brevis) && (currentMensur->GetTempus() != TEMPUS_2)) - || ((this->GetDur() == DURATION_semibrevis) && (currentMensur->GetProlatio() != PROLATIO_2))) { + if (((this->GetDur() == DURATION_longa) && modusMinorPerfectus) + || ((this->GetDur() == DURATION_brevis) && tempusPerfectum) + || ((this->GetDur() == DURATION_semibrevis) && prolatioMaior)) { num *= 3; numBase *= 2; }