[Top][All Lists]

[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
     . ((description . "DOCME")
        (types . (folded-music-event repeated-music))

  (map (lambda (x)
         (set-object-property! (car x)
                               (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)))

#(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
  (let ((type (or (assoc-get name '(("volta" . VoltaRepeatedMusic)
                                    ("unfold" . UnfoldedRepeatedMusic)
                                    ("fold" . FoldedMusicEvent)
                                    ("percent" . PercentRepeatedMusic)
                                    ("tremolo" . TremoloRepeatedMusic)))
                  (begin ;; commented for now
                         ;  (_ "unknown repeat type `~S':
                         ;    must be volta, unfold, percent, or tremolo")
                         ; name)
        (talts (if (< times (length alts))
                     ;; commented for now
                     ;(ly:warning (_
                     ;    "More alternatives than repeats.
                     ;    Junking excess alternatives"))
                     (take alts times))
    (make-music type
                'element main
                'repeat-count (max times 1)
                'elements talts)))

  (resolve-module '(lily))
  (module-ref (current-module) 'make-repeat))


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 }

%% works with unfoldRepeats:
\unfoldRepeats \mus

%% not working:


reply via email to

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