lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accidental restore bug


From: Rune Zedeler
Subject: Accidental restore bug
Date: Mon, 17 Sep 2007 19:29:58 +0200
User-agent: Thunderbird 1.5.0.13 (X11/20070824)

This msg. is crossposted to bug and devel.
Please follow-up to only one of the lists.

In latest git, the score-function of Accidental_result looks like the following:

  int score () const {
    return need_acc ? 1 : 0
      + need_restore ? 1 : 0;
  }

The intention is clearly to sum the number of true booleans: 0 if none of them are true, 1 if one of them is true, and 2 if both are true.
Iow, the intended behaviour is

return (need_acc ? 1 : 0)
      + (need_restore ? 1 : 0);

Unfortunately this is not what happens. "+" binds tighter than ":". So what we get is

    return need_acc ? 1 : (0 + need_restore ? 1 : 0);

The function cannot return 2.

This is related to a very old discussion of what to typeset if the cautionary-rule wants to typeset an accidental-restore and a accidental whereas the accidental-ryle wants to typeset only one accidental.
E.g.

 {
    #(set-accidental-style 'modern-cautionary)
    \set Staff.extraNatural = ##t
    cisis'1 | cis'1
  }

What accidental to typeset in front of the cis?
The cautionary rule remembers the cisis from previous measure and therefore wants to typeset an extra reminder:

(x)O   | (n#)O   |

(x is a double sharp, n is a natural, O is a whole note)

The accidental rule does not remember the previous measure and therefore only wants to typeset the sharp:

xO     | #O      |

In 2.10 the logic said that the rule who wanted to typeset the larger number of accidentals won. Therefore, because the cautionary rule wanted to typeset the most, it won, and the resulting output was:

xO     | (n#)O   |

In 2.11 the logic still says that the rule who wants to typeset the larger number of accidentals wins. Unfortunately it is the buggy function above that is used to decide this, and therefore it is not realized that the cautionary rule wants to typeset more accidentals than the accidental rule. In case of a tie, the accidental rule wins, so in current git, the output is

xO     | #O     |

Both results (2.10 result and 2.11 result) are IMO very unfortunate. In 1.10 the accidental is typeset as a cautionary even though it is a real accidental, whereas in the 2.11 version we do not get the cautionary cancelling of the double sharp.

When I wrote the accidental code back in 2001 my intention was, that the only sensible thing to do in this case would be to output

xO     | (n)#O     |

and I implemented it that way.
But, alas, this small part of my patch was rejected, and the problem was never really solved in another way.

The current behaviour is the result of a bug in a function, not of a decision of what to do. I still think that we should do the (n)#O. I think this clearly represents that the x cautionally needs to be cancelled whereas the # is real.

Comments?

-Rune




reply via email to

[Prev in Thread] Current Thread [Next in Thread]