Skip to content

Commit

Permalink
fix #24852: ignore inactive segments (TimeTick) when calculating ferm…
Browse files Browse the repository at this point in the history
…ata duration
  • Loading branch information
RomanPudashkin committed Sep 26, 2024
1 parent 4558ed6 commit 2058077
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/engraving/dom/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,20 +579,26 @@ void Score::rebuildTempoAndTimeSigMaps(Measure* measure, std::optional<BeatsPerS
}
}
}
if (!RealIsNull(stretch) && !RealIsNull(stretch)) {

if (!RealIsNull(stretch) && !RealIsEqual(stretch, 1.0)) {
BeatsPerSecond otempo = tempomap()->tempo(segment.tick().ticks());
BeatsPerSecond ntempo = otempo.val / stretch;
tempomap()->setTempo(segment.tick().ticks(), ntempo);

Fraction currentSegmentEndTick;
Fraction tempoEndTick;

const Segment* nextActiveSegment = segment.next1();
while (nextActiveSegment && !nextActiveSegment->isActive()) {
nextActiveSegment = nextActiveSegment->next1();
}

if (segment.next1()) {
currentSegmentEndTick = segment.next1()->tick();
if (nextActiveSegment) {
tempoEndTick = nextActiveSegment->tick();
} else {
currentSegmentEndTick = segment.tick() + segment.ticks();
tempoEndTick = segment.tick() + segment.ticks();
}

Fraction etick = currentSegmentEndTick - Fraction(1, 480 * 4);
Fraction etick = tempoEndTick - Fraction(1, 480 * 4);
auto e = tempomap()->find(etick.ticks());
if (e == tempomap()->end()) {
tempomap()->setTempo(etick.ticks(), otempo);
Expand Down

0 comments on commit 2058077

Please sign in to comment.