Skip to content

Commit

Permalink
Fix tempo change handling with sections
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Nov 24, 2024
1 parent 679e49b commit 745e5b7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
5 changes: 5 additions & 0 deletions include/vrv/doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ class Doc : public Object {
*/
void Reset() override;

/**
*
*/
void ResetToLoading();

/**
* Clear the selection pages.
*/
Expand Down
9 changes: 9 additions & 0 deletions src/doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ void Doc::Reset()
m_back.reset();
}

void Doc::ResetToLoading()
{
if (m_currentScoreDefDone) {
ScoreDefUnsetCurrentFunctor scoreDefUnsetCurrent;
this->Process(scoreDefUnsetCurrent);
m_currentScoreDefDone = false;
}
}

void Doc::ClearSelectionPages()
{
if (m_selectionPreceding) {
Expand Down
10 changes: 6 additions & 4 deletions src/iocmme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ void CmmeInput::PostProcessProport()
for (Object *object : proports) {
Proport *proport = vrv_cast<Proport *>(object);
assert(proport);
// Not a potential tempo change, or already processed
if (proport->GetType() != "cmme_tempo_change?") continue;
// Not a potential reset, or already processed
if (proport->GetType() != "reset?") continue;
// Default type for tempo changes
std::string propType = "cmme_tempo_change";
proport->SetType(propType);
Expand Down Expand Up @@ -233,6 +233,8 @@ void CmmeInput::PostProcessProport()
}
}

m_doc->ResetToLoading();

m_doc->ResetDataPage();
}

Expand Down Expand Up @@ -923,8 +925,8 @@ void CmmeInput::CreateMensuration(pugi::xml_node mensurationNode)
if (denVal != VRV_UNSET) {
proport->SetNumbase(denVal);
}
// Mark them as potential tempo changes
proport->SetType("cmme_tempo_change?");
// Mark them as potential tempo changes (i.e., reset)
proport->SetType("reset?");
m_currentContainer->AddChild(proport);
m_activeTempoChange = true;
}
Expand Down
5 changes: 4 additions & 1 deletion src/proport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ int Proport::GetCumulatedNumbase() const

void Proport::Cumulate(const Proport *proport)
{
// Unset values are not cumulated
// Reset type proportion - do not cumulate
if (this->GetType() == "reset") return;
// Potential reset (tempo change) in CMME - do not cumulate
if (this->GetType() == "reset?") return;

// Unset values are not cumulated
if (proport->HasNum() && this->HasNum()) {
m_cumulatedNum = this->GetNum() * proport->GetCumulatedNum();
}
Expand Down

0 comments on commit 745e5b7

Please sign in to comment.