]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/ambitus-engraver.cc
Backport some regression tests. Fixes compile.
[lilypond.git] / lily / ambitus-engraver.cc
index 56573a5fddb2e3bd34928b4732346e362d3e009b..2585bd8bc1c0fe00f9f55a85232e97ecb82cc7c1 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2002--2007 Juergen Reuter <reuter@ipd.uka.de>
+  (c) 2002--2009 Juergen Reuter <reuter@ipd.uka.de>
 
   Han-Wen Nienhuys <hanwen@xs4all.nl
 */
@@ -28,8 +28,10 @@ class Ambitus_engraver : public Engraver
 {
 public:
   TRANSLATOR_DECLARATIONS (Ambitus_engraver);
+protected:
+  DECLARE_ACKNOWLEDGER (note_head);
+
   void process_music ();
-  void acknowledge_note_head (Grob_info);
   void stop_translation_timestep ();
   virtual void finalize ();
   virtual void derived_mark () const;
@@ -121,7 +123,14 @@ Ambitus_engraver::acknowledge_note_head (Grob_info info)
   Stream_event *nr = info.event_cause ();
   if (nr && nr->in_event_class ("note-event"))
     {
-      Pitch pitch = *unsmob_pitch (nr->get_property ("pitch"));
+      SCM p = nr->get_property ("pitch");
+      /*
+       If the engraver is added to a percussion context,
+       filter out unpitched note heads.
+      */
+      if (!unsmob_pitch (p))
+       return;
+      Pitch pitch = *unsmob_pitch (p);
       Drul_array<bool> expands = pitch_interval_.add_point (pitch);
       if (expands[UP])
        causes_[UP] = nr;
@@ -135,7 +144,7 @@ Ambitus_engraver::finalize ()
 {
   if (ambitus_ && !pitch_interval_.is_empty ())
     {
-      Grob * accidental_placement =
+      Grob *accidental_placement =
        make_item ("AccidentalPlacement",
                   accidentals_[DOWN]->self_scm ());
 
@@ -198,10 +207,11 @@ ADD_TRANSLATOR (Ambitus_engraver,
                "",
 
                /* create */
+               "AccidentalPlacement "
                "Ambitus "
+               "AmbitusAccidental "
                "AmbitusLine "
-               "AmbitusNoteHead "
-               "AmbitusAccidental ",
+               "AmbitusNoteHead ",
 
                /* read */
                "",