lilypond-devel
[Top][All Lists]
Advanced

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

Re: make-span-event


From: Juergen Reuter
Subject: Re: make-span-event
Date: Tue, 2 Nov 2004 00:46:58 +0100 (CET)

Aah, ok, I understand.  That helps me a lot!

Many thanks,
Jürgen


PS: btw, how did you do the

guile> (mus:display #{ \notemode { d\cr e\endcr } #})

?  Applying grep on the lilypond source tree, I could not find any file 
that defines the "mus:display" function.



On Mon, 1 Nov 2004, Nicolas Sceaux wrote:

> Nicolas Sceaux <address@hidden> writes:
> 
> > Juergen Reuter <address@hidden> writes:
> >
> >> Hi!
> >>
> >> Maybe this is a silly question, but there is something that I do not quite 
> >> understand.  I am trying to create span events in a music function:
> >>
> >> \version "2.4.0"
> >> crescendo = #(def-music-function
> >>           (location music) (ly:music?)
> >>           (make-music 'SequentialMusic
> >>                       'elements (list
> >>                                  (make-span-event 'CrescendoEvent START)
> >>                                  music
> >>                                  (make-span-event 'CrescendoEvent STOP))))
> >>
> 
> A naive solution:
> 
> crescendo = #(def-music-function (location music) (ly:music?)
>                (let* ((seq (ly:music-property music 'elements))
>                       (first (ly:music-deep-copy (car seq))))
>                  (set! (ly:music-property first 'elements)
>                        (cons (make-span-event 'CrescendoEvent START)
>                              (ly:music-property first 'elements)))
>                  (let ((result (list first)))
>                   (make-sequential-music (do ((e (cadr seq) (car rest))
>                                               (rest (cddr seq) (cdr rest)))
>                                              ((null? rest) (begin
>                                                              (set! 
> (ly:music-property e 'elements)
>                                                                    (cons 
> (make-span-event 'CrescendoEvent STOP)
>                                                                          
> (ly:music-property e 'elements)))
>                                                              (reverse! (cons 
> e result))))
>                                            (set! result (cons e result)))))))
> 




reply via email to

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