[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
custom metronome-markup procedure causes weird goops-error
From: |
Valentin Villenave |
Subject: |
custom metronome-markup procedure causes weird goops-error |
Date: |
Fri, 25 Apr 2008 12:03:37 +0200 |
Greetings everybody,
a few days ago Neil sent a new snippet to be added in input/new :
"Adding text indications to metronome marks".
It involved quite a lot of typing, so I tried to come up with a
function that would be easier to use.
Here's my code; it works quite well on simple examples, but on complex
scores it triggers an error I've never seen:
"goops-error: no applicable method for #<<extended-generic> map (0)>"
(see below for the complete message).
%%%%%%%%%%%%%%%%%%%%
#(define-markup-command (mvt layout props arg) (markup?)
(interpret-markup layout props
(markup #:huge #:bold arg)))
#(define (string->duration strElt) ;; from LSR snippet 390
( let*((ptindex (string-index strElt #\. )) (ptnumber 0)
(val (string->number (if ptindex (substring strElt 0 ptindex) strElt)))
(dur (ly:intlog2 val)))
(while ptindex (begin
(set! ptnumber (1+ ptnumber))
(set! ptindex (string-index strElt #\. (1+ ptindex)))))
(ly:make-duration dur ptnumber 1 1)))
mov =
#(define-music-function (parser location text duration count)
(string? string? integer?)
(define (format-metronome-markup dur count context)
(make-line-markup
(list
(markup #:mvt text #:hspace 1)
(make-simple-markup "(")
(make-general-align-markup Y DOWN (make-smaller-markup
(make-note-by-number-markup (ly:duration-log dur)
(ly:duration-dot-count dur)
1)))
(make-simple-markup "=")
(make-simple-markup (number->string count))
(make-simple-markup ")"))))
(make-music 'ContextSpeccedMusic
'context-type 'Score 'element
(make-music 'SequentialMusic 'elements
(list (make-music 'PropertySet
'value (ly:duration-length (string->duration duration))
'symbol 'tempoWholesPerMinute)
(make-music 'PropertySet
'value (string->duration duration)
'symbol 'tempoUnitDuration)
(make-music 'PropertySet
'value count
'symbol 'tempoUnitCount)))))
\relative { \mov #"Largo" #"2." #140 c1 d \tempo 4 = 120 e }
%%%%%%%%%%%%%%%%%%%%
Now for the big message:
/usr/local/lilypond/usr/bin/../share/guile/1.8/oop/goops.scm:100:3: In
procedure scm-error in expression (scm-error (quote goops-error) #f
...):
/usr/local/lilypond/usr/bin/../share/guile/1.8/oop/goops.scm:100:3: No
applicable method for #<<extended-generic> map (0)> in call (map
#<procedure #f (y)> #<Prob: Music C++: Music((origin . #<location
(position inconnue)>) (element . #<Prob: Music C++: Music((origin .
#<location (position inconnue)>) (elements #<Prob: Music C++:
Music((origin . #<location (position inconnue)>) (symbol .
tempoWholesPerMinute) (value . #<Mom 1/4>))((display-methods
#<procedure #f (expr parser)>) (name . PropertySet) (types
layout-instruction-event general-music) (iterator-ctor .
#<primitive-procedure ly:property-iterator::constructor>)) >
#<Prob: Music C++: Music((origin . #<location (position inconnue)>)
(symbol . tempoUnitDuration) (value . #<Duration 4
>))((display-methods #<procedure #f (expr parser)>) (name .
PropertySet) (types layout-instruction-event general-music)
(iterator-ctor . #<primitive-procedure
ly:property-iterator::constructor>)) >
#<Prob: Music C++: Music((origin . #<location (position inconnue)>)
(symbol . tempoUnitCount) (value . 48))((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 (seq parser)>) (name .
SequentialMusic) (length-callback . #<primitive-procedure
ly:music-sequence::cumulative-length-callback>) (start-callback .
#<primitive-procedure ly:music-sequence::first-start-callback>)
(elements-callback . #<procedure #f (m)>) (iterator-ctor .
#<primitive-procedure ly:sequential-iterator::constructor>) (types
general-music sequential-music)) >
) (context-type . Score))((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)> #<procedure #f (expr parser)>
#<procedure #f (expr parser)>) (name . ContextSpeccedMusic)
(iterator-ctor . #<primitive-procedure
ly:context-specced-music-iterator::constructor>) (length-callback .
#<primitive-procedure ly:music-wrapper::length-callback>)
(start-callback . #<primitive-procedure
ly:music-wrapper::start-callback>) (types context-specification
general-music music-wrapper-music)) >
)
Can anyone help me?
Cheers,
Valentin
- custom metronome-markup procedure causes weird goops-error,
Valentin Villenave <=
- Re: custom metronome-markup procedure causes weird goops-error, Valentin Villenave, 2008/04/25
- Re: custom metronome-markup procedure causes weird goops-error, Neil Puttock, 2008/04/25
- Re: custom metronome-markup procedure causes weird goops-error, Reinhold Kainhofer, 2008/04/29
- Re: custom metronome-markup procedure causes weird goops-error, Nicolas Sceaux, 2008/04/29
- Re: custom metronome-markup procedure causes weird goops-error, Valentin Villenave, 2008/04/29
- Re: custom metronome-markup procedure causes weird goops-error, Nicolas Sceaux, 2008/04/29