>From 543110c4135c36208c8d3db2e326f635595028ff 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 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lily/music.cc b/lily/music.cc index 7a38d7a..be1fb2e 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")) -- 1.7.2.5