fix #252201: playback holds during section break

This commit is contained in:
Peter Jonas 2018-03-22 05:49:11 +00:00
parent 2803c7d827
commit 858cb5d852
4 changed files with 16 additions and 11 deletions

View file

@ -2362,7 +2362,7 @@ void Score::getNextMeasure(LayoutContext& lc)
// implement section break rest // implement section break rest
// //
if (measure->sectionBreak() && measure->pause() != 0.0) if (measure->sectionBreak() && measure->pause() != 0.0)
setPause(measure->endTick()-1, measure->pause()); setPause(measure->endTick(), measure->pause());
// //
// calculate accidentals and note lines, // calculate accidentals and note lines,

View file

@ -178,7 +178,7 @@ void MeasureBase::remove(Element* el)
break; break;
case LayoutBreak::SECTION: case LayoutBreak::SECTION:
setSectionBreak(false); setSectionBreak(false);
score()->setPause(endTick()-1, 0); score()->setPause(endTick(), 0);
score()->setLayoutAll(); score()->setLayoutAll();
break; break;
case LayoutBreak::NOBREAK: case LayoutBreak::NOBREAK:

View file

@ -395,7 +395,7 @@ void Score::fixTicks()
// implement section break rest // implement section break rest
// //
if (isMaster() && m->sectionBreak() && m->pause() != 0.0) if (isMaster() && m->sectionBreak() && m->pause() != 0.0)
setPause(m->tick() + m->ticks() - 1, m->pause()); setPause(m->tick() + m->ticks(), m->pause());
// //
// implement fermata as a tempo change // implement fermata as a tempo change

View file

@ -344,22 +344,27 @@ void ExportMidi::PauseMap::calculate(const Score* s)
int tickOffset = rs->utick - rs->tick; int tickOffset = rs->utick - rs->tick;
auto se = tempomap->lower_bound(startTick); auto se = tempomap->lower_bound(startTick);
auto ee = tempomap->lower_bound(endTick); auto ee = tempomap->lower_bound(endTick+1); // +1 to include first tick of next RepeatSegment
for (auto it = se; it != ee; ++it) { for (auto it = se; it != ee; ++it) {
int tick = it->first; int tick = it->first;
int utick = tick + tickOffset; int utick = tick + tickOffset;
if (it->second.pause == 0.0) { if (it->second.pause == 0.0) {
tempomapWithPauses->insert(std::pair<const int, TEvent> (this->addPauseTicks(utick), it->second)); // We have a regular tempo change. Don't include tempo change from first tick of next RepeatSegment (it will be included later).
if (tick != endTick)
tempomapWithPauses->insert(std::pair<const int, TEvent> (this->addPauseTicks(utick), it->second));
} }
else { else {
Fraction timeSig(sigmap->timesig(tick).timesig()); // We have a pause event. Don't include pauses from first tick of current RepeatSegment (it was included in the previous one).
qreal quarterNotesPerMeasure = (4.0 * timeSig.numerator()) / timeSig.denominator(); if (tick != startTick) {
int ticksPerMeasure = quarterNotesPerMeasure * MScore::division; // store a full measure of ticks to keep barlines in same places Fraction timeSig(sigmap->timesig(tick).timesig());
tempomapWithPauses->setTempo(this->addPauseTicks(utick), quarterNotesPerMeasure / it->second.pause); // new tempo for pause qreal quarterNotesPerMeasure = (4.0 * timeSig.numerator()) / timeSig.denominator();
this->insert(std::pair<const int, int> (utick, ticksPerMeasure + this->offsetAtUTick(utick))); // store running total of extra ticks int ticksPerMeasure = quarterNotesPerMeasure * MScore::division; // store a full measure of ticks to keep barlines in same places
tempomapWithPauses->setTempo(this->addPauseTicks(utick), it->second.tempo); // restore previous tempo tempomapWithPauses->setTempo(this->addPauseTicks(utick), quarterNotesPerMeasure / it->second.pause); // new tempo for pause
this->insert(std::pair<const int, int> (utick, ticksPerMeasure + this->offsetAtUTick(utick))); // store running total of extra ticks
tempomapWithPauses->setTempo(this->addPauseTicks(utick), it->second.tempo); // restore previous tempo
}
} }
} }
} }