Preserve noteheads

This commit is contained in:
Matthias Neeracher 2011-08-31 04:02:10 +02:00
parent ed4a80c26e
commit 424a40bd07

View File

@ -82,9 +82,8 @@ static inline int8_t StepToSemi(int step)
uint16_t VLPitchAccidental(int8_t pitch, uint16_t visual, int key) uint16_t VLPitchAccidental(int8_t pitch, uint16_t visual, int key)
{ {
int semi = pitch % 12; int semi = pitch % 12;
if (visual & VLNote::kAccidentalsMask) {
if ((visual &= VLNote::kAccidentalsMask)) {
// //
// The user expressed a preference, try to match it // The user expressed a preference, try to match it
// //
@ -118,13 +117,13 @@ uint16_t VLPitchAccidental(int8_t pitch, uint16_t visual, int key)
// //
// No visuals, or no match // No visuals, or no match
// //
if (IsBasicNote(semi)) { visual &= ~VLNote::kAccidentalsMask;
return VLNote::kWantNatural; if (IsBasicNote(semi))
} else if (key <= 0) { return visual | VLNote::kWantNatural;
return VLNote::kWantFlat; else if (key <= 0)
} else { return visual | VLNote::kWantFlat;
return VLNote::kWantSharp; else
} return visual | VLNote::kWantSharp;
} }
int VLPitchToGrid(int8_t pitch, uint16_t visual, int key) int VLPitchToGrid(int8_t pitch, uint16_t visual, int key)
@ -239,16 +238,16 @@ void VLVisualFilter::ResetWithKey(int key)
uint16_t VLVisualFilter::operator()(int gridPos, uint16_t visual) uint16_t VLVisualFilter::operator()(int gridPos, uint16_t visual)
{ {
gridPos = (gridPos+700) % 7; uint16_t acc = visual & VLNote::kAccidentalsMask;
visual &= VLNote::kAccidentalsMask; gridPos = (gridPos+700) % 7;
if (visual == VLNote::kWantNatural) if (acc == VLNote::kWantNatural)
visual = 0; acc = 0;
if (visual != fState[gridPos]) { if (acc != fState[gridPos]) {
fState[gridPos] = visual; fState[gridPos] = acc;
if (!visual) if (!acc)
visual = VLNote::kWantNatural; acc = VLNote::kWantNatural;
} else { } else {
visual = 0; acc = 0;
} }
return visual; return (visual & ~VLNote::kAccidentalsMask) | acc;
} }