Tom Hall wrote:
> This works well for most times, except when secs <10
> 
> { c'1 \timestamp #4 #03 c' }
> 
> Here 03 gets passed in as an integer of 3 I guess
> so the result looks not so good: 4"3'
> 
> WOuld you know how to add to the func a way to pad a zero 
> in case of situations like the above?

Whoops.

_____________________________________________________________


\version "2.12.1"

%{
%% paranoid version:
timestamp =
#(define-music-function (parser location minutes seconds) (number? number?)
   (let* ((tens (if (< seconds 10) "0" ""))
          (min  (number->string minutes))
          (sec  (string-append tens (number->string seconds))))
    #{ \mark \markup \rounded-box \small \concat
        { $min \char ##x2032 $sec \char ##x2033 } #}))
%}

timestamp =
#(define-music-function (parser location minutes seconds) (number? number?)
   (let* ((tens (if (< seconds 10) "0" ""))
          (min  (number->string minutes))
          (sec  (string-append tens (number->string seconds))))
    #{ \mark \markup \rounded-box \small \concat { $min ′ $sec ″ } #}))

{ c'1 \timestamp #4 #03 c' \timestamp #4 #33 c' }

_____________________________________________________________


- Mark






_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to