]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/music.cc
Fix #223.
[lilypond.git] / lily / music.cc
index b938c86e2235bc5235b3081a6623d218eb142b6c..83f88fbcd91a06e66988d8c6f52b6de4264d5f2f 100644 (file)
@@ -16,7 +16,6 @@
 #include "ly-smobs.icc"
 #include "main.hh"
 #include "music-sequence.hh"
-#include "pitch.hh"
 #include "score.hh"
 #include "warn.hh"
 
@@ -139,7 +138,7 @@ Music::generic_to_relative_octave (Pitch last)
          Pitch expected_pit (scm_to_int (check),
                              new_pit.get_notename (),
                              new_pit.get_alteration ());
-         origin ()->warning (_f ("octave check failed; expected \"%s\", found: %s",
+         origin ()->warning (_f ("octave check failed; expected \"%s\", found: \"%s\"",
                                  expected_pit.to_string (),
                                  new_pit.to_string ()));
          new_pit = expected_pit;
@@ -185,7 +184,7 @@ Music::compress (Moment factor)
 }
 
 /*
-TODO: make transposition non-destructive
+  This mutates alist.  Hence, make sure that it is not changed 
 */
 SCM
 transpose_mutable (SCM alist, Pitch delta)
@@ -203,7 +202,7 @@ transpose_mutable (SCM alist, Pitch delta)
          Pitch transposed = p->transposed (delta);
          scm_set_cdr_x (entry, transposed.smobbed_copy ());
 
-         if (abs (transposed.get_alteration ()) > DOUBLE_SHARP)
+         if (transposed.get_alteration ().abs () > Rational (1,1))
            {
              warning (_f ("transposition by %s makes alteration larger than double",
                           delta.to_string ()));
@@ -218,7 +217,8 @@ transpose_mutable (SCM alist, Pitch delta)
        transpose_music_list (val, delta);
       else if (prop == ly_symbol2scm ("pitch-alist") &&
               scm_is_pair (val))
-       entry = scm_cons (prop, ly_transpose_key_alist (val, delta.smobbed_copy ()));
+       entry = scm_cons (prop,
+                         ly_transpose_key_alist (val, delta.smobbed_copy ()));
       retval = scm_cons (entry, retval);
     }
 
@@ -253,21 +253,7 @@ Music::origin () const
 Stream_event *
 Music::to_event () const
 {
-  /* UGH. Temp hack */
-  SCM orig_sym = get_property ("name");
-  char out[200];
-  string in = ly_symbol2string (orig_sym);
-  /* don't add '-' before first character */
-  out[0] = tolower (in[0]);
-  size_t outpos = 1;
-  for (size_t inpos = 1; inpos < in.size () && outpos < 190; inpos++)
-    {
-      if (isupper (in[inpos]))
-       out[outpos++] = '-';
-      out[outpos++] = tolower (in[inpos]);      
-    }
-  out[outpos] = 0;
-  SCM class_name = ly_symbol2scm (out);
+  SCM class_name = ly_camel_case_to_lisp_identifier (get_property ("name"));
 
   // catch programming mistakes.
   if (!internal_is_music_type (class_name))