]> git.donarmstrong.com Git - lilypond.git/commitdiff
(process_music): use octavation
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 15 Apr 2003 23:34:16 +0000 (23:34 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 15 Apr 2003 23:34:16 +0000 (23:34 +0000)
(a number) instead of original-pitch to store inversions. This
fixes a problem with transposed chords with inversions.

ChangeLog
aclocal.m4
lily/event.cc
lily/new-chord-name-engraver.cc
lily/parser.yy
lily/relative-octave-music.cc
scm/chord-entry.scm
scm/music-property-description.scm

index 6762052362425e1122218f8ea029e56e757dbdfe..f3ef6fdd0d11dce47b0bbb26981987dad2b94327 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-04-16  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * lily/new-chord-name-engraver.cc (process_music): use octavation
+       (a number) instead of original-pitch to store inversions. This
+       fixes a problem with transposed chords with inversions.  
+
 2003-04-14  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * stepmake/aclocal.m4: Include compile fix for broken flex, as
index eae65025b5ff34d90f3fe1d6b11997b7e58124fc..c1f4aee49b10d9c10d00216ea41243e1b593a7ac 100644 (file)
@@ -1,4 +1,7 @@
 dnl aclocal.m4   -*-shell-script-*-
+dnl WARNING WARNING WARNING
+dnl do not edit! this is aclocal.m4, generated from /home/hanwen/usr/src/lilypond/stepmake/aclocal.m4
+dnl aclocal.m4   -*-shell-script-*-
 dnl StepMake subroutines for configure.in
 
 
index 944aa5417f9e756ea3ce9c8bdc0fe1167ddc8deb..fd86b435ef45b9ade9977882fe1433e086647c31 100644 (file)
@@ -33,6 +33,11 @@ Event::compress (Moment m)
 void
 Event::transpose (Pitch delta)
 {
+  /*
+    TODO: should change music representation such that
+    _all_ pitch values are transposed automatically.
+   */
+  
   Pitch *p = unsmob_pitch (get_mus_property ("pitch"));
   if (!p)
     return ;
index 00a7215e55efc3b9dfc6b9270efba74fd381b28e..65620defe69c2c00dfedef7d5fedfb07df5b4572 100644 (file)
@@ -65,7 +65,10 @@ New_chord_name_engraver::process_music ()
   for (int i =0 ; i < notes_.size (); i++)
     {
       Music *n = notes_[i];
-      SCM p = n->get_mus_property ("pitch");;
+      SCM p = n->get_mus_property ("pitch");
+      if (!unsmob_pitch (p))
+       continue;
+      
       if (n->get_mus_property ("inversion") == SCM_BOOL_T)
        {
          inversion_event = n;
@@ -79,9 +82,15 @@ New_chord_name_engraver::process_music ()
 
   if (inversion_event)
     {
-      SCM op = inversion_event->get_mus_property ("original-pitch");
-      if (unsmob_pitch (op))
-       pitches= gh_cons (op, pitches);
+      SCM oct = inversion_event->get_mus_property ("octavation");
+      if (gh_number_p (oct))
+       {
+         Pitch *p = unsmob_pitch (inversion_event->get_mus_property ("pitch"));
+         int octavation =  gh_scm2int (oct);
+         Pitch orig = p->transposed (Pitch (-octavation, 0,0));
+         
+         pitches= gh_cons (orig.smobbed_copy (), pitches);
+       }
       else
        programming_error ("Inversion does not have original pitch.");
     }
index f7f13c4eb0cdb11a59869cf57e0ff1fa6bcb7c58..2373c83d125e0802df1405762f29cec93589aa93 100644 (file)
@@ -1027,6 +1027,7 @@ relative_music:
                $$->set_mus_property ("element", p->self_scm ());
                scm_gc_unprotect_object (p->self_scm ());
 
+
                $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
 
        }
index b57f2a2ef68574f9a3d018655b98fc88e445bf16..ad2350fa39bdf337e71e58a3587d51762367dc40 100644 (file)
 Pitch
 Relative_octave_music::to_relative_octave (Pitch)
 {
+       /*
+               ugh: last-pitch should  be junked.
+
+               Change this for lilypond 2.0. When you do,
+               then B should start where A left off.
+
+               \relative { A \relative { ...} B }
+
+               */
+
   return * unsmob_pitch (get_mus_property ("last-pitch"));
 }
 
index 52643961ba655f5cb9c2ec177ce3976651713f6d..7c9bbfe8398faa0430e2f66dfd69aec63b2995f2 100644 (file)
@@ -244,7 +244,10 @@ DURATION, and INVERSION."
     (if inv-note
        (begin
          (ly:set-mus-property! inv-note 'inversion #t)
-         (ly:set-mus-property! inv-note 'original-pitch original-inv-pitch)
+         (ly:set-mus-property! inv-note 'octavation
+                               (- (ly:pitch-octave inversion)
+                                  (ly:pitch-octave original-inv-pitch))
+                               )
          (set! nots (cons inv-note nots))))
     
     (make-event-chord nots)
index cc43d7d1063e82b9aa7b55b7de915918de36d124..8f04d64b966bbdc866c0ac77ed3c4bb6affe3e4c 100644 (file)
@@ -58,8 +58,9 @@ TODO: consider making type into symbol ")
 (music-property-description 'name symbol? "Name of this music object")
 (music-property-description 'numerator integer? "numerator of a time signature")
 (music-property-description 'once boolean? "Apply this operation only during one time step?")
-(music-property-description 'original-pitch  ly:pitch?
-                           "Pitch before inversion. Needed to reconstruct chord name.")
+(music-property-description 'octavation  integer?
+                           "This pitch was octavated by how many octaves?
+For chord inversions, this is negative.")
 (music-property-description 'origin ly:input-location? "where was this piece of music defined?")
 (music-property-description 'penalty number? "Penalty for break hint.")
 (music-property-description 'pitch ly:pitch? "the pitch of this note")