lilypond-user
[Top][All Lists]
Advanced

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

Re: Howto have the number of volte printed out above an end-repeat bar?


From: Vicente Solsona
Subject: Re: Howto have the number of volte printed out above an end-repeat bar?
Date: Tue, 12 Oct 2010 01:53:23 +0200
User-agent: Opera Mail/10.61 (Linux)

On Tue, 12 Oct 2010 01:00:28 +0200, Gilles Filippini <address@hidden> wrote:
I thought I could trigger the mark using a function and a global
variable, but that doesn't work as expected. It seems the function is
evaluated only once while setting the "toto" part instead of being
evaluated in the context of each score:

%-------------------
repeatMark =
#(define-music-function
     (parser location volte)
     (number?)
     (if repeat-mark-visible
   #{
     \once \override Score.RehearsalMark #'break-visibility =
#begin-of-line-invisible
     \once \override Score.RehearsalMark #'self-alignment-X = #RIGHT
     \once \override Score.RehearsalMark #'font-size = #0
     \mark \markup $(string-join (list "repeat" (number->string volte)
"times"))
   #}
   #{ #}
   ))

toto = \relative c'' {
  \mark \default
  d1
  \mark \default
  \repeat volta 3 {
    c b
  }
  \repeatMark #3
  a
  \mark \default
  g
}

#(define repeat-mark-visible #t)
\score {
  \toto
}

#(define repeat-mark-visible #f)
\score {
  \unfoldRepeats {
    \toto
  }
}
%-------------------

Looking for another method :/


I think the following code does it, but putting the music inside a function is probably not a good idea. Maybe some scheme specialist can help you better, I'm surpassed beyond that...

%-------------------------------------------------------------------

\version "2.12.3"

repeatMark =
#(define-music-function
     (parser location volte visible)
     (number? boolean?)
     (if visible
   #{
     \once \override Score.RehearsalMark #'break-visibility =
     #begin-of-line-invisible
     \once \override Score.RehearsalMark #'self-alignment-X = #RIGHT
     \once \override Score.RehearsalMark #'font-size = #0
     \mark \markup $(string-join (list "repeat" (number->string volte)
     "times"))
   #}
   #{ #}
   ))


totito =
#(define-music-function
     (parser location visible)
     (boolean?)
#{
        \relative c'' {
                \mark \default
                d1
                \mark \default
                \repeat volta 3 {
                        c b
                }
                \repeatMark #3 #$visible
                a
                \mark \default
                g
        }
#})


\score {
  \totito ##t
}


\score {
  \unfoldRepeats {
    \totito ##f
  }
}

%-------------------------------------------------------------------

greetings,

Vicente




reply via email to

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