From 3c4bf6eeb6e8c3921fecba0addd06dbc5899a7bb Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sat, 14 Mar 2009 23:03:29 +0000 Subject: [PATCH] Further sanity checks against bad triplets --- Sources/VLModel.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Sources/VLModel.cpp b/Sources/VLModel.cpp index 3e7b026..a7f2ee4 100644 --- a/Sources/VLModel.cpp +++ b/Sources/VLModel.cpp @@ -460,7 +460,9 @@ void VLMeasure::DecomposeNotes(const VLProperties & prop, VLNoteList & decompose // Prefer further triplets // if (prevTriplets) { - if (p.fDuration >= 2*prevTripDur) { + if (p.fDuration > 3*prevTripDur) { + ; // Not part of triplets + } else if (p.fDuration >= 2*prevTripDur) { p.fDuration = 2*prevTripDur; if (prevTriplets == 1) { p.fVisual = prevVisual-1; @@ -539,7 +541,10 @@ void VLMeasure::DecomposeNotes(const VLProperties & prop, VLNoteList & decompose } else if ((at % p.fDuration != 0) || (p.fDuration != c.fDuration && 2*p.fDuration != c.fDuration) - ) { + || (n!=e && n->fDuration != c.fDuration + && n->fDuration != 2*c.fDuration + && 2*n->fDuration != c.fDuration) + ) { // // Get rid of awkward triplets // @@ -1204,10 +1209,11 @@ static VLNoteList Realign(const VLNoteList & notes, } at += n.fDuration; } - if (lastAt == at) + if (lastAt == at) { alignedNotes.pop_back(); - else + } else { alignedNotes.back().fDuration = at-lastAt; + } return alignedNotes; } else