mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Fix skipping of rests in pickup measures
This commit is contained in:
parent
23ced3e860
commit
0cd0effb46
|
@ -50,8 +50,10 @@ void VLLilypondWriter::VisitMeasure(size_t m, VLProperties & p, VLMeasure & meas
|
||||||
measNo[0] = 0;
|
measNo[0] = 0;
|
||||||
|
|
||||||
fUseSharps = p.fKey > 0;
|
fUseSharps = p.fKey > 0;
|
||||||
if (fInPickup && !m && meas.NoChords())
|
fInPickup = fInPickup && !m && meas.NoChords();
|
||||||
|
if (fInPickup)
|
||||||
++fPrevBreak;
|
++fPrevBreak;
|
||||||
|
fInPickup = fInPickup && meas.CanSkipRests();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generate chords
|
// Generate chords
|
||||||
|
@ -251,7 +253,7 @@ void VLLilypondWriter::VisitNote(VLLyricsNote & n)
|
||||||
for (int commas = -1-octave; commas>0; --commas)
|
for (int commas = -1-octave; commas>0; --commas)
|
||||||
nm += ',';
|
nm += ',';
|
||||||
fInPickup = false;
|
fInPickup = false;
|
||||||
} else if (fInPickup) {
|
} else if (fInPickup && n.fDuration.IsPowerOfTwo()) {
|
||||||
nm = "s";
|
nm = "s";
|
||||||
}
|
}
|
||||||
const char * space = fAccum.size() ? " " : "";
|
const char * space = fAccum.size() ? " " : "";
|
||||||
|
|
|
@ -222,6 +222,22 @@ bool VLMeasure::NoChords() const
|
||||||
&& fChords.front().fPitch == VLNote::kNoPitch;
|
&& fChords.front().fPitch == VLNote::kNoPitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VLMeasure::CanSkipRests() const
|
||||||
|
{
|
||||||
|
VLFraction restDur(0);
|
||||||
|
VLFraction totalDur(0);
|
||||||
|
bool initialRest = true;
|
||||||
|
|
||||||
|
for (VLNoteList::const_iterator n = fMelody.begin(); n != fMelody.end(); ++n) {
|
||||||
|
if (n->fPitch != VLNote::kNoPitch)
|
||||||
|
initialRest = false;
|
||||||
|
totalDur += n->fDuration;
|
||||||
|
if (initialRest)
|
||||||
|
restDur += n->fDuration;
|
||||||
|
}
|
||||||
|
return 2*restDur >= totalDur;
|
||||||
|
}
|
||||||
|
|
||||||
void VLMeasure::DecomposeNotes(const VLProperties & prop, VLNoteList & decomposed) const
|
void VLMeasure::DecomposeNotes(const VLProperties & prop, VLNoteList & decomposed) const
|
||||||
{
|
{
|
||||||
decomposed.clear();
|
decomposed.clear();
|
||||||
|
|
|
@ -341,6 +341,7 @@ struct VLMeasure {
|
||||||
|
|
||||||
bool IsEmpty() const;
|
bool IsEmpty() const;
|
||||||
bool NoChords() const;
|
bool NoChords() const;
|
||||||
|
bool CanSkipRests() const;
|
||||||
|
|
||||||
void DecomposeNotes(const VLProperties & prop, VLNoteList & decomposed) const;
|
void DecomposeNotes(const VLProperties & prop, VLNoteList & decomposed) const;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user