]> git.donarmstrong.com Git - lilypond.git/commitdiff
canonicalise notional octave of tonic
authorZefram <zefram@fysh.org>
Mon, 24 Dec 2012 23:00:35 +0000 (23:00 +0000)
committerJames Lowe <pkx166h@gmail.com>
Tue, 1 Jan 2013 12:02:48 +0000 (12:02 +0000)
Nothing deliberately looks at the octave part of the pitch object storing
the tonic of a key-change event; it's not really a meaningful concept.
But comparison with equal? sees the octave, so internal_event_assignment()
reckoned two key changes differing only in this meaningless field to
be different, and therefore not permitted to occur at the same time.
This triggered false warnings of "two simultaneous key-change events"
when two instruments sharing a staff differ in the transposition used
in their music source.

To fix this, always set the octave part of the tonic pitch to the
same value.  This is done when transposing, and since \key operates by
invoking transposition this is the only place that needs to canonicalise.
The canonical octave is number -1; that is, the octave obtained by a
note name with no octave suffix, and so the octave that most commonly
occurred under the non-canonicalising system.

lily/music.cc

index 7a38d7af41d84851151b65e2c5bcbdaa4cc4e010..be1fb2ed131cb0451ab4e373db8e46d52dd9982a 100644 (file)
@@ -226,6 +226,10 @@ transpose_mutable (SCM alist, Pitch delta)
               transposed = transposed.normalized ();
             }
 
+          if (prop == ly_symbol2scm ("tonic"))
+            transposed = Pitch (-1, transposed.get_notename (),
+                                transposed.get_alteration ());
+
           new_val = transposed.smobbed_copy ();
         }
       else if (prop == ly_symbol2scm ("element"))