lilypond-user
[Top][All Lists]
Advanced

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

custom VoiceFollower


From: address@hidden
Subject: custom VoiceFollower
Date: Tue, 19 Jun 2012 14:45:32 +0200

Hey all,

Does anyone have any idea why the custom-rolled VoiceFollower isn't printing in 
the example below?  I'm positive the grob is being created and that it is 
linking successive notes (check out the print to the command line to see the 
info).

Cheers,
MS

\version "2.14.2"

#(define (define-grob-property symbol type? description)
  (if (not (equal? (object-property symbol 'backend-doc) #f))
      (ly:error (_ "symbol ~S redefined") symbol))

  (set-object-property! symbol 'backend-type? type?)
  (set-object-property! symbol 'backend-doc description)
  symbol)

#(define-grob-property 'link-me boolean? "Link two grobs.")

changeEngraver =
    #(let ((note-head-list '()))
       (list
         (cons 'acknowledgers
               (list
                 (cons 'note-head-interface
                       (lambda (engraver grob source-engraver)
                         (if (ly:grob-property grob 'link-me #f)
                           (set! note-head-list (cons grob note-head-list)))))))
         (cons 'process-acknowledged
               (lambda (trans)
                 (if (= 2 (length note-head-list))
                   (let ((grob (ly:engraver-make-grob trans
                                                      'VoiceFollower
                                                      (cadr note-head-list))))
                     (ly:spanner-set-bound! grob LEFT (car note-head-list))
                     (ly:spanner-set-bound! grob RIGHT (cadr note-head-list))
                     (set! note-head-list '())))))))

\layout { \context { \Score \consists \changeEngraver } }

\new Staff \relative c' {
  \override NoteHead #'link-me = ##t
  \override Score.VoiceFollower #'stencil =
#(lambda (grob)
  (format #t "INFO ~a ~a\n"
    (ly:grob-property grob 'left-bound-info)
    (ly:grob-property grob 'right-bound-info))
  (ly:line-spanner::print grob))
  a1 b \break c d \break e f \break g a
}


reply via email to

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