lilypond-user
[Top][All Lists]
Advanced

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

Using \tempo or multiple events in define-event-function


From: Pavel Roskin
Subject: Using \tempo or multiple events in define-event-function
Date: Mon, 16 Apr 2012 17:23:22 -0400

Hello!

I cannot use define-event-function for tempo changes.  That's what I'm
trying to do:

\version "2.15.36"
rit = #(define-event-function (parser location) () #{
  ^"rit." \tempo 4=40
#})
\new Voice { \tempo 4=50 c'4 e'4 \rit g'2 }

I get an error:

event.ly:3:10: error: syntax error, unexpected \tempo, expecting $end
  ^"rit." 
          \tempo 4=40
event.ly:5:38: error: error in #{ ... #}
\new Voice { \tempo 4=50 c'4 e'4 \rit 
                                      g'2 }

It turns out I cannot put more than one statement into the function.
For example, this works:

\version "2.15.36"
rit = #(define-event-function (parser location) () #{
  ^"rit."
#})
\new Voice { \tempo 4=50 c'4 e'4 \rit g'2 }

And this works:

\version "2.15.36"
rit = #(define-event-function (parser location) () #{
  \pp
#})
\new Voice { \tempo 4=50 c'4 e'4 \rit g'2 }

But this doesn't work:

\version "2.15.36"
rit = #(define-event-function (parser location) () #{
  ^"rit." \pp
#})
\new Voice { \tempo 4=50 c'4 e'4 \rit g'2 }

There is an additional problem with \tempo.  It returns a value
that causes an error:

\version "2.15.36"
rit = #(define-event-function (parser location) () #{
  \tempo 4=40
#})
\new Voice { \tempo 4=50 c'4 e'4 \rit g'2 }

event.ly:5:33: error: post event function cannot return #<Prob: Music
C++: Music((elements #<Prob: Music C++: Music((metronome-count . 40)
(tempo-unit . #<Duration 4 >) (text) (origin . #<location
event.ly:3:2>))((display-methods #<procedure #f (expr parser)>) (name .
TempoChangeEvent) (types general-music event tempo-change-event)) >
#<Prob: Music C++: Music((context-type . Score) (element . #<Prob:
Music C++: Music((value . #<Mom 10>) (symbol .
tempoWholesPerMinute))((display-methods #<procedure #f (expr parser)>)
(name . PropertySet) (types layout-instruction-event general-music)
(iterator-ctor . #<primitive-procedure
ly:property-iterator::constructor>)) > ))((display-methods #<procedure
#f (expr parser)> #<procedure #f (expr parser)> #<procedure #f (expr
parser)> #<procedure #f (expr parser)> #<procedure #f (expr parser)>
#<procedure #f (expr parser)> #<procedure #f (expr parser)> #<procedure
#f (expr parser)>) (name . ContextSpeccedMusic) (iterator-ctor .
#<primitive-procedure ly:context-specced-music-iterator::const

-- 
Regards,
Pavel Roskin



reply via email to

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