]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/request-chord.cc
Add cautionary-style to interface.
[lilypond.git] / lily / request-chord.cc
index 084042f021be6d18078bdf8c35162cab3ba81127..322cf49e03ea563cd22ae24836d46b667b6b5244 100644 (file)
@@ -16,23 +16,32 @@ Request_chord::Request_chord ()
                    Request_chord_iterator::constructor_cxx_function);
 }
 
-
-
 Pitch
 Request_chord::to_relative_octave (Pitch last)
 {
-  for (SCM s = music_list (); gh_pair_p (s);  s = gh_cdr (s))
+  for (SCM s = music_list (); gh_pair_p (s);  s = ly_cdr (s))
     {
-      Music * mus = unsmob_music (gh_car (s));
-      if (Melodic_req *m= dynamic_cast <Melodic_req *> (mus))
+      Music * mus = unsmob_music (ly_car (s));
+      Melodic_req *m= dynamic_cast <Melodic_req *> (mus);
+
+      /*
+       kLudge: rests have pitches now as well.
+       */
+      Rest_req *r = dynamic_cast<Rest_req*> (mus);
+      
+      if (r || m)
        {
-         Pitch pit = *unsmob_pitch (m->get_mus_property ("pitch"));
+         Pitch *old_pit = unsmob_pitch (mus->get_mus_property ("pitch"));
+         if (!old_pit)
+           continue;
          
-         pit.to_relative_octave (last);
-         m->set_mus_property ("pitch", pit.smobbed_copy ());
-                 
-         return pit;
+         Pitch new_pit = *old_pit;
+         new_pit.to_relative_octave (last);
+         mus->set_mus_property ("pitch", new_pit.smobbed_copy ());
+
+         return new_pit;
        }
+
     }
   return last;
 }
@@ -43,6 +52,4 @@ Request_chord::start_mom () const
   return Music::start_mom ();
 }
 
-
-
 ADD_MUSIC (Request_chord);