Hi list,

I'm having a problem with a scheme engraver. Whenever I fetch the
direction property of a grob's stem object (or directly through a
listener on stem-event), the following warning is shown:

   warning: no viable initial configuration found: may not find good
            beam slope

The resulting score has a few notes with their stems pointing in the
wrong direction, so that the beams have a terribly ugly slope. As soon
as I remove the code to store the direction everything is fine again.

I've attached a simple demo file where the chaotic stem directions can
be observed. All the code does is to save all grobs it encounters during
the acknowledge phase and then query the direction for each stored grob
during the processing phase.

I'd be happy if you could explain to me why this happens.

Best,
Rekado
\version "2.14.2"

% ---------------------------------------------------

#(define my-engraver
   (let ((grobs '()))
     (list
       ;; process each note object with each saved grob
       (cons 'process-acknowledged
             (lambda (trans)
               (for-each
                 (lambda (grob)
                   (if (ly:grob? grob)
                       (let* ((stem-grob (ly:grob-object grob 'stem))
                              (direction (ly:grob-property stem-grob 
'direction)))
                         (display direction)
                         ))) grobs)))

       ;; save grob for processing
       (cons 'acknowledgers
             (list
               (cons 'note-head-interface
                     (lambda (engraver grob source-engraver)
                       (set! grobs (append grobs (list grob)))))
               ))
       )))

% ---------------------------------------------------

\score {
  \new Staff {
    \clef "bass"
    \key c \major
    \new MyVoice {
      \relative f {
        %e8-4\8
        r2.. e8-4\8 ~ e
        e,8-1\7 fis-2 g16-1 g-2 a8-4 cis-1\8 d-2 e8-4
      }
    }
  }

  \layout {
    \context {
      \Voice
      \name MyVoice
      \alias Voice
      \description "A voice using my engraver"

      \remove "Fingering_engraver"
      \remove "New_fingering_engraver"
      \consists \my-engraver
    }
    \context {
      \Staff
      \accepts "MyVoice"
    }

  }
}
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to