[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing volta number text
From: |
Aaron Hill |
Subject: |
Re: Changing volta number text |
Date: |
Fri, 14 May 2021 17:13:32 -0700 |
User-agent: |
Roundcube Webmail/1.4.9 |
On 2021-05-14 2:47 pm, Ralph Palmer wrote:
I *did* find a thread in the archive :
change of volta number
which has gotten me close, but has an extra end-repeat before the first
volta ending bracket. I'm also not sure the format is the most recent.
How about this?
%%%%
\version "2.22.0"
\include "english.ly"
changeVoltaText =
#(define-music-function
(text) (markup?)
(define (is-volta-text? cmd)
(and (pair? cmd) (eq? 'volta (car cmd)) (markup? (cadr cmd))))
(define (replace-volta-text cmd)
(if (is-volta-text? cmd) `(volta ,text) cmd))
(define (proc ctxt)
(let ((cmds (ly:context-property ctxt 'repeatCommands)))
(set! cmds (map replace-volta-text cmds))
(ly:context-set-property! ctxt 'repeatCommands cmds)))
#{ \context Score \applyContext #proc #} )
test = {
\time 3/4
\repeat volta 3
{
a'4 b' c' |
b'4 c' d' |
}
\alternative {
{
\changeVoltaText "1., 3."
e'4 f' g' |
}
{
d'4 c' b' |
}
{
\changeVoltaText \markup \with-color #red "4."
g'4 a' b' |
}
}
c'1
}
\score {
\test
}
%%%%
NOTE: I'm using \markup in the final alternative just to demonstrate
that it works.
-- Aaron Hill