[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stopwatch time in markup
From: |
Carl D. Sorensen |
Subject: |
Re: Stopwatch time in markup |
Date: |
Mon, 26 Jan 2009 13:10:19 -0700 |
Tom Hall <reg <at> ludions.com> writes:
>
>
> OK, I'll do it this way, the arguments to the music-fn are now strings and not
> integers, so no integer-> string conversion needed. It would be better to
still
> use integers and then pad a 0 where required, but I'm not sure how to do this.
Use the format procedure. You can read more about the format procedure
at the Guile reference manual:
http://www.gnu.org/software/guile/manual/html_node/
Formatted-Output.html#Formatted-Output
LilyPond uses a simplified version of the format procedure to reduce
calculation time. If the output you want is not supported by the lilypond
format (roman numerals, for example), you can get the full format
procedure in lilypond by calling fancy-format.
stopwatch =
#(define-music-function (parser location minutes seconds) (integer?
integer?)
"Put the time given by @var{minutes} and @var{seconds} in a rounded box."
(let ((pretty-seconds (format #f "~2,'0d" seconds))
(minutes-string (number->string minutes)))
#{ \mark \markup \rounded-box \small \concat
{ $minutes-string \char ##x2032 $pretty-seconds \char ##x2033 } #}))
{ c'1 \stopwatch #4 #3 c' \stopwatch #2 #45 c' }
HTH,
Carl
- Re: Stopwatch time in markup, (continued)