lilypond-devel
[Top][All Lists]
Advanced

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

canonicalise notional octave of tonic (issue 7019045)


From: pkx166h
Subject: canonicalise notional octave of tonic (issue 7019045)
Date: Wed, 26 Dec 2012 21:31:14 +0000

Reviewers: zefram_fysh.org,

Message:
Patch submitted on behalf of address@hidden

Description:
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.

Please review this at https://codereview.appspot.com/7019045/

Affected files:
  M lily/music.cc


Index: lily/music.cc
diff --git a/lily/music.cc b/lily/music.cc
index 7a38d7af41d84851151b65e2c5bcbdaa4cc4e010..be1fb2ed131cb0451ab4e373db8e46d52dd9982a 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"))





reply via email to

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