From 60015c1d4aff30a610dced9a565fc1a6cb292be2 Mon Sep 17 00:00:00 2001 From: Zefram Date: Mon, 24 Dec 2012 23:00:35 +0000 Subject: [PATCH] canonicalise notional octave of tonic 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lily/music.cc b/lily/music.cc index 7a38d7af41..be1fb2ed13 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -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")) -- 2.39.2