lilypond-devel
[Top][All Lists]
Advanced

[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:1.9.1.9) 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"...

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

Thank you,
josé

code:
\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 #\-))
    (begin
     (format #t "~a\n" sp)
     (set! myvar sp))))

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

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

--
http://zepadovani.info




reply via email to

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