[ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ LilyPond Scheme interfaces >> ] | ||
[ < Context evaluation ] | [ Up : Contexts for programmers ] | [ Callback functions > ] |
2.3.2 Running a function on all layout objects
The most versatile way of tuning an object is \applyOutput
. Its
syntax is
\applyOutput context proc
where proc is a Scheme function, taking three arguments.
When interpreted, the function proc is called for every layout object found in the context context, with the following arguments:
- the layout object itself,
- the context where the layout object was created, and
- the context where
\applyOutput
is processed.
In addition, the cause of the layout object, i.e., the music
expression or object that was responsible for creating it, is in the
object property cause
. For example, for a note head, this is a
NoteHead event, and for a
Stem object,
this is a
NoteHead object.
Here is a function to use for \applyOutput
; it blanks
note-heads on the center-line:
#(define (blanker grob grob-origin context) (if (and (memq 'note-head-interface (ly:grob-interfaces grob)) (eq? (ly:grob-property grob 'staff-position) 0)) (set! (ly:grob-property grob 'transparent) #t))) \relative c' { e4 g8 \applyOutput #'Voice #blanker b d2 }
[ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ LilyPond Scheme interfaces >> ] | ||
[ < Context evaluation ] | [ Up : Contexts for programmers ] | [ Callback functions > ] |