>I am not top-posting
I have defined a function sspOn that just sets a variable SSP to 1. It is called from the music expression \music. \music is used in the Voice context as well as in the NoteNames context. However, the function call is made only once. How do I get the function to be called in the NoteNames context? I have a function myNoteNames that works with the NoteNames and I am testing if the variable SSP is set to 1 or not there. It seems to be always zero. %%%%%%%%%%%%%%%%% \version "2.18.2" SSP = #0 TSP = #0 sonne = #0 onnu = #1 sspOn = #(define-void-function (parser location) () (format #t "Inside sspOn onnu ~a ~%" onnu) (set! SSP onnu)) sspOff = #(define-void-function (parser location) () (set! SSP sonne)) newnames = #`(("c" . "S") ("d" . "R") ("e" . "G") ("f" . "M") ("g" . "P") ("a" . "D") ("b" . "N")) #(define (myNoteNames size nsiz) (lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) (cause (event-cause grob)) (duration (ly:prob-property cause 'duration)) (duration-log (ly:duration-log duration)) (notesize nsiz) (notesize (if (equal? TSP 1) 3 (if (equal? SSP 1) 2 nsiz))) (suffix (if (<= duration-log notesize) (if (or (string=? (substring default-name 0 1) "d") (string=? (substring default-name 0 1) "b")) "i" "a") "")) ;; half note (text (string-append new-name suffix)) ) (format #t "SSP ~a notesize ~a duration ~a new name ~a nsiz ~a ~%" SSP notesize duration-log text nsiz) (ly:grob-set-property! grob 'text (markup #:fontsize size text)) (ly:text-interface::print grob) ) )) music = \relative c' {c d e f g2 g4 f \sspOn f e d a' \sspOff a b b} \new Staff { << \new Voice { \music } \context NoteNames { \override NoteName.stencil = #(myNoteNames 0 1) \music } >> } %%%%%%%%%%%%%% _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user