bug-lilypond
[Top][All Lists]
Advanced

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

Re: Percent repeats in lyrics causes error in 2.18.2


From: Thomas Morley
Subject: Re: Percent repeats in lyrics causes error in 2.18.2
Date: Wed, 8 May 2019 00:11:41 +0200

Am Di., 7. Mai 2019 um 23:20 Uhr schrieb David Kastrup <address@hidden>:

> >> > It sounded to me like what desired was more like \repeat fold , namely
> >> > something that doesn't do anything except be subject to \repeat unfold

> >> More like subject to \unfoldRepeats .  Sorry, got confused.

> When used with appropriate markup, it could be used for creating dal
> segno al coda structures behaving reasonably sensibly in Midi.

I tried a quick adhoc coding.

Works with \unfoldRepeats, regrettable prints nothing without it.
I'd expect to see it at least one time printed without \unfoldRepeats.

Anyway, here my coding so far, what do I miss?

#(define-event-class 'folded-music-event 'music-event)

#(define folded-music-types
  '(
    (FoldedMusicEvent
     . ((description . "DOCME")
        (types . (folded-music-event repeated-music))
        ))
    ))

#(set!
  folded-music-types
  (map (lambda (x)
         (set-object-property! (car x)
                               'music-description
                               (cdr (assq 'description (cdr x))))
         (let ((lst (cdr x)))
           (set! lst (assoc-set! lst 'name (car x)))
           (set! lst (assq-remove! lst 'description))
           (hashq-set! music-name-to-property-table (car x) lst)
           (cons (car x) lst)))
       folded-music-types))

#(set! music-descriptions
       (append folded-music-types music-descriptions))

#(set! music-descriptions
       (sort music-descriptions alist<?))

#(define-public (make-repeat name times main alts)
  "Create a repeat music expression, with all properties initialized
properly."
  (let ((type (or (assoc-get name '(("volta" . VoltaRepeatedMusic)
                                    ("unfold" . UnfoldedRepeatedMusic)
                                    ("fold" . FoldedMusicEvent)
                                    ("percent" . PercentRepeatedMusic)
                                    ("tremolo" . TremoloRepeatedMusic)))
                  (begin ;; commented for now
                         ;(ly:warning
                         ;  (_ "unknown repeat type `~S':
                         ;    must be volta, unfold, percent, or tremolo")
                         ; name)
                         'VoltaRepeatedMusic)))
        (talts (if (< times (length alts))
                   (begin
                     ;; commented for now
                     ;(ly:warning (_
                     ;    "More alternatives than repeats.
                     ;    Junking excess alternatives"))
                     (take alts times))
                   alts)))
    (make-music type
                'element main
                'repeat-count (max times 1)
                'elements talts)))


#(module-set!
  (resolve-module '(lily))
  'make-repeat
  (module-ref (current-module) 'make-repeat))

%% EXAMPLE

mus =
<<
  \new Staff { \repeat fold 6 b2 \alternative { bis bes bis bes bis bes } c' }
  \new Lyrics
    \lyricmode {
      \repeat fold 6 foo2 \alternative { barI barII barIII barIV barV barVI }
      bar
    }
>>

%% works with unfoldRepeats:
\unfoldRepeats \mus

%% not working:
\mus


Cheers,
  Harm



reply via email to

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