lilypond-devel
[Top][All Lists]
Advanced

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

Re: trying to make a music function, Part 3 of X


From: Nicolas Sceaux
Subject: Re: trying to make a music function, Part 3 of X
Date: Sat, 03 Jun 2006 10:57:18 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

Kieren MacMillan <address@hidden> writes:

> What I want to get is
>
> (make-music
>    'SequentialMusic
>    'elements
>    (list (make-music 'ContextSpeccedMusic ...)
>          (make-music 'EventChord
>            'elements
>            (list (make-music 'NoteEvent ...)
>                  (make-music 'AbsoluteDynamicEvent ...)))))

So here you can see that, having an EventChord, you have to build a
SequentialMusic expression, containing a ContextSpeccedMusic element for
the property override, and the modified EventChord.

%% not tested
addDynText =
#(define-music-function (parser location dyn text event-chord)
                        (string? string? ly:music?)
   ;; add the AbsoluteDynamicEvent to the EventChord
   (set! (ly:music-property event-chord 'elements)
         (cons (make-music 'AbsoluteDynamicEvent
                           'text (markup #:dynamic dyn 
                                         #:normal-text #:italic text))
                 (ly:music-property event-chord 'elements)))
   ;; return a SequentialMusic with a ContextSpeccedMusic
   ;; and the modified EventChord
   (make-music 'SequentialMusic
     'elements
     (list (make-music 'ContextSpeccedMusic
             'property-operations '()
             'context-type 'Bottom
             'element (make-music 'OverrideProperty
                        'once #t
                        'grob-property-path (list 'X-offset)
                        'grob-value -1.5
                        'symbol 'DynamicText
                        'pop-first #t))
           event-chord)))




reply via email to

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