[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bar lines and unfolded repeats
From: |
Dan Eble |
Subject: |
Re: bar lines and unfolded repeats |
Date: |
Mon, 18 Aug 2008 05:20:31 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Dan Eble <dan <at> faithful.be> writes:
>
> David Pounder <pounderd <at> lineone.net> writes:
>
> >
> > I would probably try using \tag round the \bar commands and
> > \removeWithTag for the volta-repeated section.
> >
>
> Well, it gets the job done (thanks for that), but it's less elegant
> than I was hoping for. For one thing, I don't want to have to remove
> those bars in the usual case. Is there a way to tag something so that
> it is *not* present by default, but only when requested?
I found a way that makes the ly a little cleaner.
acceptWithTag =
#(define-music-function
(parser location tag music) (symbol? ly:music?)
(music-map
(lambda (m)
(let* ((tags (ly:music-property m 'tags))
(res (memq tag tags)))
(if res
(let ((void-music (ly:music-property m 'void)))
(if (ly:music? void-music)
void-music
m)
)
m)))
music))
void =
#(define-music-function (parser location music) (ly:music?)
(make-music 'SequentialMusic 'void music))
sampleNotes = \relative c'
{
\partial 2
e e | c c c c | e2 \tag #'unfolded \void \bar "||"
\repeat volta 2 { e4 e | e e e e | }
\alternative {
{ d2 \tag #'unfolded \void \bar "" }
{ c2 \bar "|." }
}
}
\book
{
\score { \unfoldRepeats \acceptWithTag #'unfolded \sampleNotes }
\score { \sampleNotes }
}