]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/chord.cc
release: 1.5.7
[lilypond.git] / lily / chord.cc
index 2aa4b0532eba2cae3b9bd43a6061908d0e4236fe..233c5722d24e8f87d88227f257a56c85d6196b3f 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1999--2000 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c)  1999--2001 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "chord.hh"
@@ -152,6 +152,8 @@ Chord::member_notename (SCM p, SCM pitches)
            }
        }
     }
+  else
+    member = gh_car (member);
   return member;
 }
 
@@ -175,6 +177,8 @@ Chord::member_pitch (SCM p, SCM pitches)
            }
        }
     }
+  else
+    member = gh_car (member);
   return member;
 }
 
@@ -185,7 +189,7 @@ Chord::step_scm (SCM tonic, SCM p)
   int i = unsmob_pitch (p)->notename_i_
     - unsmob_pitch (tonic)->notename_i_
     + (unsmob_pitch (p)->octave_i_
-       - unsmob_pitch (tonic)->octave_i_ ) * 7;
+       - unsmob_pitch (tonic)->octave_i_) * 7;
   while (i < 0)
     i += 7;
   i++;
@@ -294,6 +298,10 @@ Chord::tonic_add_sub_to_pitches (SCM tonic, SCM add, SCM sub)
   for (SCM i = add; gh_pair_p (i); i = gh_cdr (i))
     {
       Pitch* p = unsmob_pitch (gh_car (i));
+      /* Ugr
+       This chord modifier stuff should really be fixed
+       Cmaj7 yields C 7/7-
+      */
       if (p->octave_i ()  == -100)
         {
           p->octave_i_ = 0;
@@ -318,7 +326,10 @@ Chord::tonic_add_sub_to_pitches (SCM tonic, SCM add, SCM sub)
   if (highest_step < 5)
     tmp = ly_snoc (fifth, tmp);
   else if (dim_b)
-    add = lower_step (tonic, add, gh_int2scm (5));
+    {
+      add = lower_step (tonic, add, gh_int2scm (5));
+      add = lower_step (tonic, add, gh_int2scm (7));
+    }
 
   /* find missing thirds */
   SCM missing = missing_thirds (tmp);
@@ -388,7 +399,7 @@ Chord::get_chord (SCM tonic, SCM add, SCM sub, SCM inversion, SCM bass, SCM dur)
          n->set_mus_property ("duration", dur);
          n->set_mus_property ("inversion", SCM_BOOL_T);
          list = gh_cons (n->self_scm (), list);
-         scm_unprotect_object (n->self_scm ());
+         scm_gc_unprotect_object (n->self_scm ());
        }
       else
        warning (_f ("invalid inversion pitch: not part of chord: %s",
@@ -403,7 +414,7 @@ Chord::get_chord (SCM tonic, SCM add, SCM sub, SCM inversion, SCM bass, SCM dur)
       n->set_mus_property ("duration", dur);
       n->set_mus_property ("bass", SCM_BOOL_T);
       list = gh_cons (n->self_scm (), list);
-      scm_unprotect_object (n->self_scm ());
+      scm_gc_unprotect_object (n->self_scm ());
     }
   
   for (SCM i = pitches; gh_pair_p (i); i = gh_cdr (i))
@@ -412,10 +423,11 @@ Chord::get_chord (SCM tonic, SCM add, SCM sub, SCM inversion, SCM bass, SCM dur)
       n->set_mus_property ("pitch", gh_car (i));
       n->set_mus_property ("duration", dur);
       list = gh_cons (n->self_scm (), list);
-      scm_unprotect_object (n->self_scm ());
+      scm_gc_unprotect_object (n->self_scm ());
     }
 
-  Simultaneous_music*v = new Request_chord (list);
+  Simultaneous_music*v = new Request_chord (SCM_EOL);
+  v->set_mus_property ("elements", list);
 
   return v;
 }