lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with Scheme engraver please


From: Trevor Daniels
Subject: Help with Scheme engraver please
Date: Tue, 23 Aug 2016 21:54:59 +0100

Prompted by the recent discussion on lute tablature, I tried coding a Scheme 
engraver to create the duration grobs but quickly ran into a problem.  I need 
to collect information from both a Listener and an Acknowledger so the obvious 
place to build the grob is in stop-translator-timestep, but my attempts all 
result in a LilyPond crash.  I'm on Windows Vista, so the crash code is not 
very helpful - 1073741819.

Minimal examples below.  The first creates a grob from the Listener and works 
fine.  The second tries to create a grob from stop-translator-timestep and 
fails.

What am I doing wrong?

This works:

\version "2.19.46"

engraver_demo =
#(make-engraver
   (listeners
     ((note-event engraver event)
      (let ((grob (ly:engraver-make-grob engraver 'TextScript event)))
        (ly:grob-set-property! grob 'text "hi")))))

\layout {
  \context {
    \Voice
    \consists
    \engraver_demo
  }
}

\relative {
  c'8
}

This fails:

\version "2.19.46"

#(define ev #f)

engraver_demo =
#(make-engraver
   (listeners
     ((note-event engraver event)
      (set! ev event)))
   ((stop-translation-timestep engraver)
      (let ((grob (ly:engraver-make-grob engraver 'TextScript ev)))
        (ly:grob-set-property! grob 'text "hi"))))

\layout {
  \context {
    \Voice
    \consists
    \engraver_demo
  }
}

\relative {
  c'8
}

Thanks, Trevor

reply via email to

[Prev in Thread] Current Thread [Next in Thread]