[Top][All Lists]

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

Store values in a scheme variable to use after

From: josé henrique padovani
Subject: Store values in a scheme variable to use after
Date: Sat, 05 Jun 2010 14:04:08 -0300
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; pt-BR; rv: Gecko/20100317 Thunderbird/3.0.4

Hi... I'm trying to store a NoteHead's position (by using scheme functions) to be abble to use this value after (as a string in a markup)... To do that I define a variable (myvar with the string "init") and then I use tweak to set! myvar to its new value...

But when I call myvar from a markup, it still finds the old argument "init"...

Is it possible to do something like what I am trying to do in another way?

Thank you,

\version "2.13.22"

#(define myvar "init")

#(define (notehead-get-staffposition notehead)
   ;; notehead is grob
   (ly:grob-property notehead 'staff-position))

#(define (change-myvar notehead)
   ;; notehead is grob
   (let ((sp (ly:number->string (notehead-get-staffposition notehead))))
     (format #t "~2&~a\n" (make-string 40 #\-))
     (format #t "~a\n" sp)
     (set! myvar sp))))

\relative c' {
  c1^\markup{\text \myvar}

  \once \override NoteHead #'before-line-breaking = #change-myvar
  g^\markup{\text \myvar}
  a^\markup{\text \myvar}


reply via email to

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